Esempio n. 1
0
    private void transferCoin(Transaction trans)
    {
        CoinBankAccount sendAcct      = getAccount(trans.sendAccount);
        CoinBankAccount receiveAcct   = getAccount(trans.receiveAccount);
        Vector3         sendVector    = (trans.sendAccount == CUSTOM ? trans.custom : sendAcct.getVector());
        Vector3         receiveVector = (trans.receiveAccount == CUSTOM ? trans.custom : receiveAcct.getVector());

        // Only actually remove coin from transfer account if this is a transfer, otherwise just gain coin at main account
        if (sendAcct != null)
        {
            aq.Add(() =>
            {
                sendAcct.value -= 1;
                updateText(sendAcct);
            });
        }
        aq.Instantiate(coinPrefab, sendVector);         // will select object
        aq.Add(() =>
        {
            aq.Pause();
            StartCoroutine(aq.selectedGameObject.transform.LerpPosition(receiveVector, animDuration, null, (tf) => aq.Resume()));
        });
//		aq.Log("Coin from " + sendAcct.name + " arrived at " + receiveAcct.name);
        if (receiveAcct != null)
        {
            aq.Add(() =>
            {
                receiveAcct.value += 1;
                updateText(receiveAcct);
            });
        }
        aq.Destroy();
    }