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;
    }
    private Vector3 lastInputPercentage = Vector3.zero;         // range -1 to 1


    protected override void Awake()
    {
        base.Awake();

        pancake = GetComponent <FryingPan_pancake>();
    }
Exemplo n.º 3
0
    [SerializeField] private float cooldownRate = 10f;     //per second

    private void Start()
    {
        fryingPan_pancake = GetComponent <FryingPan_pancake>();
    }