Exemplo n.º 1
0
    public IEnumerator PlaySpellCard(string spell)
    {
        var gm = GameManager.Instance;

        switch (spell)
        {
        case "Swap":
            Debug.Log("starting swap");
            yield return(StartCoroutine(gm.selectionManager.getSelectionWithPlayers(2)));

            Debug.Log(gm.selectionManager.points.Count);
            if (gm.selectionManager.points.Count == 2)
            {
                AudioManager.instance.PlaySound("DealCard");
                boardManager.SwapCard(gm.selectionManager.points[0], gm.selectionManager.points[1]);
                BoardManager.Instance.UpdateCards();
            }
            else
            {
                Debug.Log("cancled");
            }
            break;

        case "Rotate":

            Debug.Log("starting rotate");

            yield return(StartCoroutine(gm.selectionManager.getSelectionWithPlayers(1)));

            if (gm.selectionManager.points.Count == 1)
            {
                Debug.Log("here");
                AudioManager.instance.PlaySound("RotateSpellCard");
                boardManager.RotateArrows(gm.selectionManager.points[0]);
                BoardManager.Instance.UpdateCards();
            }
            else
            {
                Debug.Log("cancled");
            }
            break;

        case "Replace2":

            yield return(StartCoroutine(gm.selectionManager.getSelectionNoPlayers(2)));

            if (gm.selectionManager.points.Count == 2)
            {
                AudioManager.instance.PlaySound("DealCard");
                boardManager.Replace2(gm.selectionManager.points[0], gm.selectionManager.points[1]);
                BoardManager.Instance.UpdateCards();
            }
            else
            {
                Debug.Log("cancled");
            }
            break;

        case "Poison":
            AudioManager.instance.PlaySound("Poison");
            //GameManager.Instance.getOtherPlayer(this).takeDamage(5) ;
            Vector3 ApLocation = boardManager.transform.position;
            //GameManager.Instance.getOtherPlayer(this).takeDamage(2);
            statusEffect st = new statusEffect(statusEffecttype.poisoned, 4, 2);
            GameManager.Instance.getOtherPlayer(this).statusEffects.Add(st);

            DamageEffect d = new DamageEffect();
            d.CreatePoisonEffect(PosionEff, handvisual.PlayPreviewSpot.transform.position, GameManager.Instance.getOtherPlayer(GameManager.Instance.CurrentPlayerTurn).hpvis.Box.transform.position);
            StartCoroutine(posionEffekt(PosionImage, st));
            break;

        case "Damage":
            AudioManager.instance.PlaySound("DamageSpellCard");
            Vector3      ApLocation2 = boardManager.transform.position;
            DamageEffect ddd         = new DamageEffect();
            ddd.CreatePoisonEffect(PosionEff, handvisual.PlayPreviewSpot.transform.position, GameManager.Instance.getOtherPlayer(GameManager.Instance.CurrentPlayerTurn).hpvis.Box.transform.position);
            StartCoroutine(damageEffekt());
            break;

        case "Health":
            AudioManager.instance.PlaySound("HealSpellCard");
            DamageEffect dd = new DamageEffect();
            dd.CreatePotionEffect(PotionEff, handvisual.PlayPreviewSpot.transform.position, GameManager.Instance.CurrentPlayerTurn.hpvis.Box.transform.position);
            StartCoroutine(healingEffekt());
            break;

        case "Potion":
            AudioManager.instance.PlaySound("Potion");
            //GameManager.Instance.CurrentPlayerTurn.Hp += 5;
            statusEffect st2 = new statusEffect(statusEffecttype.healing, 3, 2);
            statusEffects.Add(st2);

            DamageEffect dddd = new DamageEffect();
            dddd.CreatePotionEffect(PotionEff, handvisual.PlayPreviewSpot.transform.position, GameManager.Instance.CurrentPlayerTurn.hpvis.Box.transform.position);
            StartCoroutine(potionEffekt(PotionImage, st2));
            break;

        case "Boost":
            AudioManager.instance.PlaySound("BoostSpellCard");
            Debug.Log("Boost");
            ActionPoints++;
            BoardManager.Instance.UpdateCards();
            break;
        }
        Debug.Log("update cards");


        yield return(new WaitForSeconds(0.1f));

        GameManager.Instance.EnableInputs();
    }