45 lines
1.3 KiB
C#
45 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using MedievalParty.Core.Game;
|
|
using MedievalParty.Entity;
|
|
using MedievalParty.Entity.AI;
|
|
using MedievalParty.Entity.Player;
|
|
using UnityEngine;
|
|
using UnityEngine.Serialization;
|
|
|
|
namespace MedievalParty.Core
|
|
{
|
|
public class GameManager: StateBehaviour
|
|
{
|
|
public static GameManager Instance { get; private set; }
|
|
|
|
public event EventHandler onRollInitiative;
|
|
|
|
[Header("Spawn")]
|
|
[SerializeField] private PlayerObject playerPrefab;
|
|
[SerializeField] private AIObject aiPrefab;
|
|
[SerializeField] private EntityListSO entityList;
|
|
[SerializeField] private List<Transform> spawnPositions;
|
|
|
|
private void Awake()
|
|
{
|
|
if (Instance)
|
|
{
|
|
Debug.LogWarning($"{typeof(GameManager)} already exist! {transform}");
|
|
Destroy(gameObject);
|
|
return;
|
|
}
|
|
|
|
Instance = this;
|
|
}
|
|
|
|
protected override void Start()
|
|
{
|
|
base.Start();
|
|
|
|
GameManager_SpawningEntityState spawningEntity = new GameManager_SpawningEntityState(playerPrefab, aiPrefab, spawnPositions, entityList, ChangeState);
|
|
|
|
ChangeState(spawningEntity);
|
|
}
|
|
}
|
|
} |