예제 #1
0
    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;
    }
예제 #2
0
    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);
    }
예제 #3
0
    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();
    }
예제 #4
0
    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)
        //{

        //}
    }
예제 #5
0
    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();
        }
    }