1
This commit is contained in:
31
Assets/Artists/Scripts/Scenes/PlayerSpawnPointService.cs
Normal file
31
Assets/Artists/Scripts/Scenes/PlayerSpawnPointService.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user