+ Tycoon, TycoonUi Action Map 추가 + 기본적인 TycoonPlayer 연동 + GameManager에서 CurrentCombatPlayer로직 변경 Closes #5
104 lines
2.8 KiB
C#
104 lines
2.8 KiB
C#
using Sirenix.OdinInspector;
|
|
using Spine.Unity;
|
|
using UnityEngine;
|
|
using UnityEngine.InputSystem;
|
|
|
|
namespace BlueWater.Players.Tycoons
|
|
{
|
|
public class TycoonPlayer : MonoBehaviour
|
|
{
|
|
// Variables
|
|
#region Variables
|
|
|
|
// Components
|
|
[field: SerializeField]
|
|
public Rigidbody Rigidbody { get; private set; }
|
|
|
|
[field: SerializeField]
|
|
public CapsuleCollider CharacterCollider { get; private set; }
|
|
|
|
[field: SerializeField]
|
|
public PlayerInput PlayerInput { get; private set; }
|
|
|
|
[field: SerializeField]
|
|
public Transform VisualLook { get; private set; }
|
|
|
|
[field: SerializeField]
|
|
public SkeletonAnimation SkeletonAnimation { get; private set; }
|
|
|
|
[field: SerializeField]
|
|
public TycoonSpineController TycoonSpineController { get; private set; }
|
|
|
|
[field: SerializeField]
|
|
public TycoonInput TycoonInput { get; private set; }
|
|
|
|
[field: SerializeField]
|
|
public TycoonMovement TycoonMovement { get; private set; }
|
|
|
|
#endregion
|
|
|
|
// Unity events
|
|
#region Unity events
|
|
|
|
private void Awake()
|
|
{
|
|
InitializeComponents();
|
|
InitializeChileComponents();
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
SubscribeEvents();
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
UnSubscribeEvents();
|
|
}
|
|
|
|
#endregion
|
|
|
|
// Initialize methods
|
|
#region Initialize methods
|
|
|
|
[Button("컴포넌트 초기화")]
|
|
private void InitializeComponents()
|
|
{
|
|
Rigidbody = GetComponent<Rigidbody>();
|
|
CharacterCollider = GetComponent<CapsuleCollider>();
|
|
PlayerInput = GetComponent<PlayerInput>();
|
|
VisualLook = transform.Find("VisualLook");
|
|
SkeletonAnimation = VisualLook.GetComponent<SkeletonAnimation>();
|
|
|
|
TycoonSpineController = GetComponent<TycoonSpineController>();
|
|
TycoonInput = GetComponent<TycoonInput>();
|
|
TycoonMovement = GetComponent<TycoonMovement>();
|
|
}
|
|
|
|
private void InitializeChileComponents()
|
|
{
|
|
TycoonSpineController.InitializeComponents(SkeletonAnimation);
|
|
TycoonInput.InitializeComponents(PlayerInput);
|
|
TycoonMovement.InitializeComponents(Rigidbody, VisualLook, TycoonSpineController);
|
|
}
|
|
|
|
#endregion
|
|
|
|
// Methods
|
|
#region Methods
|
|
|
|
private void SubscribeEvents()
|
|
{
|
|
// Input
|
|
TycoonInput.OnMoveInputReceived += TycoonMovement.HandleInputMovement;
|
|
}
|
|
|
|
private void UnSubscribeEvents()
|
|
{
|
|
// Input
|
|
TycoonInput.OnMoveInputReceived -= TycoonMovement.HandleInputMovement;
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
} |