private void OnPanHit( )
    {
        // check that we have reached the pan.
        // the length of the raycast can be longer than the travel distance.
        if (NextPosition.y > rayHit.point.y)
        {
            return;
        }

        // correct it position, turn off gravity and the raycast since we have now reached the pan, and we wont be colliding with anythink else.
        updating = false;
        GetComponent <Rigidbody>().useGravity = false;
        GetComponent <Rigidbody>().velocity   = Vector3.zero;
        transform.position = rayHit.point;


        //Attamp to find the fryingPan Pancake class, it has to search its parents since the collider is nested into the object.
        FryingPan_pancake panPancake = rayHit.transform.GetComponentInParent <FryingPan_pancake>();

        if (panPancake == null)
        {
            return;
        }

        // Get batter qt of the batterBall and apply it to a mixture pancake.
        Batter_quantity quantity = GetComponent <Batter_quantity>();

        panPancake.AddBatter(quantity.GetBatterQuantity(), rayHit.point);
        transform.position = rayHit.point;
    }
Ejemplo n.º 2
0
    void Awake()
    {
        GetComponent <Pancake_state>().OnStateChanged += OnPancakeStateChanged;
        batterQuantity = GetComponent <Batter_quantity>();
        batterQuantity.OnBatterChanged += OnBatterChanged;

        lerpTimer.SetTimer(lerpIntervals, true);

        //NOTE: just for now.
        // I WILL NOT be using scale but just to get it working.
        // insted i should move the bones/joints of the pnacake.
        // (cuz pancakes have bones now :D)
        transform.localScale = startLerpScale = targetScale = Vector3.zero;
        volume = batterQuantity.GetBatterQuantity() / quantityToVolumRatio;
    }
Ejemplo n.º 3
0
 public void OnBatterChanged(float batterPercent)
 {
     startLerpScale = transform.localScale;
     lerpTimer.SetTimer(lerpIntervals, true);
     volume = batterQuantity.GetBatterQuantity() / quantityToVolumRatio;
 }