コード例 #1
0
        /// <summary>
        /// Sets the Width, Height, and Speed of the enemyModel given based on which type it is
        /// </summary>
        /// <param name="enemyModel">EnemyModel to set</param>
        public void SetWidthHeightSpeed(EnemyModel enemyModel)
        {
            switch (enemyModel.enemyType)
            {
            case EnemyType.fish:
                enemyModel.FRAME_WIDTH  = 32;
                enemyModel.FRAME_HEIGHT = 32;
                enemyModel.ENEMY_SPEED += random.Next(-1, 1) / 2f;
                break;

            case EnemyType.fish_big:
                enemyModel.FRAME_WIDTH  = 54;
                enemyModel.FRAME_HEIGHT = 49;
                enemyModel.ENEMY_SPEED -= 1 + random.Next(-1, 1) / 2f;
                break;

            case EnemyType.fish_dart:
                enemyModel.FRAME_WIDTH  = 39;
                enemyModel.FRAME_HEIGHT = 20;
                enemyModel.ENEMY_SPEED += 1 + random.Next(-1, 1) / 2f;
                break;

            default:
                enemyModel.enemyType    = EnemyType.fish;
                enemyModel.FRAME_WIDTH  = 32;
                enemyModel.FRAME_HEIGHT = 32;
                enemyModel.ENEMY_SPEED += random.Next(-1, 1) / 2f;
                break;
            }
        }
コード例 #2
0
 /// <summary>
 /// Adds an Enemy to the list of Enemies
 /// in ascending order
 /// </summary>
 /// <param name="enemy">EnemyModel to add</param>
 public void AddEnemy(EnemyModel enemy)
 {
     enemies.Add(enemy);
     game.TimSort(enemies, 32);
 }