protected override void OnEnableState(IAStateTag previousState) { Debug.Log("Enter checking"); checkCount = 0; interpelBrain = brain.checkTarget.GetComponent <IABrain>(); isPositioned = false; maxCheckCount = Random.Range(2, 6); timeStartChecking = Time.time; }
protected override void OnEnableState(IAStateTag previousState) { //If not coming from working or checking, the attendingInfo (unit that needs to respond to the officer) resets if (previousState != IAStateTag.WORKING && previousState != IAStateTag.CHECKING) { ResetAttendingInfo(); } //If the officer is back from a state that is not working, let's go to work before idle if (brain.behavior == IABrain.IABehaviour.OFFICER && previousState != IAStateTag.WORKING && previousState != IAStateTag.IDLE) { Debug.Log("Previous state was not working or idle : " + previousState.ToString()); brain.ChangeState(IAStateTag.WORKING); } }
//Create a new state from the tag (gives the right child class) public static IAState CreateNewState(IAStateTag tag, IABrain brain, float updateTime) { switch (tag) { case IAStateTag.IDLE: return(new IAStateIdle(brain, updateTime)); case IAStateTag.WORKING: return(new IAStateWorking(brain, updateTime)); case IAStateTag.TALKING: return(new IAStateTalking(brain, updateTime)); case IAStateTag.CHECKING: return(new IAStateChecking(brain, updateTime)); case IAStateTag.SPOT: return(new IAStateSpot(brain, updateTime)); } return(null); }
protected override void OnEnableState(IAStateTag previousState) { //Nothing }
protected override void OnDisableState(IAStateTag nextState) { //Nothing }
protected override void OnEnableState(IAStateTag previousState) { talkingCount = 0; }
protected override void OnEnableState(IAStateTag previousState) { throw new System.NotImplementedException(); }
protected override void OnDisableState(IAStateTag nextState) { throw new System.NotImplementedException(); }
protected abstract void PeriodicStateUpdate(); //On Update every update time protected abstract void OnDisableState(IAStateTag nextState);
protected abstract void OnEnableState(IAStateTag previousState);
public void OnDisable(IAStateTag nextState) { OnDisableState(nextState); }
//When the state change public void OnEnable(IAStateTag previousState) { OnEnableState(previousState); TurnReady(); }