// Use this for initialization void Start() { ui = GetComponent <UIScript>(); rb = GetComponent <Rigidbody>(); gameController = GameObject.Find("Game Controller"); chars = GetComponent <CharactersScript>(); currentCharacter = chars.debug; moveSpeed = currentCharacter.moveSpeed; //Cannot instantiate the icons at the start because it creates a race condition. //The icons are loaded from a different class and can only be instantiated once the other class is loaded. //To solve this, a boolean is used to instantiate the icons on the first frame in the update procedure which runs after start. iconsInitiated = false; playerId = GetComponent <NetworkIdentity>().netId.Value; //Give the player a unique ID based on their network object ID. if (!isLocalPlayer) { //Disable the player camera if this is not the local player. playerCamera.SetActive(false); return; } //Set localPlayer to isLocalPlayer so other scripts can access this property. localPlayer = isLocalPlayer; }
public void Save() { for (int index = 0; index < Characters.Count; index++) { var characterParser = Characters[index]; characterParser.UpdateCultural(); } List <CharacterParser> withoutFamilies = new List <CharacterParser>(Characters); foreach (var characterParser in withoutFamilies) { if (characterParser.PrimaryTitle == null) { continue; } if (characterParser.PrimaryTitle.Rank == 0) { continue; } if (characterParser.PrimaryTitle.SubTitles.Count == 0 && characterParser.PrimaryTitle.Owns.Count == 0) { continue; } if (characterParser.PrimaryTitle.Rank == 1) { characterParser.CreateFamily(0, 0); } else if (characterParser.PrimaryTitle.Rank == 2) { characterParser.CreateFamily(0, 0); } else if (characterParser.PrimaryTitle.Rank == 3) { characterParser.CreateFamily(0, 4); } else if (characterParser.PrimaryTitle.Rank == 4) { characterParser.CreateFamily(0, 4); } characterParser.UpdateCultural(); } CharacterManager.instance.CalculateAllDates(); CharactersScript.Save(); }
public void Save() { for (int index = 0; index < Characters.Count; index++) { var characterParser = Characters[index]; // characterParser.UpdateCultural(); characterParser.UpdateCultural(); if (characterParser.PrimaryTitle != null && characterParser.PrimaryTitle.Rank > 1) { characterParser.AddRandomTraits(); } if (characterParser.PrimaryTitle != null) { characterParser.YearOfDeath += 1000; } } DoPurge(); for (int index = 0; index < Characters.Count; index++) { var characterParser = Characters[index]; // characterParser.UpdateCultural(); if (characterParser.YearOfDeath < characterParser.lastImportantYear) { characterParser.YearOfDeath = characterParser.lastImportantYear; } if (characterParser.lastImportantYear > characterParser.YearOfDeath) { characterParser.YearOfDeath = characterParser.lastImportantYear; } CharacterManager.instance.SetAllDates(characterParser.YearOfBirth, characterParser.YearOfDeath, characterParser.Scope, characterParser.Titles.Count > 0); this.CharactersScript.Root.SetChild(characterParser.Scope); } /* * List<CharacterParser> withoutFamilies = new List<CharacterParser>(Characters); * * foreach (var characterParser in withoutFamilies) * { * if (characterParser.PrimaryTitle == null) * continue; * if(characterParser.PrimaryTitle.Rank == 0) * continue; * if (characterParser.PrimaryTitle.SubTitles.Count == 0 && characterParser.PrimaryTitle.Owns.Count == 0) * continue; * * if (Rand.Next(3) == 0) * { * // characterParser.PrimaryTitle.AdjacentToTitle * } * * if (characterParser.PrimaryTitle.Rank == 1) * characterParser.CreateFamily(0, 1); * else if (characterParser.PrimaryTitle.Rank == 2) * characterParser.CreateFamily(0, 2); * else if (characterParser.PrimaryTitle.Rank == 3) * characterParser.CreateFamily(0, 6); * else if (characterParser.PrimaryTitle.Rank == 4) * characterParser.CreateFamily(0, 6); * characterParser.UpdateCultural(); * } */ // CharacterManager.instance.CalculateAllDates(); CharactersScript.Save(); }