Example #1
0
 public Waypoint(WaypointInfo waypointInfo)
     : this()
 {
     Position = new Position(waypointInfo.Position);
     if (!string.IsNullOrEmpty(waypointInfo.ReturningToUnitId))
     {
         BaseUnit returnToUnit = GameManager.Instance.Game.GetUnitById(waypointInfo.ReturningToUnitId);
         if (returnToUnit != null)
         {
             this.TargetBaseUnit = returnToUnit;
         }
     }
     else if (!string.IsNullOrEmpty(waypointInfo.TargetDetectedUnitId))
     {
         DetectedUnit det = GameManager.Instance.Game.GetDetectedUnitById(waypointInfo.TargetDetectedUnitId);
         if (det != null)
         {
             this.TargetDetectedUnit = det;
         }
     }
     foreach (var order in waypointInfo.UnitOrders)
     {
         BaseOrder baseOrder = GameManager.Instance.Game.GetBaseOrderFromUnitOrder(order);
         this.Orders.Add(baseOrder);
     }
 }
Example #2
0
        public void AddWaypoint(WaypointInfo waypointInfo)
        {
            Waypoint wp = new Waypoint(waypointInfo);

            foreach (var order in waypointInfo.UnitOrders)
            {
                BaseOrder baseOrder = GameManager.Instance.Game.GetBaseOrderFromUnitOrder(order);
                if (baseOrder != null)
                {
                    wp.Orders.Add(baseOrder);
                }
            }
            AddWaypoint(wp);
        }
Example #3
0
        public BaseOrder Clone()
        {
            BaseOrder newOrder = (BaseOrder)this.MemberwiseClone();

            return(newOrder);
        }