static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { XKLog.EnableLogType("Editor", false); // detect scripts changes foreach (string str in importedAssets) { XKLog.Log("Editor", "Reimported Asset: " + str); if (str.EndsWith(".cs") || str.EndsWith(".dll")) { // stop updating player as scripts are f****d up if (EditorApplication.isPlaying) { Debug.LogWarning("Further error have no incidence with the game, they are due to script recompilation"); EditorApplication.isPlaying = false; } break; } } /* might be useful for further treatments * foreach (string str in deletedAssets) * XKLog.Log("Editor", "Deleted Asset: " + str); * foreach (string str in movedAssets) * XKLog.Log("Editor", "Moved Asset: " + str); * foreach (string str in movedFromAssetPaths) * XKLog.Log("Editor", "Moved Asset From: " + str); */ }
void LogScores() { for (int i = 0; i < c_AICount; ++i) { XKLog.Log("Info", string.Format("AI_{0:00}: {1:00} - {2}", i, m_IdToScore[i], m_IdToName[i])); } }
/// <summary> /// /// </summary> /// <param name="teamId"></param> void OnAIDied(int teamId) { AIBase ai = m_AIs[teamId]; // move ai from alive buffer to leaderboard m_AliveAIs.Remove(ai); m_Leaderboard.Insert(0, ai); // deactivate ai ai.XKActive = false; XKLog.Log("Info", string.Format("An AI has died: {0} ({1}) ", ai.GetType().ToString(), ai.TeamId)); if (m_AliveAIs.Count == 1) { // store the winner m_Leaderboard.Insert(0, m_AliveAIs[0]); // deactivate gameboard, no need to keep it active XKActive = false; XKLog.Log("Info", string.Format("The last AI has died, the winner is: {0} ({1}) ", m_AliveAIs[0].GetType().ToString(), m_AliveAIs[0].TeamId)); // announce the game is over to whom ants to listen if (OnGameOver != null) { OnGameOver(m_Leaderboard); } } }
/// <summary> /// /// </summary> /// <param name="from"></param> /// <param name="to"></param> /// <param name="amount"></param> protected void LaunchBoldies(IHome from, IHome to, EAmount amount) { // error control if (from == null) { XKLog.LogRed("Error", "AIBase.LaunchBodies() failed - (IHome)from is null"); return; } from.LaunchBoldies(to, amount, this); }
void CreateMap() { if (m_Camera.orthographic) { Vector3 bounds = Vector3.zero; bounds.y = m_Camera.orthographicSize; bounds.x = bounds.y * Screen.width / Screen.height; bounds.x *= 0.85f; // keep 15 % off bounds.y *= 0.8f; // keep 20 % off CreateHomes(bounds); } else { XKLog.Log("Error", "Gameboard.CreateMap() failed - camera is not orthographic"); } }
bool IHome.LaunchBoldies(IHome to, EAmount amount, AIBase ai) { // error control if (TeamId < 0) { XKLog.Log("Error", "Home.LaunchBodies() failed - home does not belong to any team"); return(false); } // error control if (TeamId != ai.TeamId) { XKLog.LogRed("Error", "Home.LaunchBodies() failed - Wrong AI asked a move from unowned Home, are you such a cheater? - " + ai.GetType().ToString()); return(false); } // error control if (to == null) { XKLog.LogRed("Error", "Home.LaunchBodies() failed - (IHome)to is null"); return(false); } // avoid StackOverFlow exception if (!CanLaunchBoldies((Home)to)) { return(false); } // compute boldiCount to launch int boldiCount = m_BoldiCount; switch (amount) { case EAmount.Quarter: boldiCount = (int)(m_BoldiCount * 0.25f); break; case EAmount.Half: boldiCount = (int)(m_BoldiCount * 0.5f); break; case EAmount.ThreeQuarter: boldiCount = (int)(m_BoldiCount * 0.75f); break; } // launch them if (!m_ToLaunch.ContainsKey((Home)to)) { m_ToLaunch.Add((Home)to, boldiCount); } else { m_ToLaunch[(Home)to] += boldiCount; } // notify who wants to listen m_Gameboard.OnBoldiLaunch(this, to); return(true); }
void LogSeed() { XKLog.LogWithContext("Info", "YnovWars.Seed: " + Lehmer.Seed, this); }
void CreateAI(int aiId) { AIBase ai = null; switch (aiId) { case 0: ai = m_Gameboard.CreateAI <YW.NicoJ.AITester>(); break; case 1: ai = m_Gameboard.CreateAI <YW.NicoJ.AITester>(); break; case 2: ai = m_Gameboard.CreateAI <YW.NicoJ.AITester>(); break; case 3: ai = m_Gameboard.CreateAI <YW.NicoJ.AITester>(); break; case 4: ai = m_Gameboard.CreateAI <YW.NicoJ.AITester>(); break; case 5: ai = m_Gameboard.CreateAI <YW.NicoJ.AITester>(); break; case 6: ai = m_Gameboard.CreateAI <YW.NicoJ.AITester>(); break; case 7: ai = m_Gameboard.CreateAI <YW.NicoJ.AITester>(); break; case 8: ai = m_Gameboard.CreateAI <YW.NicoJ.AITester>(); break; case 9: ai = m_Gameboard.CreateAI <YW.NicoJ.AITester>(); break; case 10: ai = m_Gameboard.CreateAI <YW.NicoJ.AITester>(); break; case 11: ai = m_Gameboard.CreateAI <YW.NicoJ.AITester>(); break; case 12: ai = m_Gameboard.CreateAI <YW.NicoJ.AITester>(); break; case 13: ai = m_Gameboard.CreateAI <YW.NicoJ.AITester>(); break; case 14: ai = m_Gameboard.CreateAI <YW.NicoJ.AITester>(); break; case 15: ai = m_Gameboard.CreateAI <YW.NicoJ.AITester>(); break; case 16: ai = m_Gameboard.CreateAI <YW.NicoJ.AITester>(); break; case 17: ai = m_Gameboard.CreateAI <YW.NicoJ.AITester>(); break; case 18: ai = m_Gameboard.CreateAI <YW.NicoJ.AITester>(); break; case 19: ai = m_Gameboard.CreateAI <YW.NicoJ.AITester>(); break; case 20: ai = m_Gameboard.CreateAI <YW.NicoJ.AITester>(); break; case 21: ai = m_Gameboard.CreateAI <YW.NicoJ.AITester>(); break; case 22: ai = m_Gameboard.CreateAI <YW.NicoJ.AITester>(); break; case 23: ai = m_Gameboard.CreateAI <YW.NicoJ.AITester>(); break; case 24: ai = m_Gameboard.CreateAI <YW.NicoJ.AITester>(); break; case 25: ai = m_Gameboard.CreateAI <YW.NicoJ.AITester>(); break; case 26: ai = m_Gameboard.CreateAI <YW.NicoJ.AITester>(); break; case 27: ai = m_Gameboard.CreateAI <YW.NicoJ.AITester>(); break; default: XKLog.Log("Error", "MatchMaker.CreateAi(" + aiId + ") failed - aiId unknown"); break; } // nothing to do? if (ai != null) { if (!m_IdToName.ContainsKey(aiId)) { m_IdToName.Add(aiId, ai.GetType().ToString()); } } }
void EnableLogs() { XKLog.EnableLogType("Error", true); XKLog.EnableLogType("Info", true); }