Exemplo n.º 1
0
        /// <summary>
        /// Initializes a player with default values : a teacher and a student.
        /// </summary>
        /// <param name="player"></param>
        /// <param name="map"></param>
        private void initPlayer(Player player, Map map)
        {
            Case    position = map.FreePosition;
            Teacher teacher  = player.Civilization.UnitFactory.CreateTeacher(position, player);
            Student student  = player.Civilization.UnitFactory.CreateStudent(position, player);

            player.AddUnit(teacher);
            position.AddUnit(teacher);
            player.AddUnit(student);
            position.AddUnit(student);
        }
Exemplo n.º 2
0
        private void HandleProduction()
        {
            foreach (Unit unit in pendingProductions)
            {
                player.AddUnit(unit);
                position.AddUnit(unit);
            }

            pendingProductions.Clear();
        }
Exemplo n.º 3
0
 /// <summary>
 /// Moves the unit to the given destination
 /// </summary>
 /// <param name="destination"></param>
 public void MoveTo(Case destination)
 {
     _location.RemoveUnit(this);
     destination.AddUnit(this);
     RemainingMovementPoints = Math.Max(0, RemainingMovementPoints - _location.DistanceTo(destination));
     _location = destination;
 }