Esempio n. 1
0
    public void printGwInfo(Gateway gtw)
    {
        ResourcesManager rm = gameObject.GetComponent<ResourcesManager>();
        this.gtw = gtw;

        player = gameObject.GetComponent<NetworkManager>().getCurrentPlayer();
        string owner = gtw.getOwner();

        GameObject gateway = GameObject.Find("GatewayLabels");
        gateway.transform.FindChild("gw_name").GetComponent<UILabel>().text = gtw.getName();
        gateway.transform.FindChild("gw_type").GetComponent<UILabel>().text = gtw.getType();
        gateway.transform.FindChild("gw_atk").GetComponent<UILabel>().text = gtw.getAtk().ToString();
        gateway.transform.FindChild("gw_def").GetComponent<UILabel>().text = gtw.getDef().ToString();

        GameObject slot1 = GameObject.Find("Slot1");
        GameObject slot2 = GameObject.Find("Slot2");
        GameObject slot3 = GameObject.Find("Slot3");

        if (owner.Equals(player))
        {
            if (gtw.getSlot(0) != "" || gtw.getSlot(0) != "null")
                slot1.GetComponent<SpriteRenderer>().sprite = rm.getSlotImage(gtw.getSlot(0));
            else
                slot1.GetComponent<SpriteRenderer>().sprite = rm.getEmptySlot();

            if (gtw.getSlot(1) != "" || gtw.getSlot(0) != "null")
                slot2.GetComponent<SpriteRenderer>().sprite = rm.getSlotImage(gtw.getSlot(1));
            else
                slot2.GetComponent<SpriteRenderer>().sprite = rm.getEmptySlot();

            if (gtw.getSlot(2) != "" || gtw.getSlot(0) != "null")
                slot3.GetComponent<SpriteRenderer>().sprite = rm.getSlotImage(gtw.getSlot(2));
            else
                slot3.GetComponent<SpriteRenderer>().sprite = rm.getEmptySlot();
        }
        else
        {
            slot1.GetComponent<SpriteRenderer>().sprite = rm.getUnknownSlot();
            slot2.GetComponent<SpriteRenderer>().sprite = rm.getUnknownSlot();
            slot3.GetComponent<SpriteRenderer>().sprite = rm.getUnknownSlot();
        }
    }