Beispiel #1
0
        public override void UpdateBrain(float DT)
        {
            mShipDirection.X   = (float)Math.Cos(mShip.mRotation);
            mShipDirection.Y   = (float)Math.Sin(mShip.mRotation);
            mTargetDirection.X = (float)Math.Cos(GetAngleToPlayer());
            mTargetDirection.Y = (float)Math.Sin(GetAngleToPlayer());
            mCrossValue        = Vector3.Cross(mShipDirection, mTargetDirection);

            if (mCrossValue.Z < 0)
            {
                mShip.ActivateAbility(AbilityType.TurnLeft);
            }
            else if (mCrossValue.Z > 0)
            {
                mShip.ActivateAbility(AbilityType.TurnRight);
            }

            mDistance = (float)Math.Sqrt(Math.Pow((mShip.aaGameWorld.Player.mXPos - mShip.mXPos), 2) + Math.Pow((mShip.aaGameWorld.Player.mYPos - mShip.mYPos), 2));

            if (mCrossValue.Z > -0.1f && mCrossValue.Z < 0.1f)
            {
                if (mDistance < 250)
                {
                    mShip.ActivateAbility(AbilityType.SlowShip);
                }
                else
                {
                    mShip.ActivateAbility(AbilityType.ThrustShip);
                }

                if (!isCharging)
                {
                    if (mDistance < 500)
                    {
                        mShip.ActivateAbility(AbilityType.ChargeLaser);
                    }
                }

                mShootTracker++;
                if (mShootTracker > mShootTrackerMax)
                {
                    mShootTracker = mShootTrackerMax;
                }
            }

            base.UpdateBrain(DT);
        }
Beispiel #2
0
        public override void UpdateBrain(float DT)
        {
            if (!isThereWaypoint)
            {
                SetWaypoint();
                mHalfPoint = Math.Abs((mWayPoint.mXPos - mShip.mXPos) / 2);
            }

            mShipDirection.X   = (float)Math.Cos(mShip.mRotation);
            mShipDirection.Y   = (float)Math.Sin(mShip.mRotation);
            mTargetDirection.X = (float)Math.Cos(GetAngleToWaypoint());
            mTargetDirection.Y = (float)Math.Sin(GetAngleToWaypoint());
            mCrossValue        = Vector3.Cross(mShipDirection, mTargetDirection);

            if (mCrossValue.Z <= 0.1f)
            {
                mShip.ActivateAbility(AbilityType.TurnLeft);
            }
            else if (mCrossValue.Z >= 0.1f)
            {
                mShip.ActivateAbility(AbilityType.TurnRight);
            }

            if (mCrossValue.Z > -0.1f && mCrossValue.Z < 0.1f)
            {
                mShip.ActivateAbility(AbilityType.ThrustShip);
            }

            if (mShip.mCircleCollision.isCollidingPoint(mWayPoint))
            {
                isThereWaypoint = false;
            }

            if (mShip.mXPos > mHalfPoint)
            {
                mShip.ActivateAbility(AbilityType.FireMine);
            }

            mDistance = (float)Math.Sqrt(Math.Pow(mShip.mXPos - mShip.aaGameWorld.aaDisplay.aaCamera.mFocusX, 2) + Math.Pow(mShip.mYPos - mShip.aaGameWorld.aaDisplay.aaCamera.mFocusY, 2));

            if (mDistance < 1000)
            {
                mShip.ActivateAbility(AbilityType.Cloak);
            }

            base.UpdateBrain(DT);
        }
