/// <inheritdoc/>
    public bool SetupSerialziedData(SerObjectProperties serData)
    {
        SerCubeProperties serCubeProperties = (SerCubeProperties)serData;

        this.color = serCubeProperties.color;

        CubeUI cui = FindObjectOfType(typeof(CubeUI)) as CubeUI;

        cui.Setup(gameObject, this.color);

        return(true);
    }
Example #2
0
    public virtual bool SetupSerialziedData(SerObjectProperties serData)
    {
        SerLightProperties prop = (SerLightProperties)serData;

        intensity   = prop.intensity;
        range       = prop.range;
        nightOnly   = prop.nightOnly;
        lightColor  = new Color(prop.lightColorR, prop.lightColorG, prop.lightColorB, prop.lightColorA);
        objectColor = new Color(prop.objectColorR, prop.objectColorG, prop.objectColorB, prop.objectColorA);

        GetComponentInChildren <Light>().intensity = intensity;
        GetComponentInChildren <Light>().range     = range;
        GetComponentInChildren <Light>().color     = lightColor;
        transform.GetChild(0).GetComponent <Renderer>().material.color = objectColor;

        return(true);
    }
Example #3
0
    void forLoop(List <SerObject> ls)
    {
        foreach (SerObject ob in ls)
        {
            GameObject obj = (GameObject)Instantiate(Resources.Load(ob.name), new Vector3(-900, 0, -900), Quaternion.identity);
            obj.transform.position    = new Vector3(ob.x, ob.y, ob.z);
            obj.transform.eulerAngles = new Vector3(ob.rotX, ob.rotY, ob.rotZ);
            obj.transform.localScale  = new Vector3(ob.scalX, ob.scalY, ob.scalZ);
            obj.layer = 10;
            obj.GetComponent <BoxCollider>().enabled = true;
            SerBuildableStats bs = ob.sbs;
            if (bs != null)                                                                  //TODO remove hard code.
            {
                obj.GetComponent <BuildableStats>().transparency = (int)ob.sbs.transparency; // Loads in the build stats data.
            }
            else
            {
                List <string> s = new List <string>();
                s.Add("Continue");
                s.Add("Exit to Main Menu");
                WindowUI wui = new WindowUI(WindowImage.WARNING, WindowType.YES_NO, s, "Older Version", "It looks like you are loading this world from an older version of the game. The objects have been updated to the new format. Would you like to continue?", false, 4, ExitDefault.CLOSEOPERATION);
                wui.Display();
            }
            SerObjectProperties serializedObjectProperties = ob.objProperties;
            if (serializedObjectProperties != null)
            {
                // Note: Only one ObjectProperties can exist on an object.
                bool proper = obj.GetComponent <ObjectProperties>().SetupSerialziedData(serializedObjectProperties);
                if (!proper)
                {
                    List <string> s = new List <string>();
                    s.Add("Continue");
                    s.Add("Exit to Main Menu");
                    WindowUI wui = new WindowUI(WindowImage.WARNING, WindowType.YES_NO, s, "Older Version", "It looks like you are loading this world from an older version of the game. The objects have been updated to the new format. Would you like to continue?", false, 4, ExitDefault.CLOSEOPERATION);
                    wui.Display();
                }
            }


            World.objects.Add(obj, ob.name);
        }
    }
 public bool SetupSerialziedData(SerObjectProperties serData)
 {
     return(true);
 }