Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        if (GameManagerScript.instance.getHoveredUnit () != null) {
            unit = GameManagerScript.instance.getHoveredUnit ();
            health.text = "" + unit.getHealth ();
            attack.text = "" + unit.getAttack ();
            defense.text = "" + unit.getDefense ();
            range.text = "" + unit.getRange();
            movement.text = "" + unit.getMovement ();
            if (unitName != null) {
                string unitText = unit.unitType ().ToString();
                unitText = unitText.Substring (2);
                unitName.text = unitText;
            }
            if (unitSprite != null) {
                unitSprite.sprite = unit.gameObject.GetComponent<SpriteRenderer>().sprite;
            }
        }
        else if (GameManagerScript.instance.getFocusedUnit () != null) {
            unit = GameManagerScript.instance.getFocusedUnit ();
            health.text = "" + unit.getHealth ();
            attack.text = "" + unit.getAttack ();
            defense.text = "" + unit.getDefense ();
            range.text = "" + unit.getRange();
            movement.text = "" + unit.getMovement ();
            if (unitName != null) {
                string unitText = unit.unitType ().ToString();
                unitText = unitText.Substring (2);
                unitName.text = unitText;
            }
            if (unitSprite != null) {
                unitSprite.sprite = unit.gameObject.GetComponent<SpriteRenderer>().sprite;
            }
        }

        currency.text = "" + GameManagerScript.instance.getPlayer().getCurrency();
        deckCount.text = "" + GameManagerScript.instance.getDeckCount ();
        discardCount.text = "" + GameManagerScript.instance.getDiscardCount ();
    }