Exemple #1
0
        public override void PickUp(Ship pShipToPickup)
        {
            base.PickUp(pShipToPickup);

            pShipToPickup.aHull += (mHealthAmount * pShipToPickup.mKit.HULL);
            pShipToPickup.aHull = Math.Min(pShipToPickup.aHull, pShipToPickup.mKit.HULL);
        }
Exemple #2
0
 public void ResolveCollision(Ship mTarget = null, Projectile mProjTarget = null)
 {
     if (mTarget != null && mType == ProjectileType.LaserBall)
     {
         mTarget.TriggerBuff(BuffType.ShipSlow, mProjKit.SLOW_EFFECT);
         Destroy();
     }
     else if (mType == ProjectileType.Mine)
     {
         if (mTeam != Constants.PLAYER_TEAM && mProjTarget != null || mTarget != null && mTeam != mTarget.mTeam)
         {
             aaGameWorld.aaGFXHandler.PlayEffect("Explosion_01", mXPos, mYPos, mAssetKit.COLOR_BLENDING);
             SoundEffectInstance mExplosionInstance = aaGameWorld.aaDisplay.aaGame.mExplosion.CreateInstance();
             mExplosionInstance.Volume = 0.2f;
             mExplosionInstance.Play();
             aaGameWorld.aaDisplay.aaGame.mGameSoundFX.Add(mExplosionInstance);
             Destroy();
         }
     }
     else if (mType == ProjectileType.Missile)
     {
         aaGameWorld.aaGFXHandler.PlayEffect("Explosion_01", mXPos, mYPos, mAssetKit.COLOR_BLENDING);
         SoundEffectInstance mExplosionInstance = aaGameWorld.aaDisplay.aaGame.mExplosion.CreateInstance();
         mExplosionInstance.Volume = 0.2f;
         mExplosionInstance.Play();
         aaGameWorld.aaDisplay.aaGame.mGameSoundFX.Add(mExplosionInstance);
         Destroy();
     }
     else if (mType != ProjectileType.LaserBall)
     {
         Destroy();
     }
 }
        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; }
        }
 public Brain_Player(Ship pEntity, string pType)
     : base(pEntity)
 {
     mShip = pEntity;
     mShipType = pType;
     UpdateInput();
 }
Exemple #5
0
 public Brain_Grunt(Ship pEntity)
     : base(pEntity)
 {
     mShip = pEntity;
     mShootTracker = 0;
     mShipDirection = Vector3.Zero;
     mTargetDirection = Vector3.Zero;
 }
 public Brain_Satellite(Ship pEntity)
     : base(pEntity)
 {
     mShip = pEntity;
     mShootTracker = 0;
     mAngleToPlayer = 0.0f;
     mRotationSpeed = (float)(2 * Math.PI) / 80;
     mTargetList = new List<Ship>();
 }
 public CollisionShape(float pXPos, float pYPos, Projectile pProjOwner = null, Ship pShipOwner = null, uint pTeam = 0, bool pIsShield = false)
 {
     mXPos = pXPos;
     mYPos = pYPos;
     mProjOwner = pProjOwner;
     mShipOwner = pShipOwner;
     mTeam = pTeam;
     mIsShield = pIsShield;
 }
Exemple #8
0
 public Brain_Laser(Ship pEntity)
     : base(pEntity)
 {
     mShip = pEntity;
     mShootTracker = 0;
     mShipDirection = Vector3.Zero;
     mTargetDirection = Vector3.Zero;
     isCharging = false;
 }
 public Brain_Bomb_Boss(Ship pEntity)
     : base(pEntity)
 {
     mShip = pEntity;
     mShootTracker = 0;
     mSmokeTracker = 0;
     mShipDirection = Vector3.Zero;
     mTargetDirection = Vector3.Zero;
 }
Exemple #10
0
        public override void PickUp(Ship pShipToPickup)
        {
            base.PickUp(pShipToPickup);

            pShipToPickup.FireBullet = new Ability_ShootTier2(pShipToPickup);
            if (pShipToPickup.mMySatellite != null)
            {
                pShipToPickup.mMySatellite.FireBullet = new Ability_ShootTier2(pShipToPickup.mMySatellite);
            }
        }
