Ejemplo n.º 1
0
    public void SetWeapons(Weapons weapons)
    {
        if (weapons == null)
        {
            _sprite.sprite  = None;
            _ad.text        = 0.ToString();
            _ap.text        = 0.ToString();
            _cd.text        = 0 + "%";
            _effectT.text   = "";
            _effectI.sprite = None;
            Weapons         = null;
            return;
        }

        WeaponsAth otherWeapon = transform.parent.GetChild(1).GetComponent <WeaponsAth>();

        if (otherWeapon.Weapons == weapons)
        {
            otherWeapon.SetWeapons(null);
        }

        Weapons         = weapons;
        _sprite.sprite  = weapons.icon;
        _ad.text        = weapons.PhysicsDamage.ToString();
        _ap.text        = weapons.MagicDamage.ToString();
        _cd.text        = weapons.Cd + "%";
        _effectT.text   = weapons.EffectDamage == 0 ? "" : weapons.EffectDamage.ToString();
        _effectI.sprite = weapons.EffectSprite;
    }
Ejemplo n.º 2
0
    private void Awake()
    {
        Canvas         = GetComponent <Canvas>();
        Canvas.enabled = false;
        Transform t = transform.GetChild(0);

        _otherPotionsT = t.GetChild(0).gameObject;
        _otherWeaponsT = t.GetChild(1).gameObject;
        _otherWeaponsA = _otherWeaponsT.GetComponent <WeaponsAth>();
        _otherPotionsA = _otherPotionsT.GetComponent <PotionsAth>();

        _weapons = t.GetChild(3).GetComponentInChildren <WeaponsAth>();

        _potions    = new PotionsAth[4];
        _potions[0] = t.GetChild(4).GetComponent <PotionsAth>();
        _potions[1] = t.GetChild(5).GetComponent <PotionsAth>();
        _potions[2] = t.GetChild(6).GetComponent <PotionsAth>();
        _potions[3] = t.GetChild(7).GetComponent <PotionsAth>();

        Clear();
    }