private void Awake() { if (singleton == null) { singleton = this; DontDestroyOnLoad(singleton); } else { DestroyImmediate(singleton); } Setup(); }
// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { Debug.Log("Sono in Walk State"); if (Input.GetKey(KeyCode.W) && Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.S) && Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.A) && Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.D) && Input.GetKey(KeyCode.LeftControl)) { Debug.Log("Sto Camminando nel walk state"); GameManagerMove.RunTriggerState(); } else { Debug.Log("Sono stanco e mi fermo"); GameManagerMove.WaitingTriggerState(); } }
// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { if (Input.GetKeyDown(KeyCode.LeftShift)) { if (Input.GetKey(KeyCode.W) & !Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.S) & !Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.A) & !Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.D) & !Input.GetKey(KeyCode.LeftControl)) { Debug.Log("Sto per cambiare stato da crunch a walk"); GameManagerMove.WalkTriggerState(); } else { Debug.Log("Sto per cambiare stato da crunch a wait"); GameManagerMove.WaitingTriggerState(); } } }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { GameManagerMove.Setup(); GameManagerMove.EventSetup(); Debug.Log("Sono nella waiting state"); }