void Awake() { characterStateMachine = gameObject.GetComponent<CharacterStateMachine>(); Vector3 s = new Vector3(); if(s.Aprox(.1f)) { } }
public StateStruct( States state, Action onEnterFunction, Action onUpdateFunction, Action onExitFunction, float time, CharacterStateMachine stateMachine ) { this.state = state; this.onEnterFunction = onEnterFunction; this.onUpdateFunction = onUpdateFunction; this.onExitFunction = onExitFunction; this.time = time; this.timer = new Timer(time, stateMachine, state); if(onEnterFunction != null) timer.timerStarted += onEnterFunction; if(onUpdateFunction != null) timer.timerUpdate += onUpdateFunction; if(onExitFunction != null) timer.timerCompleted += onExitFunction; timer.timerCompleted += () => stateMachine.RemoveState(state); }