void direction(dialDetect tick) { if (tick.gameObject.transform.position.x > dial.gameObject.transform.position.x) { dir = 1; } else { dir = -1; } }
private void newRoundman() { roundNum++; //add 1 to round number int tickNum = GameObject.FindGameObjectsWithTag("tick").Length; //chose a new tick to be correct //Debug.Log("tickNum = " + tickNum); dialDetect[] potientalwinners = new dialDetect[tickNum]; for (int i = 0; i < tickNum; i++) { potientalwinners[i] = GameObject.FindGameObjectsWithTag("tick")[i].GetComponent <dialDetect>(); //assign each dialDetect script from the tick gameobjects } int theChosenOne = Random.Range(0, potientalwinners.Length); Debug.Log("chosen one " + theChosenOne); newRound(potientalwinners[theChosenOne]); //call the newround event (sets ticks to false) potientalwinners[theChosenOne].iswinner = true; //set the chosen tick bool to true and set dir potientalwinners[theChosenOne].gameObject.GetComponent <SpriteRenderer>().color = new Color(1f, 0f, 1f, 0.5f); //debuging purposes to tell which tick is the winner time = 8 - (roundNum / 4); }
private void Reset(dialDetect useless) { iswinner = false; timer = 0; }
void getTick(dialDetect tick) { this.tick = tick.gameObject.transform; }
private void Awake() { detect = this.gameObject.GetComponent <dialDetect>(); dial = GameObject.FindGameObjectWithTag("Dial"); }