/// <summary> /// Sends information about fireball activation to other players through Nakama server. /// Use only on host! /// </summary> /// <param name="node"></param> /// <param name="impactedUnits"></param> /// <param name="playerId"></param> private void SendSpellActivatedRequest(Node node, List <Unit> impactedUnits, string playerId) { List <int> impactedUnitsIds = impactedUnits.Select(u => u.Id).ToList(); MatchMessageSpellActivated message = new MatchMessageSpellActivated(playerId, SpellType, node.Position.x, node.Position.y, impactedUnitsIds); _stateManager.SendMatchStateMessage(MatchMessageType.SpellActivated, message); _stateManager.SendMatchStateMessageSelf(MatchMessageType.SpellActivated, message); }
/// <summary> /// Builds forts at the start of the game. /// </summary> /// <param name="userId"></param> public void BuildStartingStructures(string userId) { bool isHost = userId == _connection.BattleConnection.HostId; CardData fortCard = new CardData() { type = CardType.Fort, level = 1 }; CardData mainFortCard = new CardData() { type = CardType.MainFort, level = 1 }; int fortX = isHost ? 4 : 10; int mainFortX = isHost ? 2 : 12; var playerColor = isHost ? PlayerColor.Black : PlayerColor.Red; MatchMessageUnitSpawned fortTop = new MatchMessageUnitSpawned( userId, playerColor, _nextId++, fortCard, fortX, 10); MatchMessageUnitSpawned fortBot = new MatchMessageUnitSpawned( userId, playerColor, _nextId++, fortCard, fortX, 2); MatchMessageUnitSpawned fortMain = new MatchMessageUnitSpawned( userId, playerColor, _nextId++, mainFortCard, mainFortX, 6); _stateManager.SendMatchStateMessage(MatchMessageType.UnitSpawned, fortTop); _stateManager.SendMatchStateMessage(MatchMessageType.UnitSpawned, fortBot); _stateManager.SendMatchStateMessage(MatchMessageType.UnitSpawned, fortMain); _stateManager.SendMatchStateMessageSelf(MatchMessageType.UnitSpawned, fortTop); _stateManager.SendMatchStateMessageSelf(MatchMessageType.UnitSpawned, fortBot); _stateManager.SendMatchStateMessageSelf(MatchMessageType.UnitSpawned, fortMain); Unit tower2 = _units[playerColor][_nextId - 3]; Unit tower1 = _units[playerColor][_nextId - 2]; Unit castle = _units[playerColor][_nextId - 1]; }