示例#1
0
        public void AddCandidate()
        {
            //проверяю валидность выставленного игрока
            foreach (var voteView in VoteViews)
            {
                int candidate = Convert.ToInt32(voteView.PotentialCandidate.text);
                if (candidate < 0 || candidate > 10)
                {
                    voteView.PotentialCandidate.text = "";
                    Debug.Log("Неправильная кандидатура");
                }
                else if (!LivePlayers.CheckAlivePlayer(candidate - 1))
                {
                    voteView.PotentialCandidate.text = "";
                    Debug.Log("Этот игрок мертв");
                }
                else
                {
                    //if (!CheckRepeatCandidatesInText(voteView.Candidate.acceptPlayer)) continue;
                    if (!CheckRepeatCandidatesInText(candidate.ToString()))
                    {
                        continue;
                    }
                    voteView.Candidate.acceptPlayer  = voteView.PotentialCandidate.text;
                    voteView.PotentialCandidate.text = "";

                    voteView.AddCandidateInText();
                    voteView.ShowCandidate();
                }
            }
        }
示例#2
0
        //when you've pressed on toggle
        public void OnFoul(Toggle toggle)
        {
            PlayerData.foul++;
            toggle.isOn         = true;
            toggle.interactable = false;

            if (PlayerData.foul == 4)
            {
                LivePlayers.RemovePlayer(PlayerData.number);
            }
        }
示例#3
0
 void Awake()
 {
     if (!instance)
     {
         DontDestroyOnLoad(this);
         instance = this;
     }
     else
     {
         Debug.LogError(this.GetType() + "::" + "Awake" + " -- Only one instance of " + this.GetType() + " is allowed at a time");
         Destroy(this.gameObject);
     }
 }