2023-10-24 07:27:11 +00:00
|
|
|
using System;
|
2023-08-11 16:21:26 +00:00
|
|
|
using Sirenix.OdinInspector;
|
2023-08-08 07:08:41 +00:00
|
|
|
using UnityEngine;
|
|
|
|
|
2023-08-31 06:46:13 +00:00
|
|
|
// ReSharper disable once CheckNamespace
|
|
|
|
namespace BlueWaterProject
|
2023-08-08 07:08:41 +00:00
|
|
|
{
|
2023-09-20 09:06:45 +00:00
|
|
|
[DefaultExecutionOrder(-1)]
|
2023-08-31 06:46:13 +00:00
|
|
|
public class GameManager : Singleton<GameManager>
|
|
|
|
{
|
2024-02-04 15:33:41 +00:00
|
|
|
public ShipPlayer ShipPlayer { get; private set; }
|
|
|
|
|
2024-05-12 08:41:13 +00:00
|
|
|
// Combat
|
|
|
|
[Title("Combat")]
|
|
|
|
[SerializeField] private GameObject combatPlayerPrefab;
|
|
|
|
public CombatPlayer CurrentCombatPlayer { get; set; }
|
|
|
|
public event Action<Transform> OnInstantiateCombatPlayer;
|
|
|
|
|
|
|
|
// Tycoon
|
2023-12-26 05:18:14 +00:00
|
|
|
[Title("Tycoon")]
|
2024-01-03 02:54:03 +00:00
|
|
|
public TycoonPlayer TycoonPlayer { get; private set; }
|
2023-12-26 05:18:14 +00:00
|
|
|
public bool IsBuildMode { get; set; }
|
2024-03-20 17:03:12 +00:00
|
|
|
[field: SerializeField] public bool IsOnFollowCamera { get; set; }
|
2023-08-11 16:21:26 +00:00
|
|
|
|
2023-08-31 06:46:13 +00:00
|
|
|
private void Init()
|
|
|
|
{
|
2024-01-03 02:54:03 +00:00
|
|
|
TycoonPlayer = FindAnyObjectByType<TycoonPlayer>();
|
2024-02-04 15:33:41 +00:00
|
|
|
ShipPlayer = FindAnyObjectByType<ShipPlayer>();
|
2023-08-31 06:46:13 +00:00
|
|
|
}
|
|
|
|
protected override void OnAwake()
|
|
|
|
{
|
|
|
|
Init();
|
|
|
|
}
|
2023-08-11 19:57:41 +00:00
|
|
|
|
2023-08-31 06:46:13 +00:00
|
|
|
private void Start()
|
|
|
|
{
|
|
|
|
Cursor.lockState = CursorLockMode.Confined;
|
|
|
|
}
|
2024-05-12 08:41:13 +00:00
|
|
|
|
|
|
|
public void InstantiateCombatPlayer(Vector3 position, Quaternion rotation = default)
|
|
|
|
{
|
2024-05-13 16:23:53 +00:00
|
|
|
var instantiatePlayer = Instantiate(combatPlayerPrefab, position, rotation).GetComponent<CombatPlayer>();
|
|
|
|
CurrentCombatPlayer = instantiatePlayer;
|
2024-05-12 08:41:13 +00:00
|
|
|
OnInstantiateCombatPlayer?.Invoke(instantiatePlayer.transform);
|
|
|
|
}
|
2023-08-15 20:36:04 +00:00
|
|
|
}
|
2023-08-08 07:08:41 +00:00
|
|
|
}
|