Ejemplo n.º 1
0
    public override void EnterState(BasicAI owner)
    {
        IDangerZoneState ownerWithDangerZoneInterface = owner as IDangerZoneState;

        if (ownerWithDangerZoneInterface != null)
        {
            ownerWithDangerZoneInterface.IndicateImmediateDangerIsGone();
        }
    }
    // Can change to States:
    // ->
    public override void UpdateState(BasicAI owner)
    {
        IFollowState     ownerWithFollowInterface     = owner as IFollowState;
        IDangerZoneState ownerWithDangerZoneInterface = owner as IDangerZoneState;

        if (ownerWithDangerZoneInterface != null && ownerWithDangerZoneInterface.immediateDangerApparent == false)
        {
            owner.stateMachine.ChangeState(ExitDangerZoneState.Instance);
        }
        else if (ownerWithFollowInterface != null && ownerWithFollowInterface.shouldFollow == true)
        {
            owner.stateMachine.ChangeState(WaitForSafteyInDangerZoneFollowState.Instance);
        }
        else
        {
            owner.stateMachine.ChangeState(WaitForSafteyInDangerZoneState.Instance);
        }
    }