Ejemplo n.º 1
0
        public bool AttackTile(int x, int y, bool halfPopulation, Faction faction)
        {
            int attackingPopulation = GetAttackingForce(halfPopulation, faction);

            if (map.CanOccupyTile(faction, attackingPopulation, x, y))
            {
                map.OccupyTile(faction, attackingPopulation, x, y);
                _freepopulation[faction] = _freepopulation[faction] - attackingPopulation;
                return(true);
            }
            else if (map.CanAttackTile(x, y, faction))
            {
                map.AttackTile(x, y, attackingPopulation);
                _freepopulation[faction] = _freepopulation[faction] - attackingPopulation;
                return(true);
            }
            else if (map.tileMap[x][y].Faction.Equals(faction))
            {
                map.AddPopulation(x, y, attackingPopulation);
                _freepopulation[faction] = _freepopulation[faction] - attackingPopulation;
                return(true);
            }
            return(false);
        }