コード例 #1
0
 /// <summary>
 /// Поглощение частицы
 /// </summary>
 /// <param name="gameUnit"></param>
 /// <param name="gameField"></param>
 public override bool Collision(GameUnit gameUnit, GameField gameField)
 {
     if (gameUnit.UnitStatus == Status.Passive)
     {
         return(false);
     }
     if (gameUnit == this)
     {
         return(false);
     }
     if (gameUnit.GetType() == this.GetType())
     {
         return(false);                                      // Столкновения между пызырями не учитываем
     }
     if ((gameUnit.X - X) * (gameUnit.X - X) + (gameUnit.Y - Y) * (gameUnit.Y - Y) <= Size * Size)
     {
         gameUnit.UnitStatus = Status.Passive;
         gameField.AddUnit(new Bubble(gameUnit.X, gameUnit.Y));
         return(true);
     }
     return(false);
 }
コード例 #2
0
    // --- AI ------------------------------


    // count effectiveness

    public int CountOfTowerUnits()
    {
        return(player.FriendlyUnitsOfType(iconUnit.GetType()).Count);
    }