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); } }
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); }
public BaseOrder Clone() { BaseOrder newOrder = (BaseOrder)this.MemberwiseClone(); return(newOrder); }