Beispiel #3
0
        public void HandleMovement()
        {
            if (mInput.IsKeyDown(Keys.W))
            {
                (mShip).ActivateAbility(AbilityType.ThrustShip);
            }
            if (mInput.IsKeyDown(Keys.S))
            {
                (mShip).ActivateAbility(AbilityType.SlowShip);
            }
            if (mInput.IsKeyDown(Keys.A))
            {
                (mShip).ActivateAbility(AbilityType.TurnLeft);
            }
            if (mInput.IsKeyDown(Keys.D))
            {
                (mShip).ActivateAbility(AbilityType.TurnRight);
            }
            if (mInput_Mouse.RightButton.Equals(ButtonState.Pressed))
            {
                mShip.ActivateAbility(AbilityType.PlayerAbility1);
            }
            if (mInput.IsKeyDown(Keys.E))
            {
                mShip.ActivateAbility(AbilityType.PlayerAbility3);
            }
            if (mInput.IsKeyDown(Keys.Q))
            {
                mShip.ActivateAbility(AbilityType.PlayerAbility2);
            }
            if (mInput_Mouse.LeftButton.Equals(ButtonState.Pressed) && mShootTracker == mShootTrackerMax)
            {
                mShip.ActivateAbility(AbilityType.FireBullet, GetAngleToMouse());
                mShootTracker = 0;
            }
            if (mInput.IsKeyDown(Keys.Space))
            {
                mShip.ActivateAbility(AbilityType.PlayerAbility4);
            }

            mShootTracker++;
            if (mShootTracker > mShootTrackerMax)
            {
                mShootTracker = mShootTrackerMax;
            }
        }
        public override void UpdateBrain(float DT)
        {
            mShipDirection.X   = (float)Math.Cos(mShip.mRotation);
            mShipDirection.Y   = (float)Math.Sin(mShip.mRotation);
            mTargetDirection.X = (float)Math.Cos(GetAngleToPlayer());
            mTargetDirection.Y = (float)Math.Sin(GetAngleToPlayer());
            mCrossValue        = Vector3.Cross(mShipDirection, mTargetDirection);

            if (mCrossValue.Z < -0.05f)
            {
                mShip.ActivateAbility(AbilityType.TurnLeft);
            }
            else if (mCrossValue.Z > 0.05f)
            {
                mShip.ActivateAbility(AbilityType.TurnRight);
            }


            if (mShip.aHull < 1000 && mSmokeTracker == mSmokeTrackerMax)
            {
                mShootTrackerMax = 20;
                mShip.aaGameWorld.aaGFXHandler.PlayEffect("Explosion_01", mShip.mXPos, mShip.mYPos, mShip.mAssetKit.COLOR_BLENDING);
                mSmokeTracker = 0;
            }

            if (mCrossValue.Z > -0.1f && mCrossValue.Z < 0.1f)
            {
                mDistance = (float)Math.Sqrt(Math.Pow((mShip.aaGameWorld.Player.mXPos - mShip.mXPos), 2) + Math.Pow((mShip.aaGameWorld.Player.mYPos - mShip.mYPos), 2));

                if (mDistance < 300)
                {
                    mShip.ActivateAbility(AbilityType.SlowShip);
                }
                else
                {
                    mShip.ActivateAbility(AbilityType.ThrustShip);
                }

                if (mShootTracker == mShootTrackerMax)
                {
                    mShip.ActivateAbility(AbilityType.FireMultipleBullets, mShip.mRotation, mShip.aHull < 1000);
                    mShip.ActivateAbility(AbilityType.BulletStar);
                    mShootTracker = 0;
                }
            }

            mShootTracker++;
            mSmokeTracker++;
            if (mShootTracker > mShootTrackerMax)
            {
                mShootTracker = mShootTrackerMax;
            }
            if (mSmokeTracker > mSmokeTrackerMax)
            {
                mSmokeTracker = mSmokeTrackerMax;
            }
        }
