Пример #1
0
    // called from the batter when it collides with the fryingPan.
    public void BatterCollision(Vector3 collisionPosition, float batterQt)
    {
        Quaternion quaternion = new Quaternion();

        quaternion.eulerAngles = new Vector3(0, 90, 0);

        // create a new pancake if we are not already reciving batter :)
        if (!currentPancake)
        {
            currentPancake = Instantiate(pancake_prefab, collisionPosition, quaternion);
            currentPancake.transform.parent = transform;
            currentPancake.SetStartPosition(collisionPosition);
            currentPancake.SetCurrentPan(this);
        }
        else if (currentPancake && currentPancake.GetCurrentState() != PancakeState.Mixture)            // consume any current pancakes in the pan that are not raw.
        {
            Pancake oldPancake = currentPancake;
            currentPancake = Instantiate(pancake_prefab, collisionPosition, quaternion);
            currentPancake.transform.parent = transform;
            currentPancake.SetStartPosition(collisionPosition);
            oldPancake.transform.parent = currentPancake.transform;
            currentPancake.SetCurrentPan(this);
        }

        currentPancake.AddBatter(batterQt, 0.25f);              // 0.25f is the spwan intervals of batter from jug.
    }
Пример #2
0
    public void RegisterPancake(Pancake pancakeToReg)
    {
        // can not reg a raw pancake. this is delta with in batterCollision.
        if (pancakeToReg.GetCurrentState() == PancakeState.Mixture)
        {
            return;
        }

        currentPancake = pancakeToReg;
        currentPancake.transform.parent = transform;
        currentPancake.SetCurrentPan(this);
    }
Пример #3
0
    public void UnregisterPancake(Pancake pancakeToUnreg)
    {
        //can not remove a pan if its raw or not there :)
        if (!currentPancake || currentPancake && currentPancake.GetCurrentState() == PancakeState.Mixture)
        {
            return;
        }

        //Set the temperature back to 0, sinc it is no longer in the pan
        currentPancake.SetTemperature(0);
        currentPancake.transform.parent = null;
        currentPancake.SetCurrentPan(null);
        currentPancake = null;
    }