1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- using System;
- using UnityEngine;
- namespace Game
- {
- public class AnimatorCockController : ICockController
- {
- private readonly Animator _animator;
- private const string Status = "status";
- private const int StatusIdle = 1;
- private const int StatusWalk = 2;
- private const int StatusRun = 3;
- private const int StatusIdle2 = 4;
- private const string TriggerAttack = "attack";
- private const string TriggerUnderAttack = "underattack";
- private const string TriggerJumpAttack = "jumpattack";
- private const string TriggerDie = "die";
- public AnimatorCockController(Animator animator)
- {
- _animator = animator;
- }
- public Action OnRun { get; set; }
- public Action OnIdle { get; set; }
- public Action OnAttack { get; set; }
- public Action OnJumpAttack { get; set; }
- public void Idle()
- {
- _animator.SetInteger(Status, StatusIdle);
- OnIdle?.Invoke();
- }
- public void Walk()
- {
- throw new System.NotImplementedException();
- }
- public void Run()
- {
- _animator.SetInteger(Status, StatusRun);
- OnRun?.Invoke();
- }
- public void IdleInBattle()
- {
- _animator.SetInteger(Status, StatusIdle2);
- OnIdle?.Invoke();
- }
- public void Attack()
- {
- _animator.ResetTrigger(TriggerAttack);
- _animator.SetTrigger(TriggerAttack);
- OnAttack?.Invoke();
- }
- public void JumpAndAttack()
- {
- _animator.ResetTrigger(TriggerJumpAttack);
- _animator.SetTrigger(TriggerJumpAttack);
- OnJumpAttack?.Invoke();
- }
- public void UnderAttack()
- {
- _animator.ResetTrigger(TriggerUnderAttack);
- _animator.SetTrigger(TriggerUnderAttack);
- }
- public void Die()
- {
- _animator.ResetTrigger(TriggerDie);
- _animator.SetTrigger(TriggerDie);
- }
- public void BeLift()
- {
-
- }
- }
- }
|