private void UpdateDataAfterNight() { foreach (NightRobberyData nightRobDat in m_robberies) { DataScript.EData.PoliceKnowledge++; DataScript.SData.Money += nightRobDat.Money; foreach (int itemNum in nightRobDat.Awards.Keys) { DataScript.SData.ItemsCount[itemNum] += nightRobDat.Awards[itemNum]; } foreach (Character character in nightRobDat.Robbery.Characters) { if (character.Stats.Health <= 0) { character.AddToHospital(); } character.SetDefaultStatus(); } UIManager.robberyWindow.RemoveAllItemsFromRoobbery(nightRobDat.Robbery.RobberyType, nightRobDat.Robbery.LocationNum); } m_robberies.Clear(); NightEventsOptions.ClearUsedEvents(); //todo: delete RobberiesOptions.GetNewRobberies(); }
//Constructor public NightRobberyData(Robbery robbery) { this.m_robbery = robbery; nightEvent = NightEventsOptions.GetRandomEvent(robbery.RobberyType); m_eventStatus = EventStatus.InProgress; m_chance = RobberiesOptions.CalculatePreliminaryChance(robbery); m_policeChance = Random.Range(0, 51); m_hospitalChance = Random.Range(0, 51); m_money = RobberiesOptions.GetRobberyMoneyRewardAtTheCurrentMoment(robbery.RobberyType); m_awards = RobberiesOptions.GetRobberyAwardsAtTheCurrentMoment(robbery.RobberyType); m_policeKnowledge = 1; }
public static void AssignDefaultData() { //sData DataScript.SData.ItemsCount = new int[ItemsOptions.totalAmount]; for (int i = 0; i < ItemsOptions.totalAmount; i++) { DataScript.SData.ItemsCount[i] = 5; } DataScript.SData.Money = 1000000; //chData Character arrestedChar = CharactersOptions.GetRandomCharacter(5); arrestedChar.AddToPolice(); DataScript.ChData.AddCharacter(arrestedChar); Character hospitalChar = CharactersOptions.GetRandomCharacter(6); hospitalChar.AddToHospital(); DataScript.ChData.AddCharacter(hospitalChar); Character[] characters = new[] { CharactersOptions.GetRandomCharacter(6), CharactersOptions.GetRandomCharacter(5), CharactersOptions.GetRandomCharacter(4) }; //chData.panelCharacters.Add(CharactersOptions.GetRandomCommonCharacter(8)); //chData.panelCharacters.Add(CharactersOptions.GetRandomCommonCharacter(9)); //chData.panelCharacters.Add(CharactersOptions.GetSpecialCharacter(9, 0)); DataScript.ChData.AddCharacter(CharactersOptions.GetSpecialCharacter(9, 1)); DataScript.ChData.AddCharacter(characters[0]); DataScript.ChData.AddCharacter(characters[1]); DataScript.ChData.AddCharacter(characters[2]); //eData DataScript.EData.PoliceKnowledge = 0; RobberiesOptions.GetNewRobberies(); //pData DataScript.PData.IsItemAvailable = new bool[ItemsOptions.totalAmount]; for (int i = 0; i < ItemsOptions.totalAmount; i++) { DataScript.PData.IsItemAvailable[i] = true; } DataScript.PData.Authority = 9; DataScript.SaveAll(); }
public void SetRobberyWindow(RobberyType robberyType, int locationNumber) { this.robType = robberyType; this.locationNum = locationNumber; robberyData = DataScript.EData.RobberiesData[robberyType][locationNumber]; UpdateCharacters(); UpdateItems(); robberyImage.sprite = RobberiesOptions.Instance.RobberySprites[(int)robType]; descriptionText.text = RobberiesOptions.GetRobberyDescription(robType); nameText.text = RobberiesOptions.GetRobberyName(robType); robberyWindowObject.SetActive(true); robberyWindowObject.transform.SetAsLastSibling(); DataScript.EData.RobberiesData[robType][locationNum].OnAddToRobEvent += OnAddReaction; DataScript.EData.RobberiesData[robType][locationNum].OnRemoveFromRobEvent += OnRemoveReaction; }
public void Initialize() { m_instance = GetComponent <RobberiesOptions>(); m_robberiesCollection = RobberiesSerialization.GetRobberiesCollection(); }