Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        if (health <= 0)
        {
            health = 0;
        }
        if (type == cardType.Spell && autoUse == false)
        {
            autoUse = true;
        }
        if (extraEffect == cardEffect.None)
        {
            target = cardTarget.None;
        }
        // For UI:
        if (graphicImage != null && graphicHandler != null)
        {
            graphicHandler.sprite = graphicImage;
        }
        if (cardNameHandler != null)
        {
            cardNameHandler.text = cardName;
        }
        if (cardDescriptionHandler != null)
        {
            cardDescriptionHandler.text = cardDescription;
        }
        if (cardDamageHandler != null)
        {
            cardDamageHandler.text = attackDamage.ToString();
        }
        if (cardHealthHandler != null)
        {
            cardHealthHandler.text = health.ToString();
        }
        if (cardEnergyHandler != null)
        {
            cardEnergyHandler.text = energyCost.ToString();
        }

        //// IN THE BATTLEFIELD:
        if (placed == true)
        {
            curDelay += Time.deltaTime;
            if (curDelay >= delay)
            {
                curDelay = 0;
                placed   = false;
                DoEffect();
            }
        }
    }
Esempio n. 2
0
    // Update is called once per frame
    void Update()
    {
        // If our V_CardActions component found a game manager then it means we're in a game.    -_- bad!
        // And if it's true then behave like in game:
        if (cActions.gm)
        {
            if (health <= 0)
            {
                health = 0;
            }
            if (attackDamage <= 0)
            {
                attackDamage = 0;
            }
            if (speed <= 0)
            {
                speed = 0;
            }
            if (energyCost < 0)
            {
                energyCost = 0;
            }
            //stop event cards from staying in play. disable this if we ever have a a lasting event.
            if (type == cardType.Event && autoUse == false)
            {
                autoUse = true;
            }
            if (extraEffect == cardEffect.None)
            {
                target = cardTarget.None;
            }

            //// IN THE BATTLEFIELD:
            if (placed == true)
            {
                curDelay += Time.deltaTime;
                if (curDelay >= delay)
                {
                    curDelay = 0;
                    placed   = false;
                    DoEffect();                    //KEEP THIS FOR ETB EFFECTS
                }
            }
        }

        // For UI:
        if (graphicImage != null && graphicHandler != null)
        {
            graphicHandler.sprite = graphicImage;
        }
        if (cardNameHandler != null)
        {
            cardNameHandler.text = cardName;
        }
        if (cardDescriptionHandler != null)
        {
            cardDescriptionHandler.text = cardDescription;
        }
        if (cardDamageHandler != null)
        {
            cardDamageHandler.text = attackDamage.ToString();
        }
        if (cardHealthHandler != null)
        {
            cardHealthHandler.text = health.ToString();
        }
        if (cardEnergyHandler != null)
        {
            cardEnergyHandler.text = energyCost.ToString();
        }
        if (cardSpeedHandler != null)
        {
            cardSpeedHandler.text = speed.ToString();
        }
        // Disable scripts (including this) when in main menu:
        ///wait why not just have a gamestate enum in the manager???
        if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name == "MainMenu")   //add gamestate to fix this...
        {
            cActions.enabled = false;
            this.enabled     = false;
        }
    }