public void initModelAsync(string modelPath, OnCharacterLoaded callback, object userData, string animationControllerPath = null) { mModelPath = modelPath; mAnimationControllerPath = animationControllerPath; mCharacterLoadedCallback = callback; mUserData = userData; if (!isEmpty(modelPath)) { // 模型节点也就是角色节点,并且将节点挂到角色管理器下 mObjectPool.createObjectAsync(mModelPath, onModelLoaded, mModelTag, null); } }
public void initModel(string modelPath, string animationControllerPath = null) { mModelPath = modelPath; mAnimationControllerPath = animationControllerPath; mCharacterLoadedCallback = null; mUserData = null; if (!isEmpty(modelPath)) { // 模型节点也就是角色节点,并且将节点挂到角色管理器下 onModelLoaded(mObjectPool.createObject(mModelPath, mModelTag), null); afterModelLoaded(); } }
public override void resetProperty() { base.resetProperty(); mBaseData = null; mAvatar = null; mRigidBody = null; mStateMachine = null; mDecisionTree = null; mGUID = 0; mAnimationLenghtList.Clear(); mCharacterType = null; mCharacterLoadedCallback = null; mModelPath = null; mAnimationControllerPath = null; mUserData = null; mModelTag = 0; // mModelLoadCallback不重置 // mModelLoadCallback = null; }
protected void afterModelLoaded() { mCharacterLoadedCallback?.Invoke(this, mUserData); mCharacterLoadedCallback = null; mUserData = null; }