示例#1
0
 private void Reached(SpaUnit obj)
 {
     //var division = divisions.FirstOrDefault(x => x.Units.Any(y => y.Id.Equals(obj.Id)));
     if (DateTime.Now.Ticks % 3 == 0)
     {
         for (int i = 0; i < divisions.Count; i++)
         {
             var division = divisions[i];
             division.TargetX = targets[i].X;
             division.TargetY = targets[i].Y;
         }
     }
     else
     {
         for (int i = targets.Count - 1; i >= 0; i--)
         {
             for (int j = 0; j < divisions.Count; j++)
             {
                 var division = divisions[j];
                 division.TargetX = targets[i].X;
                 division.TargetY = targets[i].Y;
             }
         }
     }
     Move();
 }
示例#2
0
        private void Lost(SpaUnit obj)
        {
            var infantery = _soldiers.Find(x => x.Id.Equals(obj.Id));
            if (infantery != null)
                _soldiers.Remove(infantery);
            if (targets.Any(x => x.Id != null && x.Id.Equals(obj.Id)))
                targets.Remove(targets.First(x => x.Id != null && x.Id.Equals(obj.Id)));

            ApplyTarget(GetRandomDivision());
        }