Example #1
0
        public static UnitOrder CreateSetSpeedOrder(string unitId, GameConstants.UnitSpeedType unitSpeedType)
        {
            UnitOrder order = new UnitOrder(GameConstants.UnitOrderType.SetSpeed, unitId);

            order.UnitSpeedType = unitSpeedType;
            return(order);
        }
Example #2
0
 /// <summary>
 /// Returns the speed type for this unit class given an actual speed in kph.
 /// </summary>
 /// <param name="speedKph"></param>
 /// <returns></returns>
 public GameConstants.UnitSpeedType GetSpeedTypeFromKph(double speedKph)
 {
     GameConstants.UnitSpeedType SpeedType = GameConstants.UnitSpeedType.Stop;
     if (speedKph > 0)
     {
         SpeedType = GameConstants.UnitSpeedType.Crawl;
     }
     if (speedKph > GameConstants.DEFAULT_CRAWL_SPEED && speedKph <= GameConstants.DEFAULT_SLOW_SPEED)
     {
         SpeedType = GameConstants.UnitSpeedType.Slow;
     }
     else if (speedKph > GameConstants.DEFAULT_CRAWL_SPEED)
     {
         SpeedType = GameConstants.UnitSpeedType.Cruise;
         if (speedKph < this.CruiseSpeedKph * 0.9)
         {
             SpeedType = GameConstants.UnitSpeedType.Half;
         }
     }
     if (speedKph > this.CruiseSpeedKph)
     {
         SpeedType = GameConstants.UnitSpeedType.Military;
     }
     if (this.MaxSpeedKph > this.MilitaryMaxSpeedKph && speedKph > this.MilitaryMaxSpeedKph) // has afterburners
     {
         SpeedType = GameConstants.UnitSpeedType.Afterburner;
     }
     return(SpeedType);
 }
Example #3
0
        public static UnitOrder CreateSetSpeedOrder(string unitId, GameConstants.UnitSpeedType unitSpeedType, bool isGroupOrder)
        {
            UnitOrder order = new UnitOrder(GameConstants.UnitOrderType.SetSpeed, unitId);

            order.UnitSpeedType = unitSpeedType;
            order.IsParameter   = isGroupOrder;
            return(order);
        }
Example #4
0
    public void ChangeSpeed(PlayerUnit mainUnit, GameConstants.UnitSpeedType speedType)
    {
        if (mainUnit != null)
        {
            //UnitOrder order = new UnitOrder(GameConstants.UnitOrderType.SetElevation, mainUnit.Info.Id);
            //order.UnitSpeedType = speedType;

            GameManager.Instance.MessageManager.AddMessage(string.Format(
                                                               "Unit: {0} changing speed from: {1} to : {2}",
                                                               mainUnit.Info.UnitName, mainUnit.Info.ActualSpeed.ToString(), speedType.ToString()), GameManager.MessageTypes.Detection, mainUnit.Info.Position);

            GameManager.Instance.NetworkManager.Send(OrderFactory.CreateSetSpeedOrder(mainUnit.Info.Id, speedType));
        }
    }
Example #5
0
        public static UnitMovementOrder CreateUnitMovementOrder(string unitId,
                                                                WaypointInfo wayPoint, GameConstants.UnitSpeedType unitSpeedType,
                                                                bool clearExisting)
        {
            UnitMovementOrder order = new UnitMovementOrder();

            order.Id = unitId;
            order.RemoveAllExistingWaypoints = clearExisting;
            order.Waypoints.Add(wayPoint);
            order.UnitSpeedType = unitSpeedType;
            return(order);
        }
Example #6
0
 /// <summary>
 /// Creates and returns new UnitMovementOrder
 /// </summary>
 /// <param name="unitId"></param>
 /// <param name="wayPoints"></param>
 /// <param name="unitSpeedType"></param>
 /// <param name="clearExisting"></param>
 /// <returns></returns>
 public static UnitMovementOrder CreateUnitMovementOrder(string unitId,
                                                         List <WaypointInfo> wayPoints, GameConstants.UnitSpeedType unitSpeedType,
                                                         bool clearExisting)
 {
     return(CreateUnitMovementOrder(unitId, wayPoints, unitSpeedType, clearExisting, false));
 }
Example #7
0
        /// <summary>
        /// Creates and returns new UnitMovementOrder
        /// </summary>
        /// <param name="unitId"></param>
        /// <param name="wayPoints"></param>
        /// <param name="unitSpeedType"></param>
        /// <param name="clearExisting"></param>
        /// <param name="isRecurring"></param>
        /// <returns></returns>
        public static UnitMovementOrder CreateUnitMovementOrder(string unitId,
                                                                List <WaypointInfo> wayPoints, GameConstants.UnitSpeedType unitSpeedType,
                                                                bool clearExisting, bool isRecurring)
        {
            UnitMovementOrder order = new UnitMovementOrder();

            order.Id = unitId;
            order.RemoveAllExistingWaypoints = clearExisting;
            foreach (var wp in wayPoints)
            {
                order.Waypoints.Add(wp);
            }
            order.IsParameter   = isRecurring;
            order.UnitSpeedType = unitSpeedType;
            return(order);
        }