Ejemplo n.º 1
0
 public void StartGame(BattleData data)
 {
     SetBattleData(data);
     playerSideText.Value = $"Your side: {data.Sides[data.GetPlayerId()]}";
     lockedInCharacter    = null;
     selectedCharacter    = null;
     selectedCard         = null;
 }
Ejemplo n.º 2
0
        private async Task NextPlayerTurn()
        {
            if (lockedInCharacter == null)
            {
                statusPanel.Show("You must activate a character this turn.");
                return;
            }

            lockedInCharacter?.EndTurn(data.TurnNumber);
            lockedInCharacter = null;
            selectedCharacter = null;

            if (data.OtherSideHasNoRemainingCharactersAndIHaveSome)
            {
                statusPanel.Show("Opponent has no more characters to activate, go again!");
                return;
            }

            data.LastPlayingPlayerId = ApplicationData.PlayerId;
            data.ChangePlayingSide();
            data.TurnNumber++;
            data.Characters.ForEach(character => character.CurrentTurn = data.TurnNumber);
            if (!data.AnyCharacterUnactivated)
            {
                StartNextRound();
                if (data.IsTestMode)
                {
                    statusPanel.Show("NEW ROUND");
                }
            }

            if (!data.IsTestMode)
            {
                await battleManager.SaveBattle(data);
            }
            else
            {
                playerSideText.Value = $"Your side: {data.Sides[data.GetPlayerId()]}";
            }
        }