Exemple #11
0
 public Projectile(GameWorld pGameWorld, uint pTeam, ProjectileType pType, float pXPos, float pYPos, float pRotation, ProjectileKit pProjKit, Ship pTarget = null, Ship pOwner = null)
 {
     mXPos = pXPos;
     mYPos = pYPos;
     mType = pType;
     aaGameWorld = pGameWorld;
     mTeam = pTeam;
     SetProjType();
     mRotation = pRotation;
     mProjKit = pProjKit;
     mTarget = pTarget;
     mOwner = pOwner;
     mDispObject = new DisplayObject(aaGameWorld.aaDisplay, mAssetKit.ASSET_NAME, mXPos, mYPos, (int)mAssetKit.ORIGIN.X, (int)mAssetKit.ORIGIN.Y, Constants.LAYER_PROJECTILE_DEPTH, mAssetKit.SRC_RECTX, mAssetKit.SRC_RECTY, mAssetKit.SRC_RECTWIDTH, mAssetKit.SRC_RECTHEIGHT, mRotation, false);
 }
Exemple #12
0
 public Brain_Bomb(Ship pEntity)
     : base(pEntity)
 {
     mShip = pEntity;
     mShipDirection = Vector3.Zero;
     mTargetDirection = Vector3.Zero;
     pEntity.mSlowBeepInstance = mShip.aaGameWorld.aaDisplay.aaGame.mBombBeepSlow.CreateInstance();
     pEntity.mSlowBeepInstance.Volume = 0.5f;
     pEntity.mSlowBeepInstance.IsLooped = true;
     pEntity.mFastBeepInstance = mShip.aaGameWorld.aaDisplay.aaGame.mBombBeepFast.CreateInstance();
     pEntity.mFastBeepInstance.Volume = 0.5f;
     pEntity.mFastBeepInstance.IsLooped = true;
     pEntity.mSlowBeepInstance.Play();
 }
Exemple #13
0
 public Behavior_SuicideBomb(Ship pTarget)
     : base(pTarget)
 {
     mElapsedTime = 0.0f;
 }
