Esempio n. 1
0
    public void SetParams(UnitInitParams unitInit)
    {
        unitName  = unitInit.unitName;
        unitClass = unitInit.unitClass;
        color     = unitInit.color;

        transform.Find("ConfigBox").Find("InfoPanel").Find("UnitName").GetComponent <Text>().text  = unitName;
        transform.Find("ConfigBox").Find("InfoPanel").Find("UnitClass").GetComponent <Text>().text = unitClass.Name();

        foreach (string actionName in unitClass.Actions())
        {
            GameObject action = Instantiate(
                Resources.Load("Actions/" + actionName), Vector3.zero, Quaternion.identity) as GameObject;
            action.transform.parent = GameObject.Find("Actions").transform;
            actionMap.Add(actionName, action.GetComponent <UnitAction>());
        }

        foreach (string stanceName in unitClass.Stances())
        {
            GameObject action = Instantiate(
                Resources.Load("Stances/" + stanceName), Vector3.zero, Quaternion.identity) as GameObject;
            action.transform.parent = GameObject.Find("Actions").transform;
            stanceMap.Add(stanceName, action.GetComponent <Stance>());
        }

        Transform model = transform.Find("ConfigBox").Find("InfoPanel").Find("UnitModel").Find("Body").Find("CharacterModel");

        model.Find("ArmLeft1").GetComponent <Renderer>().material.color  = color;
        model.Find("ArmRight1").GetComponent <Renderer>().material.color = color;
        model.Find("Body1").GetComponent <Renderer>().material.color     = color;

        transform.Find("ConfigBox").Find("InfoPanel").Find("UnitModel").Find("Body").Find("Hats").Find(unitClass.Name()).gameObject.active = true;
    }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        instance = this;
        int i = 0;

        foreach (Transform actionBox in transform.Find("ConfigBox").Find("Actions"))
        {
            actions.Add(unitClass.Actions()[i]);
            i++;
        }

        i = 0;
        foreach (Transform actionBox in transform.Find("ConfigBox").Find("Stances"))
        {
            stances.Add(unitClass.Stances()[i]);
            i++;
        }

        unitConfigs.Add(this);

        Refresh();
    }