void AnimationOver() { GlobalData.TimeScale = 1.0f; mSlowMotionProperty = null; GetComponent <LookAt>().enabled = false; GetComponent <CameraMove>().enabled = true; GetComponent <CameraMove>().Reset(); }
bool LoadSlowMotionProperty() { byte[] asset = ResourceManager.Instance.GetXml("SlowMotionProperty"); if (asset == null) { return(false); } TbXmlNode docNode = TbXml.Load(asset).docNode; if (docNode == null) { return(false); } List <TbXmlNode> xmlNodeList = docNode.GetNodes("SlowMotion/Property"); int xmlNodeListLength = xmlNodeList.Count; if (xmlNodeListLength < 1) { return(false); } for (int i = 0; i < xmlNodeListLength; ++i) { TbXmlNode node = xmlNodeList[i] as TbXmlNode; SlowMotionProperty smp = new SlowMotionProperty(); smp.mSlowMotionId = UtilTools.IntParse(node.GetStringValue("ActionId")); smp.mSlowMotionStepList = new List <SlowMotionStep>(); List <TbXmlNode> childNode = node.GetNodes("SlowMotions"); for (int j = 0; j < childNode.Count; ++j) { TbXmlNode child = childNode[j] as TbXmlNode; SlowMotionStep sms = new SlowMotionStep(); sms.mIndex = UtilTools.IntParse(child.GetStringValue("Index")); sms.mTimeScale = UtilTools.FloatParse(child.GetStringValue("TimeScale")); sms.mTime = UtilTools.FloatParse(child.GetStringValue("Time")); sms.mFieldOfView = UtilTools.FloatParse(child.GetStringValue("FieldOfView")); smp.mSlowMotionStepList.Add(sms); } mSlowMotionPropertyDic.Add(smp.mSlowMotionId, smp); } return(true); }
/// <summary> /// 相机动画开始 /// </summary> /// <param name="path"></param> public void Animation(string path) { if (string.IsNullOrEmpty(path)) { return; } mPathArray = iTweenPath.GetPath(path); if (mPathArray == null || mPathArray.Length < 1) { return; } if (ObjectManager.mRole == null) { return; } mRole = ObjectManager.mRole; mRoleBip01 = mRole.mTransform.Find("Bip01/Bip01 Pelvis"); if (mRoleBip01 == null) { return; } mSlowMotionProperty = XmlManager.Instance.GetSlowMotionProperty(10000843); if (mSlowMotionProperty == null) { return; } for (int i = 0; i < mPathArray.Length; ++i) { mPathArray[i] += ObjectManager.mRole.mPosition; Vector3 dir = mPathArray[i] - ObjectManager.mRole.mPosition; dir = ObjectManager.mRole.mTransform.rotation * dir; mPathArray[i] = ObjectManager.mRole.mPosition + dir; } transform.position = mPathArray[0]; GetComponent <CameraMove>().enabled = false; GetComponent <LookAt>().enabled = true; GetComponent <LookAt>().mTarget = mRoleBip01; transform.GetComponent <Camera>().fieldOfView = mSlowMotionProperty.mSlowMotionStepList[0].mFieldOfView; Hashtable table = new Hashtable(); table.Add("position", mPathArray[1]); table.Add("time", mSlowMotionProperty.mSlowMotionStepList[0].mTime); table.Add("ignoretimescale", true); table.Add("onupdate", "FollowBip01"); table.Add("onupdatetarget", gameObject); table.Add("oncomplete", "NextCameraAnimation"); table.Add("oncompletetarget", gameObject); table.Add("oncompleteparams", 2); GlobalData.TimeScale = mSlowMotionProperty.mSlowMotionStepList[0].mTimeScale; }