Example #1
0
        public void loadObjectFromPlanet(ReverieObject obj)
        {
            //obj.assetid, obj.transform,obj._id.Split('/')[1]

            GameObject   parent  = Instantiate(parentTranform, obj.transform.position, Quaternion.identity);
            AssetWrapper wrapper = parent.GetComponent <AssetWrapper>();

            //TODO: organize these better
            // 9 is objects layer
            parent.layer = 9;

            GameObject objcreative = Instantiate(prefabs[int.Parse(obj.assetid)], Vector3.zero, Quaternion.identity);

            objcreative.name                    = obj._id.Split('/')[1];
            objcreative.transform.parent        = parent.transform;
            objcreative.transform.localPosition = Vector3.zero;
            wrapper.content = objcreative;

            obj.obj = parent;
            onSceneObjects.Add(obj);
            wrapper.Init();

            parent.transform.parent     = this.parentScene;
            parent.transform.localScale = obj.transform.scale;
            parent.transform.rotation   = Quaternion.Euler(obj.transform.rotation);

            ReverieTimelineRecorder recorder = parent.GetComponentInChildren <ReverieTimelineRecorder>();

            recorder.objectid = obj._id.Split('/')[1];
        }
Example #2
0
        public void triggerPrefab(int index, ReverieObject obj)
        {
            GameObject   parent  = Instantiate(parentTranform, obj.transform.position, Quaternion.identity);
            AssetWrapper wrapper = parent.GetComponent <AssetWrapper>();

            //TODO: organize these better
            // 9 is objects layer
            parent.layer = 9;

            GameObject objcreative = Instantiate(prefabs[index], Vector3.zero, Quaternion.identity);

            objcreative.name                    = index.ToString();
            objcreative.transform.parent        = parent.transform;
            objcreative.transform.localPosition = Vector3.zero;
            wrapper.content = objcreative;

            obj.obj = parent;
            onSceneObjects.Add(obj);
            wrapper.Init();

            parent.transform.parent = this.parentScene;

            ReverieTimelineRecorder recorder = parent.GetComponentInChildren <ReverieTimelineRecorder>();

            recorder.objectid = obj._id;
        }