Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
    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);
        }
    }
Exemplo n.º 3
0
    //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);
    }
Exemplo n.º 4
0
 protected override void OnEnableState(IAStateTag previousState)
 {
     //Nothing
 }
Exemplo n.º 5
0
 protected override void OnDisableState(IAStateTag nextState)
 {
     //Nothing
 }
Exemplo n.º 6
0
 protected override void OnEnableState(IAStateTag previousState)
 {
     talkingCount = 0;
 }
Exemplo n.º 7
0
 protected override void OnEnableState(IAStateTag previousState)
 {
     throw new System.NotImplementedException();
 }
Exemplo n.º 8
0
 protected override void OnDisableState(IAStateTag nextState)
 {
     throw new System.NotImplementedException();
 }
Exemplo n.º 9
0
 protected abstract void PeriodicStateUpdate(); //On Update every update time
 protected abstract void OnDisableState(IAStateTag nextState);
Exemplo n.º 10
0
 protected abstract void OnEnableState(IAStateTag previousState);
Exemplo n.º 11
0
 public void OnDisable(IAStateTag nextState)
 {
     OnDisableState(nextState);
 }
Exemplo n.º 12
0
 //When the state change
 public void OnEnable(IAStateTag previousState)
 {
     OnEnableState(previousState);
     TurnReady();
 }