This commit is contained in:
CortexCore
2023-11-15 23:54:54 +08:00
parent ee3ecec6cb
commit 3c837a4a33
356 changed files with 73756 additions and 26493 deletions

View File

@@ -13,7 +13,8 @@
"GUID:9354affc93e0f3e4a904785e7d4c0f59",
"GUID:1235ca61e7f433b408ed5a68767e7123",
"GUID:d8b63aba1907145bea998dd612889d6b",
"GUID:7efac18f239530141802fb139776f333"
"GUID:7efac18f239530141802fb139776f333",
"GUID:be8fc6f1c44f14943887ab6381170c28"
],
"includePlatforms": [],
"excludePlatforms": [],

View File

@@ -0,0 +1,21 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace BITFALL.Scenes
{
public class PlayerSpawnPoint : MonoBehaviour
{
private void Start()
{
PlayerSpawnPointService._spawnPoints.Add(this);
destroyCancellationToken.Register(Dispose);
}
private void Dispose()
{
PlayerSpawnPointService._spawnPoints.Remove(this);
}
}
}

View 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);
}
}