public override void EnterState(BasicAI owner)
    {
        IFollowState ownerWithFollowInterface = owner as IFollowState;

        if (ownerWithFollowInterface != null)
        {
            ownerWithFollowInterface.Move();
        }
    }
    // 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);
        }
    }
Esempio n. 3
0
    // Can change to States:
    // -> FollowState, if shouldFollow is true
    // -> WarnState, if warnTrigger is set
    // -> IdleState, else
    public override void UpdateState(BasicAI owner)
    {
        IFollowState ownerWithFollowInterface  = owner as IFollowState;
        IWarnState   ownerWithWarningInterface = owner as IWarnState;

        if (ownerWithFollowInterface != null && ownerWithFollowInterface.shouldFollow)
        {
            owner.stateMachine.ChangeState(FollowState.Instance);
        }
        else if (ownerWithWarningInterface != null && ownerWithWarningInterface.dangerApparent == true)
        {
            owner.stateMachine.ChangeState(WarnState.Instance);
        }
        else
        {
            owner.stateMachine.ChangeState(IdleState.Instance);
        }
    }