123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- using System;
- using UnityEngine;
- namespace Game
- {
- public class AnimatorMasterController : IMasterController
- {
- private readonly Animator _animator;
- private const string Status = "status";
- private const int StatusIdle = 1;
- private const int StatusWalk = 2;
- private const int StatusLift = 3;
- private const int StatusPutDown = 4;
-
- private const string TriggerPutDown = "putdown";
- public AnimatorMasterController(Animator animator)
- {
- _animator = animator;
- }
- public Action OnRun { get; set; }
-
- public Action OnWalk { get; set; }
- public Action OnIdle { get; set; }
-
- public Action OnPutDown { get; set; }
-
- public void Idle()
- {
- _animator.SetInteger(Status, StatusIdle);
- OnIdle?.Invoke();
- }
- public void Walk()
- {
- _animator.SetInteger(Status, StatusWalk);
- OnWalk?.Invoke();
- }
- public void Lift()
- {
- _animator.SetInteger(Status, StatusLift);
- }
- public void LiftAndWalk()
- {
-
- }
- public void PutDown()
- {
- _animator.SetTrigger(TriggerPutDown);
- OnPutDown?.Invoke();
- }
- }
- }
|