示例#1
0
        void Transform()
        {
            JObject    data     = JsonConvert.DeserializeObject(param) as JObject;
            GameObject go       = GameObject.Find(actor);
            Vector3    pos      = go.transform.position;
            Quaternion rotation = go.transform.rotation;
            Vector3    scale    = go.transform.localScale;
            float      time     = 0;

            if (null != data.Property("positon"))
            {
                float[] val = GHelper.toFloatArray(data ["positon"].ToString());
                pos = new Vector3(val[0], val[1], val[2]);
            }
            if (null != data.Property("rotation"))
            {
                float[] val = GHelper.toFloatArray(data ["rotation"].ToString());
                rotation = Quaternion.Euler(val[0], val[1], val[2]);
            }
            if (null != data.Property("scale"))
            {
                float[] val = GHelper.toFloatArray(data ["scale"].ToString());
                scale = new Vector3(val[0], val[1], val[2]);
            }
            if (null != data.Property("duration"))
            {
                time = data ["duration"].ToObject <float>();
            }
            GRoot.single.StartCoroutine(TransformAnimation(go, pos, rotation, scale, time));
        }
示例#2
0
        void OnLoadFinish(GameObject go, object param1 = null, object param2 = null, object param3 = null)
        {
            JObject data = param1 as JObject;

            go.tag              = "Sitcom";
            go.name             = actor;
            go.transform.parent = SitcomSystem.single.mount;
            float[] val = GHelper.toFloatArray(data ["position"].ToString());
            go.transform.position = new Vector3(val[0], val[1], val[2]);
            val = GHelper.toFloatArray(data ["rotation"].ToString());
            go.transform.rotation = Quaternion.Euler(val[0], val[1], val[2]);
            if (null != data.Property("scale"))
            {
                val = GHelper.toFloatArray(data ["scale"].ToString());
                go.transform.localScale = new Vector3(val[0], val[1], val[2]);
            }
            else
            {
                go.transform.localScale = Vector3.one;
            }
            RunNextAction();
        }