예제 #1
0
파일: Turret.cs 프로젝트: bmh10/RedMan
 public Turret(Level level, Vector2 position, bool createdByEvent, Enemy enemy, bool multiDirectionalFire)
 {
     this.enemy = enemy;
     this.level = level;
     //this.position = position;
     this.position = new Vector2(position.X + Tile.Width / 2, position.Y + Tile.Height);
     this.initialPosition = position;
     this.createdByEvent = createdByEvent;
     this.multiDirectionalFire = multiDirectionalFire;
     this.timeSinceShot = 50;
     level.Turrets.Add(this);
     LoadContent();
 }
예제 #2
0
파일: Player.cs 프로젝트: bmh10/RedMan
        /* Called when the player has been killed.
         * The enemy who killed the player. This parameter is null if the player was
         * not killed by an enemy (fell into a hole).
         */
        public void OnKilled(Enemy killedBy)
        {
            // If killed by an object
                // If in automatic run mode player has a health bar
                if (automaticRun)
                {
                    playerHealth -= playerMaxHealth * 0.25f;
                    if (playerHealth <= 1)
                    {
                        if (isAlive)
                            Game.PlaySound(killedSound);
                        isAlive = false;
                        level.DoorTimerOn = false;
                        sprite.PlayAnimation(dieAnimation);
                    }
                }
                else
                {
                    if (isAlive)
                         Game.PlaySound(killedSound);
                    isAlive = false;
                    level.DoorTimerOn = false;
                    sprite.PlayAnimation(dieAnimation);

                    if (level.LevelIndex == 12)
                        Enemy.level12bossCount = 0;

                    // If killed by explosive mine also explode the mine
                    if (killedBy != null && killedBy.monsterType == "MonsterD")
                        killedBy.OnKilled(null);

                }
        }
예제 #3
0
파일: Bullet.cs 프로젝트: bmh10/RedMan
        // For creating single enemy bullets (which are not continous like turrets)
        public Bullet(Level level, Vector2 position, GameTime gameTime, Enemy enemy)
        {
            float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;
            float MoveVelocity = MoveAcceleration * elapsed * AirDragFactor;
            this.level = level;
            this.position = position;
            this.enemy = enemy;
            this.initialPosition = position;
            this.removeBullet = false;
            this.airTime = 0.0f;
            this.explodeTimer = 0.0f;

            this.playerBullet = false;

            // Set range and velocity
            range = enemyShotRange;
            MoveVelocity *= enemyShotVelocity;

            if (enemy.direction == FaceDirection.Right)
                initialVelocityX = MoveVelocity;
            else
                initialVelocityX = -MoveVelocity;

            LoadContent();
        }
예제 #4
0
파일: Level.cs 프로젝트: bmh10/RedMan
 // Called when the player is killed.
 private void OnPlayerKilled(Enemy killedBy)
 {
     Player.OnKilled(killedBy);
 }