Пример #1
0
 public void OnMouseDown()
 {
     if (!isColored)
     {
         if (cm.activeGem == 1 && cm.holdingBlue)
         {
             gameObject.GetComponent <Renderer>().material = blueMat;
             cm.holdingBlue = false;
             cm.activeGem   = 0;
             isColored      = true;
             properGem      = true;
         }
         else if (cm.activeGem == 2 && cm.holdingGreen)
         {
             gameObject.GetComponent <Renderer>().material = greenMat;
             cm.holdingGreen = false;
             cm.activeGem    = 0;
             isColored       = true;
             properGem       = false;
         }
         else if (cm.activeGem == 3 && cm.holdingRed)
         {
             gameObject.GetComponent <Renderer>().material = redMat;
             cm.holdingRed = false;
             cm.activeGem  = 0;
             isColored     = true;
             properGem     = false;
         }
     }
     else if (isColored)
     {
         if (gameObject.GetComponent <Renderer>().material.name == "Material_003 (Instance)")
         {
             cm.ObtainedBlue();
             gameObject.GetComponent <Renderer>().material = whiteMat;
             isColored = false;
             properGem = false;
         }
         else if (gameObject.GetComponent <Renderer>().material.name == "Material_002 (Instance)")
         {
             cm.holdingGreen = true;
             gameObject.GetComponent <Renderer>().material = whiteMat;
             isColored = false;
         }
         else if (gameObject.GetComponent <Renderer>().material.name == "Material_001 (Instance)")
         {
             cm.holdingRed = true;
             gameObject.GetComponent <Renderer>().material = whiteMat;
             isColored = false;
         }
     }
 }