private void Awake() { instance = this; BaseScale = gameObject.transform.localScale; List <SpriteRenderer> renderers = new List <SpriteRenderer>(GetComponentsInChildren <SpriteRenderer>()); for (int i = 0; i < renderers.Count; ++i) { OriginalSortOrders.Add(renderers[i], renderers[i].sortingOrder); } List <TextMeshPro> textrenderers = new List <TextMeshPro>(GetComponentsInChildren <TextMeshPro>()); for (int i = 0; i < textrenderers.Count; ++i) { OriginalSortOrdersText.Add(textrenderers[i], textrenderers[i].sortingOrder); } List <ParticleSystemRenderer> particlerenderers = new List <ParticleSystemRenderer>(GetComponentsInChildren <ParticleSystemRenderer>()); for (int i = 0; i < particlerenderers.Count; ++i) { OriginalSortOrdersParticles.Add(particlerenderers[i], particlerenderers[i].sortingOrder); } OriginalZ = gameObject.transform.localPosition.z; OriginPosition = gameObject.transform.position; }
private SalaryCoin SpawnSalaryCoin() { SalaryCoin newCoin = Instantiate(SalaryCoinTemplate); newCoin.gameObject.transform.SetParent(MasterObjectTransform); newCoin.gameObject.transform.position = MoneySpawnMarker.transform.position + new Vector3(Random.Range(-0.5f, 0.5f), Random.Range(-0.5f, 0.5f)); newCoin.name += SalaryCoinList.Count; SalaryCoinList.Add(newCoin); return(newCoin); }
public void SpendSalary(int amount) { int coins = Mathf.Abs(amount) / 100; for (int i = 0; i < coins; ++i) { SalaryCoin coinToSpend = SalaryCoinList[SalaryCoinList.Count - 1]; SalaryCoinList.Remove(coinToSpend); Destroy(coinToSpend.gameObject); } SaveManager.instance.MarkSavegameDirty(); }
public void RestoreSalaryCoins() { //int coins = ArticyGlobalVariables.Default.inventory.money / 100; foreach (KeyValuePair <string, DeskItemStatus> entry in SaveManager.instance.GetCurrentCarryoverPlayerState().ItemPositions) { if (entry.Key.Contains("SalaryCoin")) { SalaryCoin coin = SpawnSalaryCoin(); coin.name = entry.Key; coin.RestoreStatus(entry.Value); } } //for(int i = 0; i < coins; ++i) //{ //} }
public void CoinWail() { CoinWailingTimer = Random.Range(5.0f, 10.0f); List <SalaryCoin> wailableCoins = new List <SalaryCoin>(); for (int i = 0; i < SalaryCoinList.Count; ++i) { if (!SalaryCoinList[i].IsInDrawer() || SalaryCoinList[i].IsInDrawer() && SalaryCoinList[i].GetDrawer().IsOpen()) { wailableCoins.Add(SalaryCoinList[i]); } } if (wailableCoins.Count > 0) { SalaryCoin wailCoin = wailableCoins[Random.Range(0, wailableCoins.Count)]; wailCoin.Wail(); } }