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); }
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)); }
public void SetStatus(UNIT_STATUS status) { mStatus = status; }