void SpawnSinDots() { allSinDots = new List <SinDot>(); for (int i = 0; i < sinDots; i++) { GameObject go = Instantiate(sinDotPrefab, Vector3.zero, Quaternion.identity, transform) as GameObject; RectTransform currRect = go.GetComponent <RectTransform>(); currRect.sizeDelta = new Vector2(imagesWidth, imagesHeight); currRect.anchoredPosition = new Vector3(sinDotsDis, 0) * -(i + 1); SinDot currDot = go.GetComponent <SinDot>(); allSinDots.Add(currDot); if (i == ClickerIndex) { GameObject gobj = Instantiate(sinDotPrefab, Vector3.zero, Quaternion.identity, transform) as GameObject; RectTransform clickerRect = gobj.GetComponent <RectTransform>(); gobj.GetComponent <Image>().color = markerC; gobj.name = "WTFOBJECZ"; clickerRect.sizeDelta = new Vector2(imagesWidth, imagesHeight * 50); clickerRect.anchoredPosition = new Vector3(sinDotsDis, 0) * -(i + 1); } } for (int i = 0; i < sinDots - 1; i++) { allSinDots[i].next = allSinDots[i + 1]; allSinDots[i + 1].prev = allSinDots[i]; } firstSinDot = allSinDots[0]; curving = true; roundStartedTime = Time.time; }
public void ClickDetected() { SinDot currDot = allSinDots[ClickerIndex]; int closestPoint = findClosestClick(); if (closestPoint == -1) { currDot.gameObject.GetComponent <Image>().color = Color.red; currentRoundPoints -= 2; bonusModifier = 1; } else if (closestPoint == ClickerIndex + 1 || closestPoint == ClickerIndex - 1) { currDot.gameObject.GetComponent <Image>().color = Color.yellow; currentRoundPoints += (1 * bonusModifier); bonusModifier = 1; } else if (closestPoint == ClickerIndex) { bonusModifier += 1; currDot.gameObject.GetComponent <Image>().color = Color.green; currentRoundPoints += (1 * bonusModifier); } CheckScore(); }