コード例 #1
0
ファイル: EnemyManager.cs プロジェクト: GarethIW/Platformer
        public void Spawn(int x, int y)
        {
            // X and Y is tile position, so work out a pixel position to spawn at
            // Remember that our sprite origin is located bottom centre (at the feet), so add half width and full height
            Vector2 spawnPos = new Vector2((x * Map.TILE_WIDTH) + (Enemy.FRAME_WIDTH / 2), (y * Map.TILE_HEIGHT) + Enemy.FRAME_HEIGHT);

            // Make a new enemy, using the soldier spritesheet
            Enemy newEnemy = new Enemy(spawnPos);

            // Add the enemy to the pool
            Enemies.Add(newEnemy);
        }
コード例 #2
0
ファイル: Player.cs プロジェクト: JulienEllie/paxdevdemo
        /// <summary>
        /// Called when the player has been killed.
        /// </summary>
        /// <param name="killedBy">
        /// The enemy who killed the player. This parameter is null if the player was
        /// not killed by an enemy (fell into a hole).
        /// </param>
        public void OnKilled(int playerIndex, Enemy killedBy)
        {
            playerStates[playerIndex] = PlayerState.Dead;
            if (playerIndex == 0)
            {
                if (killedBy != null)
                    killedSound.Play();
                else
                    fallSound.Play();
            }

            playAnimationForSprite(playerIndex, dieAnimation);
        }
コード例 #3
0
ファイル: Level.cs プロジェクト: liwq-net/SilverSprite
 /// <summary>
 /// Called when the player is killed.
 /// </summary>
 /// <param name="killedBy">
 /// The enemy who killed the player. This is null if the player was not killed by an
 /// enemy, such as when a player falls into a hole.
 /// </param>
 private void OnPlayerKilled(Enemy killedBy)
 {
     Player.OnKilled(killedBy);
 }
コード例 #4
0
ファイル: Player.cs プロジェクト: Irisviel/PGame
        /// <summary>
        /// Called when the player has been killed.
        /// </summary>
        /// <param name="killedBy">
        /// The enemy who killed the player. This parameter is null if the player was
        /// not killed by an enemy (fell into a hole).
        /// </param>
        public void OnKilled(Enemy killedBy)
        {
            isAlive = false;

            if (killedBy != null)
                killedSound.Play();
            else
                fallSound.Play();

            sprite.PlayAnimation(dieAnimation);
        }
コード例 #5
0
 /// <summary>
 /// Called when the player has been killed.
 /// </summary>
 /// <param name="killedBy">
 /// The enemy who killed the player. This parameter is null if the player was
 /// not killed by an enemy (fell into a hole).
 /// </param>
 public void OnKilled(Enemy killedBy)
 {
     isAlive = false;
     //sprite.PlayAnimation(dieAnimation);
 }
コード例 #6
0
ファイル: Level.cs プロジェクト: AGeyster/GlobalGameJam2013
 private void OnPlayerKilled(Enemy killedBy)
 {
     //Player.OnKilled(killedBy);
     Player.Stress.enemyDetect();
 }
コード例 #7
0
ファイル: Player.cs プロジェクト: AGeyster/GlobalGameJam2013
        /// <summary>
        /// Called when the player has been killed.
        /// </summary>
        /// <param name="killedBy">
        /// The enemy who killed the player. This parameter is null if the player was
        /// not killed by an enemy (fell into a hole).
        /// </param>
        public void OnKilled(Enemy killedBy)
        {
            isAlive = false;

            sprite.PlayAnimation(dieAnimation);
        }