Example #1
0
    public void OnUniqueAbility(string playerName, UniqueAbility ability)
    {
        Broadcast(playerName + " used " + ability.ToString());

        Game.Instance.RegisterAction(() =>
        {
            Game.Instance.ActivateUniqueAbility(playerName, ability);
        });
    }
Example #2
0
    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;
            }
            }
        }
    }