Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (rightHandMovementScript.IsButtonPressed() && !animationStarted)
        {
            animationStarted = true;
            scaleDirection   = -1;
        }

        if (animationStarted)
        {
            transform.localScale += animationScaleStep * Time.deltaTime * scaleDirection;

            if (transform.localScale.x <= 0.5f)
            {
                transform.localScale = new Vector3(0.5f, 0.5f, 1);
                scaleDirection       = 1;

                // Recupera l'oggetto che e' al momento sul collider del knife
                ResolveCut(knifeEventScript.GetGameObjHitted());
            }
            else if (transform.localScale.x >= 0.6f)
            {
                transform.localScale = new Vector3(0.6f, 0.6f, 1);
                rightHandMovementScript.FreePressedButton();
                animationStarted = false;
            }
        }
    }
Exemplo n.º 2
0
 void OnTriggerStay(Collider other)
 {
     if (other.tag == "CookingObj")
     {
         if (leftHandMovementScript.IsButtonPressed() && !isBusy)
         {
             // Setto l'oggetto come figlio
             objectToCut.SetActive(true);
             // Lo setto occupato
             isBusy = true;
             // Distruggo il placeholder
             GameObject.Destroy(other.gameObject);
         }
     }
 }