32 lines
946 B
C#
32 lines
946 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using BITFALL.Scene;
|
|
using BITKit;
|
|
using Unity.Mathematics;
|
|
using UnityEngine;
|
|
|
|
namespace BITFALL.Scenes
|
|
{
|
|
[Serializable]
|
|
public class PlayerSpawnPointSingleton : SpawnPointServiceImplement
|
|
{
|
|
protected override ISpawnPointService _spawnPointServiceImplementation=>PlayerSpawnPointService.Singleton;
|
|
}
|
|
public class PlayerSpawnPointService : MonoBehaviour,ISpawnPointService
|
|
{
|
|
internal static ISpawnPointService Singleton { get; private set; }
|
|
internal static readonly List<PlayerSpawnPoint> _spawnPoints=new();
|
|
public static float4x4 RequestSpawnPoint(params object[] tags)
|
|
{
|
|
var point = _spawnPoints.Random().transform;
|
|
return Matrix4x4.TRS(point.position, point.rotation, point.localScale);
|
|
}
|
|
private void Awake()
|
|
{
|
|
Singleton = this;
|
|
}
|
|
float4x4 ISpawnPointService.RequestSpawnPoint(params object[] tags)=>RequestSpawnPoint(tags);
|
|
}
|
|
}
|