Example #1
0
 /// <summary>
 /// remove 1 health increment at specified time
 /// </summary>
 public void takeHealth(long time, Path path)
 {
     if (nTimeHealth < type.maxHealth) {
         nTimeHealth++;
         timeHealth[nTimeHealth - 1] = time;
         if (nTimeHealth >= type.maxHealth) {
             // unit lost all health, so remove it from path
             Segment segment = path.insertSegment(time);
             segment.units.Remove (this);
         }
     }
 }
Example #2
0
 /// <returns>this path's segment where the paths were connected</returns>
 public Segment connect(long time, Path path)
 {
     Segment segment = insertSegment (time);
     Segment segment2 = path.insertSegment (time);
     if (!segment.branches.Contains (segment2)) {
         segment.branches.AddRange (segment2.branches);
         segment2.branches = segment.branches;
     }
     return segment;
 }