public void UnlockVote(LevelVoter v) { int ind = voters.IndexOf(v); voters[ind].locked = false; indicators[ind].color = voters[ind].color * .75f; }
public void LockInVote(LevelVoter v) { int ind = voters.IndexOf(v);//voters.FindIndex(voter => voter.index == v.index); voters[ind].locked = true; indicators[ind].color = voters[ind].color; }
public void SelectByPlayer(LevelVoter v) { if (voters.Contains(v)) { return; } voters.Add(v); indicators[voters.Count - 1].color = v.color * .75f; numSelectedBy++; }
public void DeselectByPlayer(LevelVoter v) { voters.Remove(v); numSelectedBy--; for (int j = 0; j < 4; j++) { if (j < voters.Count) { indicators[j].color = voters[j].color * (voters[j].locked ? 1 : .75f); } else { indicators[j].color = Color.clear; } } }
// Use this for initialization void Start() { gm = GameObject.Find("GameManager").GetComponent <GameManager>(); Player[] players = gm.AllPlayers; voters = new LevelVoter[players.Length]; for (int i = 0; i < players.Length; i++) { voters[i] = new LevelVoter(i, players[i].Color); levelButtons[0].SelectByPlayer(voters[i]); } prevStates = new GamePadState[4]; countdownTimer = 30; levelSelectedCountdown = 3; }