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 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; }
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; } }
public Behavior_ChargeLaser(Ship pTarget) : base(pTarget) { mTarget = pTarget; mLaserCharge = new Projectile(aaTargetShip.aaGameWorld, aaTargetShip.mTeam, ProjectileType.LaserBall, aaTargetShip.mXPos, aaTargetShip.mYPos, pTarget.mRotation, KitManager.LaserProjectileKit, null, mTarget); aaTargetShip.aaGameWorld.mProjectileList.Add(mLaserCharge); }
public CircleCollision(float pXPos, float pYPos, float pRadius, Projectile pProjOwner = null, Ship pShipOwner = null, uint pTeam = 0, bool pIsShield = false) : base(pXPos, pYPos, pProjOwner, pShipOwner, pTeam, pIsShield) { mRadius = pRadius; }
public PointCollision(float pXPos, float pYPos, Projectile pProjOwner = null, Ship pShipOwner = null) : base(pXPos, pYPos, pProjOwner, pShipOwner) { }
public LineCollision(float pXEndPos, float pYEndPos, float pXPos, float pYPos, Projectile pProjOwner = null, Ship pShipOwner = null) : base(pXPos, pYPos, pProjOwner, pShipOwner) { mXEndPos = pXEndPos; mYEndPos = pYEndPos; }