示例#1
0
    public override void setupState(StateBehaviour state)
    {
        if (state is StateEat)
        {
            StateEat stateEat = (StateEat)state;

            stateEat.food = currentFood;
        }
        else if (state is StateWalkTo)
        {
        }
        else
        {
            throw new System.Exception("Can't setup the state : " + state.ToString());
        }
    }
    public override void setupState(StateBehaviour state)
    {
        if (state is StateHunt)
        {
            StateHunt stateEat = (StateHunt)state;

            stateEat.prey           = this.currentPrey;
            stateEat.attackDistance = this.attackDistance;
        }
        else if (state is StateAttack)
        {
            StateAttack stateAttack = (StateAttack)state;

            stateAttack.damage = this.damage;
        }
        else
        {
            throw new System.Exception("Can't setup the state : " + state.ToString());
        }
    }