Beispiel #1
0
    override public void OnPointerUp(PointerEventData eventData)
    {
        if (longPressActivated)
        {
            animation.Play("shootFireball");
            longPressActivated = false;
        }

        Player.GetComponent <Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezePositionY | RigidbodyConstraints2D.FreezeRotation;
        if (cooldown == 0 && this.interactable)
        {
            if (count == spellCount)
            {
                ManaBarScript.mana -= manaCost;
            }
            if (time < 0.5 || (count < spellCount && count > 0))
            {
                if (pointerDown == true)
                {
                    animation.Play("fireball");
                }
                StartCoroutine(ShootCooldown());
                spellController.castSpell(spellNember, 0);
                count--;
            }

            else if (count == spellCount)
            {
                count = 0;
            }


            if (count > 0)
            {
                shortCooldownActive = true;
                cooldown            = shortCooldown;
            }
            else
            {
                longCooldownActive = true;
                cooldown           = longCooldown;
            }
        }

        pointerDown = false;
        time        = 0;
    }