Exemple #14
0
        public override void ResolveCollision(int pDamage = 0, Ship pShip = null)
        {
            aHull -= pDamage;
            SoundEffectInstance mHitInstance = aaGameWorld.aaDisplay.aaGame.mHitSound.CreateInstance();
            mHitInstance.Volume = 0.2f;
            mHitInstance.Play();
            aaGameWorld.aaDisplay.aaGame.mGameSoundFX.Add(mHitInstance);
            mHitInstance = null;

            if (pShip != null)
            {
                if (this.mType != "Bomb_Ship")
                {
                    aHull -= (pShip.mKit.MASS / mKit.MASS) * Constants.COLLISION_DAMAGE;
                }
                mCollisionAngle = (float)Math.Atan2(pShip.mYPos - mYPos, pShip.mXPos - mXPos);
                ApplyForce((pShip.mKit.MASS / mKit.MASS) * Constants.COLLISION_FORCE, mCollisionAngle + (float)Math.PI);
                mHitInstance = aaGameWorld.aaDisplay.aaGame.mHitSound.CreateInstance();
                mHitInstance.Volume = 0.2f;
                mHitInstance.Play();
                aaGameWorld.aaDisplay.aaGame.mGameSoundFX.Add(mHitInstance);
            }

            base.ResolveCollision(pDamage, pShip);
        }
 public Projectile AddProjectile(uint pTeam, ProjectileType pType, Vector2 pPosition, float pRotation, ProjectileKitType pProjectileKitType, Ship pTarget = null, Ship pOwner = null)
 {
     ProjectileKit projectileKit = null;
     AssetKit assetKit = null;
     switch (pProjectileKitType)
     {
         case ProjectileKitType.EnemyBullet:
             projectileKit = pEnemyBulletProjectileKit;
             assetKit = pEnemyBulletAssetKit;
             break;
         case ProjectileKitType.Laser:
             projectileKit = pLaserProjectileKit;
             assetKit = pLaserAssetKit;
             break;
         case ProjectileKitType.Mine:
             if (pTeam == 0)
                 assetKit = pPlayerMineAssetKit;
             else
                 assetKit = pMineAssetKit;
             projectileKit = pMineProjectileKit;
             break;
         case ProjectileKitType.Missile:
             projectileKit = pMissileProjectileKit;
             assetKit = pMissileAssetKit;
             break;
         case ProjectileKitType.PlayerBullet:
             projectileKit = pPlayerBulletProjectileKit;
             assetKit = pPlayerBulletAssetKit;
             break;
         case ProjectileKitType.AntiBullet:
             projectileKit = pAntiBulletProjectileKit;
             assetKit = pAntiBulletAssetKit;
             break;
         default:
             projectileKit = pEnemyBulletProjectileKit;
             assetKit = pEnemyBulletAssetKit;
             break;
     }
     if (aaGameWorld.mRemovedProjectileList.Count != 0)
     {
         Projectile tempProj = aaGameWorld.mRemovedProjectileList.ElementAt(0);
         aaGameWorld.mRemovedProjectileList.RemoveAt(0);
         if (aaGameWorld.mProjectileList.Contains(tempProj))
         {
             Projectile newProj = new Projectile(aaGameWorld, pTeam, pType, pPosition.X, pPosition.Y, pRotation, projectileKit, pTarget, pOwner);
             aaGameWorld.mProjectileList.Add(newProj);
             return newProj;
         }
         else
         {
             tempProj.mXPos = pPosition.X;
             tempProj.mYPos = pPosition.Y;
             tempProj.mType = pType;
             tempProj.mTeam = pTeam;
             tempProj.SetProjType();
             tempProj.mRotation = pRotation;
             tempProj.mProjKit = projectileKit;
             tempProj.mTarget = pTarget;
             tempProj.mOwner = pOwner;
             tempProj.mDispObject.mAssetFile = assetKit.ASSET_NAME;
             tempProj.mDispObject.src_RectX = assetKit.SRC_RECTX;
             tempProj.mDispObject.src_RectY = assetKit.SRC_RECTY;
             tempProj.mDispObject.src_RectWidth = assetKit.SRC_RECTWIDTH;
             tempProj.mDispObject.src_RectHeight = assetKit.SRC_RECTHEIGHT;
             tempProj.mDispObject.SetZoom(1.0f);
             tempProj.mDispObject.Show();
             tempProj.mProjectileID = mNextProjectileID++;
             //tempProj.mDispObject = new DisplayObject(aaGameWorld.aaDisplay, assetKit.ASSET_NAME, pPosition.X, pPosition.Y, (int)assetKit.ORIGIN.X, (int)assetKit.ORIGIN.Y, Constants.LAYER_PROJECTILE_DEPTH, assetKit.SRC_RECTX, assetKit.SRC_RECTY, assetKit.SRC_RECTWIDTH, assetKit.SRC_RECTHEIGHT, pRotation, false);
             aaGameWorld.mProjectileList.Add(tempProj);
             return tempProj;
         }
     }
     else
     {
         Projectile newProj = new Projectile(aaGameWorld, pTeam, pType, pPosition.X, pPosition.Y, pRotation, projectileKit, pTarget, pOwner);
         newProj.mProjectileID = mNextProjectileID++;
         aaGameWorld.mProjectileList.Add(newProj);
         return newProj;
     }
 }
Exemple #16
0
 public Behavior_DualWield(Ship pTarget)
     : base(pTarget)
 {
     mElapsedTime = 0;
     mBulletOffsets = new Vector2[2];
 }
Exemple #17
0
        public override void Tracker(float pDT)
        {
            if (mTarget != null)
            {
                int offsetX = (int)(Math.Cos(mTarget.mRotation) * offset);
                int offsetY = (int)(Math.Sin(mTarget.mRotation) * offset);
                mLaserCharge.mXPos = aaTargetShip.mXPos;
                mLaserCharge.mYPos = aaTargetShip.mYPos;
                mLaserCharge.mRotation = mTarget.mRotation;
                mLaserCharge.mProjKit.SLOW_EFFECT = mSlow;

                if (mLaserCharge.mDispObject != null)
                    mLaserCharge.mDispObject.SetZoom(mSize);

                mSize += 0.01f;
                mSlow -= 0.005f;
            }

            if (mSize > 1.0f)
            {
                (mTarget.mBrain as Brain_Laser).isCharging = false;
                mTarget = null;
                Cease();
            }
        }
