Example #1
0
    private void DetectGluingAreas()
    {
        Ray        ray = Camera.main.ScreenPointToRay(currentTouchPosition);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit, 100f, pickableLayers))
        {
            GlueBox glueBox = hit.collider.gameObject.GetComponent <GlueBox>();
            if (glueBox != null)
            {
                glueBox.ApplyGlue(this);
            }
        }
        previousTouchPosition = currentTouchPosition;
    }
 private void EvaluateGlueArea(GlueBox glueArea)
 {
     if (glueArea != null)
     {
         float      glueApplied  = glueArea.GetTotalGlueApplied();
         PlayerGlue playerGluing = glueManager.glue;
         if (glueApplied >= playerGluing.AmountToActivateSnapPoints && glueApplied < playerGluing.MinAmountForPerfectScore)
         {
             totalMinimumGlues++;
             totalGluePercentage += glueApplied;
         }
         else if (glueApplied >= playerGluing.MinAmountForPerfectScore && glueApplied <= playerGluing.MaxAmount)
         {
             totalPerfectGlues++;
             totalGluePercentage += playerGluing.MaxAmount;
         }
         else if (glueApplied >= playerGluing.MaxAmount)
         {
             totalTooMuchGlues++;
             totalGluePercentage += glueArea.CalculatePercentage(playerGluing.MaxAmount);
         }
     }
 }