Ejemplo n.º 1
0
        /// <summary>
        /// Returns if game is ended
        /// </summary>
        /// <param name="trickCombo"></param>
        /// <returns></returns>
        public void VerifiyTrickCopied(TrickCombo trickCombo)
        {
            IsCopyingTrick = false;
            IsTrickSet     = false;
            var copiedTrick = string.Join(" ", trickCombo.Tricks.Select(s => s.ToString()));

            if (copiedTrick == CurrentTrick && trickCombo.Landed)
            {
                IsTrickCopied = true;
            }
            else
            {
                PlayerLetters[CurrentPlayerTurn] += 1;
                if (PlayerLetters[CurrentPlayerTurn] >= GameWord.Length && IsLastChance)
                {
                    Reset();
                    return;
                }
                else if (PlayerLetters[CurrentPlayerTurn] >= GameWord.Length)
                {
                    IsTrickSet = true;
                    PlayerLetters[CurrentPlayerTurn] -= 1;
                    IsLastChance = true;
                    return;
                }
                IsTrickCopied = false;
            }
            CurrentTrick = "";
            NextPlayer();
        }
Ejemplo n.º 2
0
 static void OnComboEnded(TrickCombo trickCombo)
 {
     if (GameOfSkateManagerInstance.IsCopyingTrick)
     {
         GameOfSkateManagerInstance.VerifiyTrickCopied(trickCombo);
     }
     else if (GameOfSkateManagerInstance.IsSettingTrick)
     {
         GameOfSkateManagerInstance.VerifyTrickSet(trickCombo);
     }
 }
Ejemplo n.º 3
0
        public void VerifyTrickSet(TrickCombo trickCombo)
        {
            IsSettingTrick = false;
            var trickName        = string.Join(" ", trickCombo.Tricks.Select(s => s.ToString()));
            var wasTrickRepeated = TricksDone.Contains(trickName);

            if (trickCombo.Landed && !wasTrickRepeated)
            {
                IsTrickSet   = true;
                CurrentTrick = trickName;
                TricksDone.Add(CurrentTrick);
            }
            WasTrickRepeated = wasTrickRepeated && trickCombo.Landed;
            NextPlayer();
        }