void Loot(int id)
    {
        GameObject rewardObject = rewardPool.GetPooledObject(id);

        if (id == 0)
        {
            rewardObject.transform.position = new Vector3(this.gameObject.transform.position.x + Random.Range(-1, 2), 1f, this.gameObject.transform.position.z + Random.Range(-1, 2));
        }
        else
        {
            rewardObject.transform.position = this.gameObject.transform.position;
        }
        rewardObject.SetActive(true);
    }
Beispiel #2
0
    void GetCoin()
    {
        GameObject rewardObject = rewardPool.GetPooledObject(0);

        if (this.gameObject.transform.position.y <= 0.55f)
        {
            rewardObject.transform.position = new Vector3(this.gameObject.transform.position.x + Random.Range(-2, 3), 1.0F, this.gameObject.transform.position.z + Random.Range(-2, 3));
        }
        else
        {
            rewardObject.transform.position = new Vector3(this.gameObject.transform.position.x + Random.Range(-2, 3), this.gameObject.transform.position.y, this.gameObject.transform.position.z + Random.Range(-2, 3));
        }
        rewardObject.SetActive(true);
    }