Exemple #18
0
        public void Initialize()
        {
            aaDisplay.aaCamera = new DisplayCamera(this);
                aaGFXHandler = new GraphicsEffectHandler(this);
                if ((aaDisplay.aaGame.mShipMenu as State_Menu_Ship).shipCount == 0)
                    Player = new Ship(this, "Player_Agility", Constants.PLAYER_TEAM, 640, 360, new ShipKit_Player_Agility(), false, 0, 0, 0);
                else if((aaDisplay.aaGame.mShipMenu as State_Menu_Ship).shipCount == 2)
                    Player = new Ship(this, "Player_Commando", Constants.PLAYER_TEAM, 640, 360, new ShipKit_Player_Commando(), false, 0, 0, 0);
                else if ((aaDisplay.aaGame.mShipMenu as State_Menu_Ship).shipCount == 1)
                    Player = new Ship(this, "Player_Tank", Constants.PLAYER_TEAM, 640, 360, new ShipKit_Player_Tank(), false, 0, 0, 0);

                mEntityList.Add(Player);
                mAiDirector = new Director(this);

                mBackground = new DisplayObject(aaDisplay, "Back_Black_01", 0, 0, 0, 0, 1.0f, 0, 0, Constants.REGION_PLAYABLE_WIDTH, Constants.REGION_PLAYABLE_HEIGHT, 0, false);

                State_Menu_Ship smShip = (aaDisplay.aaGame.mShipMenu as State_Menu_Ship);
                mAbility1Indicator = new UIElement_AbilityIndicator(aaDisplay, this, ((Ship)Player).Ability1, smShip.ability1, 0, 658, 0);
                mAbility2Indicator = new UIElement_AbilityIndicator(aaDisplay, this, ((Ship)Player).Ability2, smShip.ability2, 60, 658, 0);
                mAbility3Indicator = new UIElement_AbilityIndicator(aaDisplay, this, ((Ship)Player).Ability3, smShip.ability3, 120, 658, 0);
                mAbility4Indicator = new UIElement_AbilityIndicator(aaDisplay, this, ((Ship)Player).Ability4, smShip.ability4, 180, 658, 0);

                Crosshair = new UIElement_ShipCrosshair(aaDisplay, this, KitManager.CrosshairUIAssetKit.ASSET_NAME, (int)Player.mXPos, (int)Player.mYPos, (int)mKit_Crosshair.ORIGIN.X, (int)mKit_Crosshair.ORIGIN.Y, Constants.LAYER_ENTITY_DEPTH, mKit_Crosshair.SRC_RECTX, mKit_Crosshair.SRC_RECTY, mKit_Crosshair.SRC_RECTWIDTH, mKit_Crosshair.SRC_RECTHEIGHT, 0.0f);
                Aimer = new UIElement_ShipAimer(aaDisplay, this, Player, mKit_Aimer.ASSET_NAME, (int)Player.mXPos, (int)Player.mYPos, (int)mKit_Aimer.ORIGIN.X, (int)mKit_Aimer.ORIGIN.Y, Constants.LAYER_ENTITY_DEPTH, mKit_Aimer.SRC_RECTX, mKit_Aimer.SRC_RECTY, mKit_Aimer.SRC_RECTWIDTH, mKit_Aimer.SRC_RECTHEIGHT, 0.0f);
                HealthBarBorder = new UIElement_HealthBar_Border(aaDisplay, this, mKit_HealthBorder.ASSET_NAME, 992, 0, 0, 0, Constants.LAYER_UI_FRONT, mKit_HealthBorder.SRC_RECTX, mKit_HealthBorder.SRC_RECTY, mKit_HealthBorder.SRC_RECTWIDTH, mKit_HealthBorder.SRC_RECTHEIGHT, 0);
                HealthBar = new UIElement_HealthBar_Bar(aaDisplay, this, mKit_HealthBar.ASSET_NAME, 1030, 6, 0, 0, Constants.LAYER_UI_FRONT, Player, mKit_HealthBar.SRC_RECTX, mKit_HealthBar.SRC_RECTY, mKit_HealthBar.SRC_RECTWIDTH, mKit_HealthBar.SRC_RECTHEIGHT, 0);
                HealthWhite = new UIElement_HealthBar_BarWhite(aaDisplay, this, mKit_HealthWhite.ASSET_NAME, 1030, 6, 0, 0, Constants.LAYER_UI_BACK, Player, mKit_HealthWhite.SRC_RECTX, mKit_HealthWhite.SRC_RECTY, mKit_HealthWhite.SRC_RECTWIDTH, mKit_HealthWhite.SRC_RECTHEIGHT, 0);
                GameOverPlaque = new UIElement_StaticMenuElement(aaDisplay, this, mKit_GameOver.ASSET_NAME, 320, 184, (int)mKit_GameOver.ORIGIN.X, (int)mKit_GameOver.ORIGIN.Y, Constants.LAYER_UI_BACK, mKit_GameOver.SRC_RECTX, mKit_GameOver.SRC_RECTY, mKit_GameOver.SRC_RECTWIDTH, mKit_GameOver.SRC_RECTHEIGHT, 0.0f);

                score = new UIElement_PlayerScore(aaDisplay, this, aaDisplay.aaGame.mScoreFont, 0, 0, Color.White);
                waveIndicator = new UIElement_WaveDisplay(aaDisplay, this, aaDisplay.aaGame.mScoreFont, 0, 100, Color.White);

                aaDisplay.AddMenuUIElement(mAbility1Indicator);
                aaDisplay.AddMenuUIElement(mAbility2Indicator);
                aaDisplay.AddMenuUIElement(mAbility3Indicator);
                aaDisplay.AddMenuUIElement(mAbility4Indicator);
                aaDisplay.AddUIElement(Crosshair);
                aaDisplay.AddUIElement(Aimer);
                aaDisplay.AddUIElement(HealthBarBorder);
                aaDisplay.AddUIElement(HealthBar);
                aaDisplay.AddUIElement(HealthWhite);
                aaDisplay.AddUIElement(score);
                aaDisplay.AddUIElement(waveIndicator);

                mPoints = 0;
        }
