Beispiel #1
0
 /// <summary>
 /// Creates instance of Unit and sets all objects that it is dependent on
 /// </summary>
 /// <param name="owner">Player that owns this unit</param>
 /// <param name="at">At which field is unit located</param>
 /// <param name="pf">Initialized PathFinder used for movement and printing position</param>
 /// <param name="tm">Initialized TurnManager used for removing unit from the game</param>
 /// <param name="rng">Seeded Random used for attacking</param>
 public Unit(Player owner, Field at, Pathfinder pf, TurnManager tm, Random rng)
 {
     this.tm        = tm;
     this.pf        = pf;
     attackPower    = 200;
     range          = 1;
     hitPoints      = 1000;
     maxHitPoints   = hitPoints;
     unitName       = "unknown";
     attackPriority = 100;
     movement       = 15;
     flying         = false;
     at.setOccupant(this);
     this.at    = at;
     this.owner = owner;
     owner.addUnit(this);
     this.rng = rng;
 }
Beispiel #2
0
 /// <summary>
 /// Moves unit from its current field to an new empty Field
 /// </summary>
 /// <param name="to">Empty field to which you want to move this Unit</param>
 public void move(Field to)
 {
     to.setOccupant(at.leaveField());
     at = to;
 }