public void SetInfo(CardData data) { this.Name = data.Name; this.Icon = data.Icon; this.Power = data.Power; this.Description = data.Description; this.Ability = data.Ability; }
public void OnUniqueAbility(string playerName, UniqueAbility ability) { Broadcast(playerName + " used " + ability.ToString()); Game.Instance.RegisterAction(() => { Game.Instance.ActivateUniqueAbility(playerName, ability); }); }
void Start() { playerClass = abilities[0]; SwitchPlayerState(new PlayerStateIdle()); cam = GetComponentInChildren <Camera>(); controller = GetComponent <CharacterController>(); }
public void ActivateUniqueAbility(string playerName, UniqueAbility ability) { SetMessage(playerName + " Activated Ability " + ability.ToString()); GameObject effect = ResourcesLoader.Instance.GetRecycledObject("UniqueAbilityParticles"); effect.transform.position = DumpPile.TopCard.transform.position; effect.transform.rotation = DumpPile.TopCard.transform.rotation; AudioControl.Instance.Play("sound_reward3"); PlayerModule player = GetPlayer(playerName); if (player.isPlayer) { Phase = TurnPhase.AbilityAction; CurrentAbility = ability; UnsetMarkers(); switch (CurrentAbility) { case UniqueAbility.Peek: { foreach (CardSlot slot in player.CardSlots) { if (slot.Card != null) { SetMarker(slot.Card.transform); } } break; } case UniqueAbility.PeekOnOther: { foreach (PlayerModule pPlayer in Players) { if (pPlayer == player) { continue; } foreach (CardSlot slot in pPlayer.CardSlots) { if (slot.Card != null) { SetMarker(slot.Card.transform); } } } break; } case UniqueAbility.SwapBlindly: { foreach (PlayerModule pPlayer in Players) { foreach (CardSlot slot in pPlayer.CardSlots) { if (slot.Card != null) { SetMarker(slot.Card.transform); } } } break; } case UniqueAbility.PeekAndSwap: { foreach (PlayerModule pPlayer in Players) { foreach (CardSlot slot in pPlayer.CardSlots) { if (slot.Card != null) { SetMarker(slot.Card.transform); } } } break; } } } }
public void InteractWithCard(CardUI Card, bool doubleClick = false) { if (!CanInteract) { return; } if (Card.isLerping) { ShockMessage.CallMessage("Please Wait...", Color.red); Card.BlinkRed(); return; } if (Phase == TurnPhase.WaitingForAnswer) { ShockMessage.CallMessage("Please Wait...", Color.red); Card.BlinkRed(); return; } if (CurrentSticker == "Player") { if (CurrentSticker == m_CurrentSticked) { ShockMessage.CallMessage("You already set that to stick.", Color.red); return; } if (Card.ParentPlayer.pName != "Player") { ShockMessage.CallMessage("Can only give your cards as penalty.", Color.red); return; } Client.Instance.SendGivePlayerPenaltyCard(Card.ParentPlayer.GetSlotIndex(Card)); return; } if (FocusedCard != null && Phase == TurnPhase.UseCard && Card.ParentPlayer.isPlayer) { Phase = TurnPhase.WaitingForAnswer; Client.Instance.SendReplaceCard(GetPlayer("Player").GetSlotIndex(Card)); } else if (Phase == TurnPhase.AbilityAction) { switch (CurrentAbility) { case UniqueAbility.Peek: { if (!Card.ParentPlayer.isPlayer) { ShockMessage.CallMessage("Can only peek on your own cards...", Color.red); Card.BlinkRed(); return; } Phase = TurnPhase.WaitingForAnswer; Client.Instance.SendPeekOnCard(Card.ParentPlayer.pName, Card.ParentPlayer.GetSlotIndex(Card)); break; } case UniqueAbility.PeekOnOther: { if (Card.ParentPlayer.isPlayer) { ShockMessage.CallMessage("Can only peek on other's cards...", Color.red); Card.BlinkRed(); return; } Phase = TurnPhase.WaitingForAnswer; Client.Instance.SendPeekOnCard(Card.ParentPlayer.pName, Card.ParentPlayer.GetSlotIndex(Card)); break; } case UniqueAbility.SwapBlindly: { if (InteractionCardA == null) { InteractionCardA = Card; InteractionCardA.Select(); UnsetMarkers(); foreach (PlayerModule pPlayer in Players) { if (InteractionCardA.ParentPlayer == pPlayer) { continue; } foreach (CardSlot slot in pPlayer.CardSlots) { if (slot.Card != null) { SetMarker(slot.Card.transform); } } } return; } else if (InteractionCardB == null) { if (InteractionCardA.ParentPlayer == Card.ParentPlayer) { return; } InteractionCardB = Card; InteractionCardB.Select(); Phase = TurnPhase.WaitingForAnswer; Client.Instance.SendSwapBlindly( InteractionCardA.ParentPlayer.pName, InteractionCardA.ParentPlayer.GetSlotIndex(InteractionCardA), InteractionCardB.ParentPlayer.pName, InteractionCardB.ParentPlayer.GetSlotIndex(InteractionCardB) ); break; } Debug.LogError("This is not supposed to happen!"); Card.BlinkRed(); break; } case UniqueAbility.PeekAndSwap: { if (InteractionCardA == null) { InteractionCardA = Card; InteractionCardA.Select(); UnsetMarkers(); foreach (PlayerModule pPlayer in Players) { if (InteractionCardA.ParentPlayer == pPlayer) { continue; } foreach (CardSlot slot in pPlayer.CardSlots) { if (slot.Card != null) { SetMarker(slot.Card.transform); } } } return; } else if (InteractionCardB == null) { if (InteractionCardA.ParentPlayer == Card.ParentPlayer) { return; } InteractionCardB = Card; InteractionCardB.Select(); Phase = TurnPhase.WaitingForAnswer; Client.Instance.SendPeekAndSwap( InteractionCardA.ParentPlayer.pName, InteractionCardA.ParentPlayer.GetSlotIndex(InteractionCardA), InteractionCardB.ParentPlayer.pName, InteractionCardB.ParentPlayer.GetSlotIndex(InteractionCardB) ); break; } Debug.LogError("This is not supposed to happen!"); Card.BlinkRed(); break; } } CurrentAbility = UniqueAbility.Nothing; } else { if (DumpPile.GetTopCard() != null && doubleClick) { if (CanStick) { SetCardSticked(Card); Client.Instance.SendStickCard("Player", Card.ParentPlayer.pName, Card.ParentPlayer.GetSlotIndex(Card)); } } else { Card.BlinkRed(); } } }