public void ImportNewCardFromOpponent(Net_InstantiateCard msg) { SerializeableCard sc = msg.card; Card newCard = ResourceManager.Get().InstantiateCardById(sc.cardId); newCard.Owner = msg.ownerIsP1 ? GetPlayer1() : GetPlayer2(); cardMap.Add(newCard, sc.netId); newCard.removeGraphicsAndCollidersFromScene(); // remove from scene by default. Can be moved later by opponent }
public void SyncNewCardToOpponent(Card c) { if (LocalPlayerIsP1) { lastUsedNetId++; } else { lastUsedNetId--; } cardMap.Add(c, lastUsedNetId); SerializeableCard sc = new SerializeableCard(); sc.netId = lastUsedNetId; sc.cardId = c.CardId; Net_InstantiateCard msg = new Net_InstantiateCard(); msg.card = sc; msg.ownerIsP1 = c.Owner == GetPlayer1(); RelayMessage(msg); }