public override void OnReleased() { ChirpLog.Info("OnReleased"); ChirpLog.Flush(); _initialized = false; _terminated = false; base.OnReleased(); }
public override void OnCreated(IThreading threading) { ChirpLog.Info("OnCreated"); ChirpLog.Flush(); _initialized = false; _terminated = false; base.OnCreated(threading); }
private void ProcessHumansUpdated() { //Nothing to do if we have no target //if (m_tb == null) return; uint[] entries = SkylinesOverwatch.Data.Instance.HumansUpdated; if (entries.Length == 0) { return; } CitizenManager instance = Singleton <CitizenManager> .instance; foreach (uint i in entries) { Citizen resident = instance.m_citizens.m_buffer[(int)i]; if (resident.Dead) { continue; } if ((resident.m_flags & Citizen.Flags.Created) == Citizen.Flags.None) { continue; } CitizenInfo info = resident.GetCitizenInfo(i); if (info == null) { continue; } if (!(info.m_citizenAI is ResidentAI)) { continue; } if (info.m_gender == Citizen.Gender.Female) { info.m_gender = Citizen.Gender.Male; ChirpLog.Info("Updated resident: " + resident.ToString() + " " + i); ChirpLog.Flush(); } // Do something with resident CitizenAI ai = (CitizenAI)info.GetAI(); // TODO: How to get the CitizenInstance ? //ai.SetTarget(resident.m_instance, 0, m_tb); } }
public override void OnUpdate(float realTimeDelta, float simulationTimeDelta) { if (_terminated) { return; } try { if (!_initialized) { if (!IsOverwatched()) { ChirpLogger.ChirpLog.Error("Skylines Overwatch not found. Terminating..."); ChirpLog.Flush(); _terminated = true; return; } SkylinesOverwatch.Settings.Instance.Enable.BuildingMonitor = true; SkylinesOverwatch.Settings.Instance.Enable.HumanMonitor = true; SkylinesOverwatch.Settings.Instance.Enable.Residents = true; // TODO: Is this needed ? SkylinesOverwatch.Settings.Instance.Debug.HumanMonitor = true; _initialized = true; } else { ProcessHumansUpdated(); } } catch (Exception e) { string error = "Failed to initialize\r\n"; error += String.Format("Error: {0}\r\n", e.Message); error += "\r\n"; error += "==== STACK TRACE ====\r\n"; error += e.StackTrace; ChirpLog.Error(error); ChirpLog.Flush(); _terminated = true; } base.OnUpdate(realTimeDelta, simulationTimeDelta); }
public static void SetFieldValue(MonoBehaviour monoObject, string fieldName, object value) { try { BindingFlags bindingFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static; FieldInfo fieldInfo = monoObject.GetType().GetField(fieldName, bindingFlags); fieldInfo.SetValue(monoObject, value); } catch (Exception e) { ChirpLog.Error("Unable to set value:" + monoObject.GetType().Name + ":" + fieldName + ":" + e.Message); ChirpLog.Flush(); } }
private void ProcessBuildingsUpdated() { if (m_tb != null) { return; } ushort[] entries = SkylinesOverwatch.Data.Instance.BuildingsUpdated; if (entries.Length == 0) { return; } BuildingManager instance = Singleton <BuildingManager> .instance; foreach (ushort i in entries) { Building building = instance.m_buildings.m_buffer[(short)i]; m_tb = i; ChirpLog.Info("Target building is: " + m_tb); ChirpLog.Flush(); return; } }
public static object CallMethod(MonoBehaviour monoObject, string methodName, object[] value = null) { object returnValue = null; try { MethodInfo[] methods = monoObject.GetType().GetMethods(); foreach (MethodInfo info in methods) { if (info.Name == methodName) { returnValue = info.Invoke(monoObject, value); // [2] } } return(returnValue); } catch (Exception e) { ChirpLog.Error("Unable to Call Method: " + monoObject.GetType().Name + ":" + methodName + ":" + e.Message); ChirpLog.Flush(); return(returnValue); } }
public void OnReleased() { ChirpLog.Info("Chirp Logger Example Offline"); ChirpLog.Flush(); }
public void OnLevelLoaded(LoadMode mode) { ChirpLog.Flush(); }