Esempio n. 1
0
 public static bool Report(UNIT_STATUS status, Vehicle vehicle, long emergencyId, bool newSpawn = false)
 {
     if (EmergencyDispatch.instance.emergencies.ContainsKey(emergencyId))
     {
         EmergencyDispatch.instance.emergencies[emergencyId].register(status, vehicle, newSpawn);
         return(true);
     }
     return(false);
 }
Esempio n. 2
0
        public void register(UNIT_STATUS status, Vehicle vehicle, bool newSpawn)
        {
            if (!emergencyResolved)
            {
                if (newSpawn)
                {
                    numberAwaitingSpawn--;
                }
                if (status == UNIT_STATUS.AWAITING_SPAWN)
                {
                    numberAwaitingSpawn++;
                }
                else if (status == UNIT_STATUS.SITUATION_RESOLVED)
                {
                    emergencyResolved = true;
                    vehicleStatus.Clear();
                }
                else if (status == UNIT_STATUS.ARRIVED_AT_SCENE && offMap)
                {
                    vehicleStatus.Remove(vehicle);
                    if (vehicleStatus.Count == 0 && numberAwaitingSpawn == 0)
                    {
                        emergencyResolved = true;
                    }
                }
                else
                {
                    if (!vehicleStatus.ContainsKey(vehicle))
                    {
                        vehicleStatus.Add(vehicle, status);
                    }
                    else
                    {
                        vehicleStatus[vehicle] = status;
                    }

                    if (status == UNIT_STATUS.ARRIVED_AT_SCENE)
                    {
                        numberOfArrivedUnits++;
                        if (countdown == null)
                        {
                            countdown = EmergencyDispatch.instance.StartCoroutine(EmergencyDispatch.instance.countdownEmergency(this));
                        }
                    }
                }
            }
//            string[] vehicleStatusString = vehicleStatus.Select(kvp => kvp.Key.name + ": " + kvp.Value.ToString()).ToArray<string>();
//            Debug.Log(string.Join(Environment.NewLine, vehicleStatusString));
        }
Esempio n. 3
0
 public void SetStatus(UNIT_STATUS status)
 {
     mStatus = status;
 }