Move() public method

public Move ( Vector2 location ) : void
location Vector2
return void
コード例 #1
0
ファイル: EnemyMelee.cs プロジェクト: bdsowers/cutiequest
    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);
            }
        }
    }
コード例 #2
0
    public override void UpdateAI()
    {
        Vector3 largeDistanceDirection = OrthogonalDirection(transform, target.transform, true);
        Vector3 smallDistanceDirection = OrthogonalDirection(transform, target.transform, false);
        float   distance = Vector3.Distance(transform.position, target.transform.position);

        // todo PRERELEASE - this logic will need some refinement
        if (Random.Range(0, 2) == 0 && SummonAllowed())
        {
            // Summoners try to keep their distance, but will also summon when appropriate.

            bool run = Random.Range(0, 2) == 0;

            if (run && mSimpleMovement.CanMove(-largeDistanceDirection))
            {
                mSimpleMovement.Move(-largeDistanceDirection);
            }
            else if (run && mSimpleMovement.CanMove(-smallDistanceDirection))
            {
                mSimpleMovement.Move(-smallDistanceDirection);
            }
            else if (mSummonCooldownTimer <= 0f)
            {
                Summon();
            }
        }
        else if (mSimpleMovement.CanMove(largeDistanceDirection))
        {
            mSimpleMovement.Move(largeDistanceDirection);
        }
        else
        {
            if (mSimpleMovement.CanMove(smallDistanceDirection))
            {
                mSimpleMovement.Move(smallDistanceDirection);
            }
        }
    }
コード例 #3
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)
        {
        }
    }
コード例 #4
0
    public override void UpdateAI()
    {
        Vector3 largeDistanceDirection = OrthogonalDirection(transform, target.transform, true);
        Vector3 smallDistanceDirection = OrthogonalDirection(transform, target.transform, false);

        Vector3 diff                = transform.position - target.transform.position;
        bool    alignedOnXAxis      = (Mathf.Abs(diff.x) < 0.1f);
        bool    alignedOnZAxis      = (Mathf.Abs(diff.z) < 0.1f);
        bool    alignedOnEitherAxis = (alignedOnXAxis || alignedOnZAxis);

        --mThrowCounter;

        if (mTeleport != null && mTeleport.ShouldTeleport())
        {
            mTeleport.Teleport();
        }
        else if (mProjectileThrower.IsInRange())
        {
            if (alignedOnEitherAxis)
            {
                // Large chance we're going to throw but a small chance we'll move in a random direction instead
                if (Random.Range(0, 100) > 15 && mThrowCounter <= 0 && !WouldThrowProjectileAtWall())
                {
                    ThrowProjectile();
                }
                else
                {
                    Vector3 randomDirection = VectorHelper.RandomOrthogonalVectorXZ();
                    if (mSimpleMovement.CanMove(randomDirection))
                    {
                        mSimpleMovement.Move(randomDirection);
                    }
                    else if (!WouldThrowProjectileAtWall())
                    {
                        ThrowProjectile();
                    }
                }
            }
            else
            {
                // If we're not aligned on one of the axis, there's a decent chance we'll try to become aligned;
                // otherwise, we'll just do a throw.
                if (Random.Range(0, 100) < 20 && mThrowCounter <= 0 && !WouldThrowProjectileAtWall())
                {
                    ThrowProjectile();
                }
                else
                {
                    if (mSimpleMovement.CanMove(smallDistanceDirection))
                    {
                        mSimpleMovement.Move(smallDistanceDirection);
                    }
                }
            }
        }
        else
        {
            // If we're not in range, try ot get in range...
            if (mSimpleMovement.CanMove(largeDistanceDirection))
            {
                mSimpleMovement.Move(largeDistanceDirection);
            }
            else if (mSimpleMovement.CanMove(smallDistanceDirection))
            {
                mSimpleMovement.Move(smallDistanceDirection);
            }
        }
    }
コード例 #5
0
 public void Move(Vector2 dir)
 {
     _pMovement.Move(dir);
 }
コード例 #6
0
ファイル: Boss2.cs プロジェクト: bdsowers/cutiequest
    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();
        }
    }
コード例 #7
0
    public override void UpdateAI()
    {
        Vector3 largeDistanceDirection = OrthogonalDirection(transform, target.transform, true);
        Vector3 smallDistanceDirection = OrthogonalDirection(transform, target.transform, false);
        float   distance = Vector3.Distance(transform.position, target.transform.position);

        mCastCounter--;

        if (mTeleport != null && mTeleport.ShouldTeleport())
        {
            mTeleport.Teleport();
        }
        else if (mSpellCaster.IsInRange())
        {
            // Increase the likelihood that we'll try to move away from the player the closer they get.
            // However, for casters that target themselves, hold your ground for the most part

            bool run = false;
            if (mSpellCaster.targetCaster)
            {
                if (Random.Range(0f, 5f) > distance * 3)
                {
                    run = true;
                }
            }
            else
            {
                if (Random.Range(0f, 5f) > distance)
                {
                    run = true;
                }
            }

            if (mCastCounter > 0)
            {
                run = true;
            }

            Vector3 randomDirection = VectorHelper.RandomOrthogonalVectorXZ();

            if (run && mSimpleMovement.CanMove(-largeDistanceDirection))
            {
                mSimpleMovement.Move(-largeDistanceDirection);
            }
            else if (run && mSimpleMovement.CanMove(-smallDistanceDirection))
            {
                mSimpleMovement.Move(-smallDistanceDirection);
            }
            else if (run && mSimpleMovement.CanMove(randomDirection))
            {
                mSimpleMovement.Move(randomDirection);
            }
            else
            {
                CastSpell();
            }
        }
        else if (mSimpleMovement.CanMove(largeDistanceDirection))
        {
            mSimpleMovement.Move(largeDistanceDirection);
        }
        else
        {
            if (mSimpleMovement.CanMove(smallDistanceDirection))
            {
                mSimpleMovement.Move(smallDistanceDirection);
            }
        }
    }