Esempio n. 1
0
    void OnTargetEnter(Collider target)
    {
        //if(target.tag == tagName) {
        //currentTarget = target.gameObject;
        TargetColor tc1 = transform.parent.GetComponentInChildren <TargetColor>();
        TargetColor tc2 = target.gameObject.transform.parent.GetComponentInChildren <TargetColor>();

        if (tc1.getColorIndex() == tc2.getColorIndex())
        {
            gameManager.addScore(10);
        }
        else
        {
            gameManager.addScore(1);
        }
        //}
    }
Esempio n. 2
0
 void OnTargetExit(Collider target)
 {
     //if(target.tag == tagName) {
     if (subtractOnExit)
     {
         TargetColor tc1 = transform.parent.GetComponentInChildren <TargetColor>();
         TargetColor tc2 = target.gameObject.transform.parent.GetComponentInChildren <TargetColor>();
         if (tc1.getColorIndex() == tc2.getColorIndex())
         {
             gameManager.addScore(-10);
         }
         else
         {
             gameManager.addScore(-1);
         }
     }
     //currentTarget = null;
     //}
 }