25 lines
836 B
C#
25 lines
836 B
C#
|
using System;
|
||
|
using BlueWater.Players.Combat;
|
||
|
using UnityEngine;
|
||
|
|
||
|
namespace BlueWater
|
||
|
{
|
||
|
public class GameManager : Singleton<GameManager>
|
||
|
{
|
||
|
// Combat
|
||
|
[SerializeField]
|
||
|
private GameObject _combatPlayerPrefab;
|
||
|
public CombatPlayer CurrentCombatPlayer { get; private set; }
|
||
|
|
||
|
// Events
|
||
|
public event Action<Transform> OnInstantiateCombatPlayer;
|
||
|
|
||
|
public void InstantiateCombatPlayer(Vector3 position, Quaternion rotation = default)
|
||
|
{
|
||
|
var instantiatePlayer = Instantiate(_combatPlayerPrefab, position, rotation).GetComponent<CombatPlayer>();
|
||
|
OnInstantiateCombatPlayer?.Invoke(instantiatePlayer.transform);
|
||
|
}
|
||
|
|
||
|
public void SetCurrentCombatPlayer(CombatPlayer combatPlayer) => CurrentCombatPlayer = combatPlayer;
|
||
|
}
|
||
|
}
|