private void InteractableObjectUngrabbed(object sender, InteractableObjectEventArgs e) { GameTable.cardGrabbed = null; GameTable.ResetAll(); grabbed = false; if (!GameReferee.Instance.IsMyTurn()) { return; } var pos = GetBoardPosition(); Debug.Log($"hover pos: {pos}"); Debug.Log($"mana {virtualCard.ManaCost} / {GameReferee.Instance.Players[virtualCard.Owner - 1].Mana}"); Debug.Log($"gold {virtualCard.GoldCost} / {GameReferee.Instance.Players[virtualCard.Owner - 1].Gold}"); Debug.Log($"food {virtualCard.FoodCost} / {GameReferee.Instance.Players[virtualCard.Owner - 1].Food}"); if (IsValidPosition(pos) && virtualCard.CanBePlayed()) { Debug.Log("Played the card"); if (virtualCard.CardType == CardType.DRAGON) { virtualCard.GoPlay(pos); } if (virtualCard.CardType == CardType.SPELL) { ((CardSpell)virtualCard).PlaySpell(pos); } Debug.Log("Played the card2"); GameReferee.Instance.Players[virtualCard.Owner - 1].UseCard(virtualCard.Index, pos); GameReferee.Instance.UpdateResources(); GameObject.Destroy(this.gameObject); } else { transform.position = startingPoint; transform.rotation = startingRotation; } }
private void OnTileUnused() { if (!GameReferee.Instance.IsMyTurn()) { return; } int currentTile = GetSelectedChild(); if (myDestructible != null && myDestructible.DestructibleType == OnBoardDestructible.DRAGON && myDestructible.Owner == PlayerInfoScene.Instance.playerId ) { var myDragon = (OnBoardDragon)myDestructible; int i1 = tileBeingUsed / tableColors.HEIGHT; int j1 = tileBeingUsed % tableColors.HEIGHT; int i2 = currentTile / tableColors.HEIGHT; int j2 = currentTile % tableColors.HEIGHT; var OtherDestructible = GameReferee.Instance.Board.Destructables[i2, j2]; if (OtherDestructible == null && myDragon.GetMovingPositions().Contains(new Vector2Int(j2, i2))) { GameReferee.Instance.CallRPCMethod("MoveOnBoardDragon", new int[] { i1, j1 }, new int[] { i2, j2 }); } else { if (OtherDestructible != null && myDragon.GetAttackingPositions().Contains(new Vector2Int(j2, i2))) { GameReferee.Instance.CallRPCMethod("AttackOnBoardDragon", new int[] { j1, i1 }, new int[] { j2, i2 }); } } } tileBeingUsed = -1; myDestructible = null; tableColors.ResetAll(); }
private void ObjectUnused() { Table.ResetAll(); }