public float GetWeight()
    {
        if (ObjectHeld != null)
        {
            L2Ram Ram = ObjectHeld.GetComponent("L2Ram") as L2Ram;
            return(Ram.GetWeight());
        }

        return(0f);
    }
Example #2
0
    void OnTriggerEnter(Collider other)
    {
        string idx = other.gameObject.name;

        if (idx[0] >= '1' && idx[0] <= '5')
        {
            // if weight balance hits any of the ram , just show its weight
            L2Ram ram = GameObject.Find("L2Ram" + idx).GetComponent("L2Ram") as L2Ram;
            ram.showText();
        }
    }
Example #3
0
    public float GetTotalWeight()
    {
        float totalWeight = weight;

        foreach (GameObject obj in otherItems)
        {
            if (obj.GetComponent("L2Ram") != null)
            {
                L2Ram tmpRam = obj.GetComponent("L2Ram") as L2Ram;
                totalWeight += tmpRam.GetWeight();
            }
        }
        return(totalWeight);
    }