Exemple #1
0
        public static void placeEnemyBullet(GameObject obj, int damage, List<DamageBullet> bullets, int type, BoundingFrustum cameraFrustum, float offsetFactor)
        {
            HydroBot tmp1;
            SwimmingObject tmp2;
            Matrix orientationMatrix;
            if (obj.GetType().Name.Equals("HydroBot")) {
                tmp1 = (HydroBot)obj;
                orientationMatrix = Matrix.CreateRotationY(tmp1.ForwardDirection);
            }
            else {
                tmp2 = (SwimmingObject)obj;
                orientationMatrix = Matrix.CreateRotationY(tmp2.ForwardDirection);
            }

            DamageBullet newBullet = new DamageBullet();

            Vector3 movement = Vector3.Zero;
            movement.Z = 1;
            Vector3 shootingDirection = Vector3.Transform(movement, orientationMatrix);
            newBullet.initialize(obj.Position + shootingDirection * offsetFactor, shootingDirection, GameConstants.BulletSpeed, damage, (BaseEnemy)obj);
            if (type == 1)
            {
                newBullet.loadContent(PoseidonGame.contentManager, "Models/BulletModels/bossBullet");
                if (obj.BoundingSphere.Intersects(cameraFrustum))
                    PoseidonGame.audio.bossShot.Play();
            }
            else if (type == 0)
            {
                newBullet.loadContent(PoseidonGame.contentManager, "Models/BulletModels/normalbullet");
                if (obj.BoundingSphere.Intersects(cameraFrustum))
                    PoseidonGame.audio.enemyShot.Play();
            }
            bullets.Add(newBullet);
        }
Exemple #2
0
        public static void placeChasingBullet(GameObject shooter, GameObject target, List<DamageBullet> bullets, BoundingFrustum cameraFrustum)
        {
            if (!target.GetType().Name.Equals("HydroBot")) {
                return;
            }

            Matrix orientationMatrix = Matrix.CreateRotationY(((Terminator)shooter).ForwardDirection);
            Vector3 movement = Vector3.Zero;
            movement.Z = 1;
            Vector3 shootingDirection = Vector3.Transform(movement, orientationMatrix);

            ChasingBullet newBullet = new ChasingBullet();
            newBullet.initialize(shooter.Position, shootingDirection, GameConstants.BulletSpeed, (int)(GameConstants.ChasingBulletDamage * ((float)HydroBot.gamePlusLevel/2 + 1)), target, (Terminator)shooter);
            newBullet.loadContent(PoseidonGame.contentManager, "Models/BulletModels/chasingBullet");
            bullets.Add(newBullet);
            if (shooter.BoundingSphere.Intersects(cameraFrustum)) {
                PoseidonGame.audio.chasingBulletSound.Play();
            }
        }