Example #1
0
    public override void UpdateAI()
    {
        Vector3 direction = OrthogonalDirection(transform, target.transform, true);

        if (mTeleport != null && mTeleport.ShouldTeleport())
        {
            mTeleport.Teleport();
        }
        else if (mSimpleAttack != null && mSimpleAttack.CanAttack(direction))
        {
            mSimpleAttack.Attack(direction);
        }
        else if (mSimpleMovement.CanMove(direction))
        {
            mSimpleMovement.Move(direction);
        }
        else
        {
            direction = OrthogonalDirection(transform, target.transform, false);
            if (mSimpleMovement.CanMove(direction))
            {
                mSimpleMovement.Move(direction);
            }
        }
    }
Example #2
0
    public override void UpdateAI()
    {
        if (mCurrentState == AIState.Stun)
        {
            if (mStunTimer > 2f)
            {
                mCurrentState = AIState.Wandering;
            }
        }
        else if (mCurrentState == AIState.Wandering)
        {
        }
        else if (mCurrentState == AIState.Charging)
        {
            if (mSimpleAttack.CanAttack(mChargeDirection))
            {
                mSimpleAttack.Attack(mChargeDirection);
                FollowCamera.main.SimpleShake();

                mCurrentState = AIState.Running;
            }
            else if (mSimpleMovement.CanMove(mChargeDirection))
            {
                mSimpleMovement.Move(mChargeDirection);
            }
            else
            {
                mStunTimer    = 0f;
                mCurrentState = AIState.Stun;

                FollowCamera.main.SimpleShake();
            }
        }
        else if (mCurrentState == AIState.Running)
        {
        }
    }
Example #3
0
    public override void UpdateAI()
    {
        if (mCurrentState == AIState.Stun)
        {
            if (mStunTimer > 2f)
            {
                SwitchState();
            }
        }
        else if (!mTeleportedIntoPlaceForState)
        {
            mTeleport.Teleport(true);

            mTeleportedIntoPlaceForState = true;

            // If we're going into the charging state, get ready to head toward the player ...
            mChargeDirection = TowardPlayer();

            if (mCurrentState == AIState.Charging)
            {
                Game.instance.soundManager.PlaySound("boss2_charge");
            }
        }
        else if (mCurrentState == AIState.Teleporting)
        {
            if (mTeleport.CanTeleport())
            {
                ++mNumTeleports;
                int maxTeleports = 5 + mCurrentPhase;

                mTeleport.Teleport();
                SimpleMovement.OrientToDirection(mSimpleMovement.subMesh, TowardPlayer());

                if (mNumTeleports >= maxTeleports)
                {
                    SwitchState();
                }
            }
        }
        else if (mCurrentState == AIState.Charging)
        {
            if (mSimpleAttack.CanAttack(mChargeDirection))
            {
                mSimpleAttack.Attack(mChargeDirection);
                FollowCamera.main.SimpleShake();

                SwitchState();
            }
            else if (mSimpleMovement.CanMove(mChargeDirection))
            {
                mSimpleMovement.Move(mChargeDirection);
            }
            else
            {
                mStunTimer    = 0f;
                mCurrentState = AIState.Stun;
                Game.instance.soundManager.PlaySound("boss2_smash");

                FollowCamera.main.SimpleShake();
            }
        }
        else if (mCurrentState == AIState.ForwardCast)
        {
            SimpleMovement.OrientToDirection(mSimpleMovement.subMesh, TowardPlayer());

            mSpell2.CastSpell(20);

            SwitchState();
        }
        else if (mCurrentState == AIState.ScreenCast)
        {
            SimpleMovement.OrientToDirection(mSimpleMovement.subMesh, TowardPlayer());

            mSpell1.CastSpell(20);

            SwitchState();
        }
    }