Exemplo n.º 1
0
    /// <summary>
    /// Check if agent is full,if yes, feed the baby
    /// </summary>
    private void RegurgitateFish()
    {
        if (!isFull)
        {
            return;//Nothing to regurgitate
        }
        isFull = false;

        //Spawn regurgitated fish
        GameObject regurgitatedFish = Instantiate(regurgitatedFishPrefab);

        regurgitatedFish.transform.parent   = transform.parent;
        regurgitatedFish.transform.position = baby.transform.position;
        Destroy(regurgitatedFish, 4f);

        //spawn heart
        GameObject heart = Instantiate(heartPrefab);

        heart.transform.parent   = transform.parent;
        heart.transform.position = baby.transform.position + Vector3.up;
        Destroy(heart, 4f);

        AddReward(1f);

        if (penguinArea.FishRemaining() <= 0)
        {
            Done();
        }
    }
Exemplo n.º 2
0
    void RegurgitateFish()
    {
        if (isFull == false)
        {
            return;
        }

        isFull = false;

        GameObject regurgitatedFish = Instantiate(regurgitatedFishPrefab, baby.transform.position, Quaternion.identity);

        Destroy(regurgitatedFish, 4.0f);

        GameObject heart = Instantiate(heartPrefab, baby.transform.position + Vector3.up, Quaternion.identity);

        Destroy(heart, 4.0f);

        AddReward(1.0f);

        if (penguinArea.FishRemaining() <= 0)
        {
            Done();
        }
    }