Exemple #19
0
 public virtual void PickUp(Ship pShipToPickup)
 {
     SoundEffectInstance mPickUpInstance = mGameWorld.aaDisplay.aaGame.mPickUpSound.CreateInstance();
     mPickUpInstance.Volume = 0.8f;
     mPickUpInstance.Play();
     mGameWorld.aaDisplay.aaGame.mGameSoundFX.Add(mPickUpInstance);
 }
Exemple #20
0
 public Behavior_VelocityReversal(Ship pTarget)
     : base(pTarget)
 {
 }
Exemple #21
0
        public Behavior_BulletSpam(Ship pTarget)
            : base(pTarget)
        {
            mBulletSpamDuration = 3.0f;
            mElapsedTime = 0.0f;
            mRotationAmount = 0.0f;
            mFireRate = 0.08f;
            mFireElapsed = 0.0f;
            mNumberOfRotations = 0.5f;

            mBaseRotation = pTarget.mRotation;
        }
Exemple #22
0
 public Behavior_TurnLeft(Ship pTarget)
     : base(pTarget)
 {
 }
Exemple #23
0
 public Behavior_TurnRight(Ship pTarget)
     : base(pTarget)
 {
 }
Exemple #24
0
 public Behavior(Ship pTarget)
 {
     aaTargetShip = pTarget;
 }
Exemple #25
0
 public Behavior_PathLaser(Ship pTarget)
     : base(pTarget)
 {
 }
Exemple #26
0
 public UIElement_HealthBar_BarWhite(Display pDisplay, GameWorld pGameWorld, string pAssetFile, int pPosX, int pPosY, int pOriginX, int pOriginY, float pDepth, Ship pPlayer, int pSrc_RectX = 0, int pSrc_RectY = 0, int pWidth = -1, int pHeight = 01, float pRotation = 0)
     : base(pDisplay, pGameWorld, pAssetFile, pPosX, pPosY, pOriginX, pOriginY, pDepth, pSrc_RectX, pSrc_RectY, pWidth, pHeight, pRotation)
 {
     Show();
     mPlayer = pPlayer;
     mOrigRectWidth = pWidth;
 }
Exemple #27
0
 public Behavior_SlowShip(Ship pTarget)
     : base(pTarget)
 {
 }
Exemple #28
0
 public Behavior_RearGuns(Ship pTarget)
     : base(pTarget)
 {
     mRearGunsDuration = 6.0f;
     mElapsedTime = 0.0f;
     mFireRate = 0.1f;
     mFireElapsed = 0.0f;
 }
Exemple #29
0
 public UIElement_ShipAimer(Display pDisplay, GameWorld pGameWorld, Ship pTrackedShip, string pAssetFile, int pPosX, int pPosY, int pOriginX, int pOriginY, float pDepth, int pSrc_RectX = 0, int pSrc_RectY = 0, int pWidth = -1, int pHeight = 01, float pRotation = 0)
     : base(pDisplay, pGameWorld, pAssetFile, pPosX, pPosY, pOriginX, pOriginY, pDepth, pSrc_RectX, pSrc_RectY, pWidth, pHeight, pRotation)
 {
     mShip = pTrackedShip;
     Show();
 }
Exemple #30
0
 public Behavior_ThrustShip(Ship pTarget)
     : base(pTarget)
 {
 }