예제 #1
0
    public Tds_Items GetItems(ItemName vCurName)
    {
        Tds_Items vItemFound = null;

        foreach (Tds_Items vCurItem in vGameManager.vItemsList)
        {
            if (vCurItem.vItemName == vCurName)
            {
                vItemFound = CopyItem(vCurItem);
            }
        }
        return(vItemFound);
    }
예제 #2
0
    //make a TRUE copy of this weapon to be used
    public Tds_Items CopyItem(Tds_Items vOld)
    {
        //copy everything for the weapon
        Tds_Items vNew = new Tds_Items();

        vNew.vItemName   = vOld.vItemName;
        vNew.vName       = vOld.vName;
        vNew.GiveWeapon  = vOld.GiveWeapon;
        vNew.ItemIcon    = vOld.ItemIcon;
        vNew.vWeaponName = vOld.vWeaponName;
        vNew.Usable      = vOld.Usable;
        vNew.vAmmoType   = vOld.vAmmoType;
        vNew.vDmgType    = vOld.vDmgType;

        //return new tds_weapons
        return(vNew);
    }
예제 #3
0
    public void TileDie()
    {
        foreach (ItemName vCurItem in vItemList)
        {
            Tds_Items vNewItem = GetItems(vCurItem);

            //make sure the fabrik item obj exist
            if (vGameManager.vItemObj != null)
            {
                //create the empty item obj
                GameObject vNewItemObj = Instantiate(vGameManager.vItemObj);

                vNewItemObj.transform.position = vRenderer.bounds.center;
                vNewItemObj.transform.parent   = vGameManager.vWorldObj.transform;

                //then modify every component to match the new items
                vNewItemObj.GetComponent <SpriteRenderer>().sprite = vNewItem.ItemIcon;

                if (vNewItem.Usable)
                {
                    //send the items for the instantied obj
                    vNewItemObj.GetComponent <Tds_Loot>().InitialiseLoot(vNewItem, vGameManager);
                }
                else
                {
                    vNewItemObj.GetComponent <Tds_Loot>().enabled = false; //trash item on ground doesn't need tds_loot
                }
            }
        }

        //spawn the debris on the target location
        foreach (GameObject vDebris in vDebrisList)
        {
            //create the empty item obj
            GameObject vNewDebrisobj = Instantiate(vDebris);
            vNewDebrisobj.transform.position = transform.position;
        }

        GameObject.Destroy(this.gameObject);
    }
예제 #4
0
    //loot has the complete list for showing the right result on it's own
    public void InitialiseLoot(Tds_Items vNewItem, Tds_GameManager vTGameManager)
    {
        vGameManager = vTGameManager;
        //get the items
        vItems = vNewItem;

        //show or hide info about weapons
        vDmgLabel  = transform.Find("DmgLabel");
        vDmgValue  = transform.Find("DmgValue");
        vAmmoLabel = transform.Find("AmmoLabel");
        vAmmoValue = transform.Find("AmmoValue");
        vPanel     = transform.Find("Panel");
        vNameValue = transform.Find("Name");

        //item name
        vNameValue.GetComponent <Text>().text = vNewItem.vName;

        //potions infos here

        //check if it's a weapon or a potion
        if (vNewItem.GiveWeapon)
        {
            //item name
            vDmgValue.GetComponent <Image>().sprite  = GetAssocValue(vNewItem.vDmgType);
            vAmmoValue.GetComponent <Image>().sprite = GetAssocValue(vNewItem.vAmmoType);
        }

        //disable everything by default
        vDmgLabel.gameObject.SetActive(false);
        vDmgValue.gameObject.SetActive(false);
        vAmmoLabel.gameObject.SetActive(false);
        vAmmoValue.gameObject.SetActive(false);
        vPanel.gameObject.SetActive(false);
        vNameValue.gameObject.SetActive(false);

        //doens't show the item at first
        ShowItem = false;
    }