public override void restoreAnimatorRecord(AnimatorRecord record) { for (int i = 0; i < record.parameters.Length; ++i) { AnimatorParamParam a = record.parameters[i]; switch (a.type) { case AnimatorControllerParameterType.Bool: _animator.SetBool(a.nameHash, a.boolValue); break; case AnimatorControllerParameterType.Float: _animator.SetFloat(a.nameHash, a.floatValue); break; case AnimatorControllerParameterType.Int: _animator.SetInteger(a.nameHash, a.intValue); break; case AnimatorControllerParameterType.Trigger: _animator.ResetTrigger(a.name); break; } } if (record.isHoldingBall) { SceneViews.instance.getCurFBScene().ballAttach(this.id); } this.setPosition(record.position); this.setRotation(record.direction); }
public void restoreActorsAnimator(int logicFrameID) { LogicFrameAnimatorRecord record = null; if (!totalFrameRecords.TryGetValue(logicFrameID, out record)) { Debuger.Log("No Actor animator Record????....." + logicFrameID); return; } ball.transform.position = record.ballPosition; Debuger.Log("restoreActorsAnimator " + logicFrameID + " ballPosition:" + record.ballPosition); record.recordActors.forEach(a => { AnimatorRecord entityAnimatorRecord = a.Value; if (entityAnimatorRecord != null) { EntityView view = null; if (sceneEntityList.TryGetValue(a.Key, out view)) { view.restoreAnimatorRecord(entityAnimatorRecord); } } }); //totalFrameRecords.Clear(); }
public override AnimatorRecord createAnimatorRecord() { if (_animator == null) { return(null); } AnimatorRecord newRecord = new AnimatorRecord(); newRecord.stateInfo = _animator.GetCurrentAnimatorStateInfo(0); var length = _animator.parameters.Length; newRecord.parameters = new AnimatorParamParam[length]; for (int i = 0; i < length; ++i) { var animParam = _animator.parameters[i]; AnimatorParamParam param = new AnimatorParamParam(); param.nameHash = animParam.nameHash; param.name = animParam.name; param.type = animParam.type; if (param.type == AnimatorControllerParameterType.Bool) { param.boolValue = _animator.GetBool(param.nameHash); } else if (param.type == AnimatorControllerParameterType.Float) { param.floatValue = _animator.GetFloat(param.nameHash); } else if (param.type == AnimatorControllerParameterType.Int) { param.intValue = _animator.GetInteger(param.nameHash); } newRecord.parameters[i] = param; } newRecord.direction = this.transform.localRotation; newRecord.position = this.getPosition(); newRecord.isHoldingBall = getBallPoint().childCount > 0; return(newRecord); }
public void createRecord(int logicFrameID) { if (!recordingAnimatorState) { return; } //Debuger.Log("createRecord " + logicFrameID); LogicFrameAnimatorRecord record = new LogicFrameAnimatorRecord(); foreach (var item in sceneEntityList) { AnimatorRecord entityAnimatorRecord = item.Value.createAnimatorRecord(); if (entityAnimatorRecord != null) { record.recordActors.Add(item.Value.id, entityAnimatorRecord); } } record.ballPosition = ball.transform.position; totalFrameRecords.Add(logicFrameID, record); }
public virtual void restoreAnimatorRecord(AnimatorRecord record) { }