private void prePlayMotion(int id, float speed, float startTime, bool isLoop) { int modelID; if ((modelID = _data.avatar != null ? _data.avatar.modelID : -1) <= 0) { return; } _currentMotionID = id; ModelMotionConfig config = findUseMotionConfig(modelID, id); if (config != null) { id = config.id; _currentMotionMaxTime = config.motionTime; } else { _currentMotionMaxTime = MotionConfig.get(id).defaultMotionTime; } _currentMotionUseID = id; _currentMotionSpeed = speed; _currentMotionPassTime = startTime; _currentIsLoop = isLoop; toPlayMotion(id, speed, startTime, isLoop); }
/** 找到可用的动作配置 */ private ModelMotionConfig findUseMotionConfig(int modelID, int id) { ModelMotionConfig config = ModelMotionConfig.get(modelID, id); if (config == null) { int backID; MotionConfig mConfig; if ((mConfig = MotionConfig.get(id)) == null) { return(null); } if ((backID = mConfig.backID) == id) { return(null); } return(findUseMotionConfig(modelID, backID)); } return(config); }
/** 获取当前的模型动作配置 */ public ModelMotionConfig getModelActionConfig() { if (_actionID == -1) { return(null); } return(ModelMotionConfig.get(_unit.avatar.getModelID(), _actionID)); }