Beispiel #5
0
        public override void UpdateBrain(float DT)
        {
            mShipDirection.X   = (float)Math.Cos(mShip.mRotation);
            mShipDirection.Y   = (float)Math.Sin(mShip.mRotation);
            mTargetDirection.X = (float)Math.Cos(GetAngleToPlayer());
            mTargetDirection.Y = (float)Math.Sin(GetAngleToPlayer());
            mCrossValue        = Vector3.Cross(mShipDirection, mTargetDirection);

            if (mCrossValue.Z < 0)
            {
                mShip.ActivateAbility(AbilityType.TurnLeft);
            }
            else if (mCrossValue.Z > 0)
            {
                mShip.ActivateAbility(AbilityType.TurnRight);
            }

            if (mCrossValue.Z > -0.1f && mCrossValue.Z < 0.1f)
            {
                //Get distance between you an the dirty, evil player
                mDistance = (float)Math.Sqrt(Math.Pow((mShip.aaGameWorld.Player.mXPos - mShip.mXPos), 2) + Math.Pow((mShip.aaGameWorld.Player.mYPos - mShip.mYPos), 2));

                if (mDistance < 750)
                {
                    mShip.ActivateAbility(AbilityType.SlowShip);

                    mShip.ActivateAbility(AbilityType.FireMissile, mShip.mRotation);
                }
                else
                {
                    mShip.ActivateAbility(AbilityType.ThrustShip);
                }
            }

            base.UpdateBrain(DT);
        }
Beispiel #6
0
        public override void UpdateBrain(float DT)
        {
            mShipDirection.X   = (float)Math.Cos(mShip.mRotation);
            mShipDirection.Y   = (float)Math.Sin(mShip.mRotation);
            mTargetDirection.X = (float)Math.Cos(GetAngleToPlayer());
            mTargetDirection.Y = (float)Math.Sin(GetAngleToPlayer());
            mCrossValue        = Vector3.Cross(mShipDirection, mTargetDirection);

            if (mCrossValue.Z < -0.2f)
            {
                mShip.ActivateAbility(AbilityType.TurnLeft);
            }
            else if (mCrossValue.Z > 0.2f)
            {
                mShip.ActivateAbility(AbilityType.TurnRight);
            }

            mDistance = (float)Math.Sqrt(Math.Pow((mShip.aaGameWorld.Player.mXPos - mShip.mXPos), 2) + Math.Pow((mShip.aaGameWorld.Player.mYPos - mShip.mYPos), 2));

            if (mCrossValue.Z >= -0.2f && mCrossValue.Z <= 0.2f)
            {
                mShip.ActivateAbility(AbilityType.ThrustShip);
            }

            if (mDistance < 50)
            {
                mShip.ActivateAbility(AbilityType.SuicideBomb);
                if (mShip.mSlowBeepInstance.State == SoundState.Playing)
                {
                    mShip.mSlowBeepInstance.Stop();
                    mShip.mFastBeepInstance.Play();
                }
            }

            base.UpdateBrain(DT);
        }
Beispiel #7
0
        public override void UpdateBrain(float DT)
        {
            mDistance2Enemy = float.MaxValue;

            mAngleToPlayer += mRotationSpeed;

            mShip.mXPos = (float)Math.Cos(mAngleToPlayer) * mOrbitDistance + mShip.aaGameWorld.Player.mXPos;
            mShip.mYPos = (float)Math.Sin(mAngleToPlayer) * mOrbitDistance + mShip.aaGameWorld.Player.mYPos;

            if (mAngleToPlayer >= 2 * Math.PI)
            {
                mAngleToPlayer = 0;
            }

            foreach (Entity e in mShip.aaGameWorld.mEntityList)
            {
                mTempDistance = GetDistance(e);
                if (mTempDistance < mDistance2Enemy && (e as Ship).mTeam != mShip.mTeam)
                {
                    mDistance2Enemy = mTempDistance;
                    mEnemyTarget    = (e as Ship);
                }
            }

            mShootAngle = GetAngleToEnemy();
            if (mShootTracker == mShootTrackerMax)
            {
                mShip.ActivateAbility(AbilityType.FireBullet, mShootAngle);
                mShootTracker = 0;
            }

            mShootTracker++;
            if (mShootTracker > mShootTrackerMax)
            {
                mShootTracker = mShootTrackerMax;
            }
        }