Beispiel #1
0
    public void SetState(EnemyStateTemplate.StatesAI _State)
    {
        if (this.currState == _State)
        {
            return;
        }

        this.desireState = _State;
    }
Beispiel #2
0
    // Use this for initialization
    public void Init(Enemy _parent)
    {
        this.parent = _parent;

        this.currState   = EnemyStateTemplate.StatesAI.Invalid;
        this.desireState = EnemyStateTemplate.StatesAI.Invalid;

        for (int count = 0; count < this.states.Count; count++)
        {
            this.states[count].Init(this.parent);
        }
    }
    public virtual StatesAI Perceptions()
    {
        for (int count = 0; count < this.perceptions.Count; count++)
        {
            EnemyStateTemplate.StatesAI state = this.perceptions[count].Run();

            if (state != StatesAI.Invalid)
            {
                return(state);
            }
        }

        return(StatesAI.Invalid);
    }
Beispiel #4
0
    void CheckState()
    {
        if (this.desireState == EnemyStateTemplate.StatesAI.Invalid)
        {
            return;
        }

        if (this.desireState == this.currState)
        {
            return;
        }

        if (this.currState != EnemyStateTemplate.StatesAI.Invalid)
        {
            this.states[(int)this.currState].End();
        }

        this.states[(int)this.desireState].Start();

        Debug.Log(this.parent.transform.name + " = " + this.currState + " - " + this.desireState);

        this.currState   = this.desireState;
        this.desireState = EnemyStateTemplate.StatesAI.Invalid;
    }