private void OnActivate() { HashSet <int> securityProtocols; HashSet <Vector2Int> answerExample; SusadminData.Generate(out securityProtocols, out vulnerability, out safetyLevel, out compatibilityIndices, out virusesPower, out answerExample); this.securityProtocols = securityProtocols.ToArray().Shuffle().ToList(); string installedSecurityProtocolNames = this.securityProtocols.Select(id => SusadminData.GetSecurityProtocolName(id)).Join(", "); Debug.LogFormat("[SUSadmin #{0}] Installed security protocols: {1}", moduleId, installedSecurityProtocolNames); Debug.LogFormat("[SUSadmin #{0}] Possible viruses:", moduleId); foreach (Vector2Int id in SusadminData.GetPossibleVirusesId(securityProtocols)) { Debug.LogFormat("[SUSadmin #{0}] \t{1}: ci:{2}; p:{3}", moduleId, SusadminData.GetVirusName(id), compatibilityIndices[id.x][id.y], virusesPower[id.x][id.y]); } Debug.LogFormat("[SUSadmin #{0}] Vulnerability: {1}", moduleId, vulnerability); Debug.LogFormat("[SUSadmin #{0}] Safety level: {1}", moduleId, safetyLevel); Debug.LogFormat("[SUSadmin #{0}] Answer example: {1}", moduleId, answerExample.Select(id => SusadminData.GetVirusName(id)).Join(", ")); startingTimeInMinutes = Mathf.FloorToInt(Bomb.GetTime() / 60f); osVersion = GetOSVersion(vulnerability); if (osVersion < 0 || (osVersion == 0 && Random.Range(0, 2) == 0)) { osIsBoom = true; osVersion *= -1; } Debug.LogFormat("[SUSadmin #{0}] OS version: {1} v{2}", moduleId, osIsBoom ? "BoomOS" : "BombOS", osVersion); Selectable.OnFocus += () => selected = true; Selectable.OnDefocus += () => selected = false; watchingCoroutine = StartCoroutine(Watch()); readyToWrite = true; UpdateConsole(); }
private string PrintSecurityProtocolName(int securityProtocol) { return(string.Format("<color=yellow>{0}</color>", SusadminData.GetSecurityProtocolName(securityProtocol))); }
private void SetSecurityProtocols() { securityProtocols = new List <int>(); HashSet <int> temp = new HashSet <int>(Enumerable.Range(0, SusadminData.SECURITY_PROTOCOLS_COUNT)); for (int i = 0; i < SusadminData.INSTALLED_SECURITY_PROTOCOLS_COUNT; i++) { int securityProtocol = temp.PickRandom(); temp.Remove(securityProtocol); securityProtocols.Add(securityProtocol); } Debug.LogFormat("[SUSadmin #{0}] Installed security protocols: {1}", moduleId, securityProtocols.Select(i => SusadminData.GetSecurityProtocolName(i)).Join(", ")); }