public void PrepareLaunchBattle(Client otherClient) { Console.WriteLine("Prepare launch battle ..."); BattleRoom battleRoom = new BattleRoom(); m_clients[0].SetRoom(battleRoom); otherClient.SetRoom(battleRoom); battleRoom.SendLaunchBattle(); }
public void NextTurn() { if (m_client.Room.GetType() == typeof(BattleRoom)) { BattleRoom battleRoom = (BattleRoom)m_client.Room; if (battleRoom.IsPlayerTurn(m_client)) { battleRoom.Battle.NextCharacterTurn(); Client other = battleRoom.GetOtherClient(m_client); other.SendFunction.NextTurn(); } } }
public void MoveCharacter(string position) { if (m_client.Room.GetType() == typeof(BattleRoom)) { BattleRoom battleRoom = (BattleRoom)m_client.Room; if (battleRoom.IsPlayerTurn(m_client)) { GridPosition positionParse = new GridPosition(position); if (battleRoom.Battle.MoveCharacter(battleRoom.Battle.ActualCharacter, battleRoom.Battle.Grid.Rows[positionParse.x, positionParse.y])) { battleRoom.GetOtherClient(m_client).SendFunction.MoveCharacter(position); } } } }
public void LaunchSpell(string spellID, string position) { if (m_client.Room.GetType() == typeof(BattleRoom)) { BattleRoom battleRoom = (BattleRoom)m_client.Room; if (battleRoom.IsPlayerTurn(m_client)) { GridPosition positionParse = new GridPosition(position); if (battleRoom.Battle.LaunchSpell( battleRoom.Battle.ActualCharacter, battleRoom.Battle.ActualCharacter.Spells.Find(x => x.Id == spellID), battleRoom.Battle.Grid.Rows[positionParse.x, positionParse.y])) { battleRoom.GetOtherClient(m_client).SendFunction.LaunchSpell(spellID, position); if (!battleRoom.Battle.IsStarted) { battleRoom.EndGame(); } } } } }