Exemple #1
0
    public void ChangeState(STATE newState)
    {
        State = newState;
        switch (State)
        {
        case STATE.FORCEDANIMATION:
            AI = AI_ForcedAnimation;
            break;

        case STATE.IDLE:
            AI = AI_Idle;
            break;

        case STATE.COMBAT:
            AI = AI_Combat;
            if (DynamicWaypoint == null)
            {
                DynamicWaypoint           = new Spatial();
                DynamicWaypoint.Transform = new Transform(DynamicWaypoint.Transform.basis, new Vector3(0, 0, 0));
                GetTree().GetRoot().AddChild(DynamicWaypoint);
            }
            WayPoint = DynamicWaypoint;
            break;

        case STATE.DEATH:
            StateMachine.Travel("Death");
            BodyCollisionShape.SetDisabled(true);
            AI = null;
            break;

        case STATE.PLAYER:
            AI = null;
            break;
        }
    }