public static void Play() { if (m_modelAnimation.IsPlaying) { return; } StopEffect(); AnimationClip selectAnimationClip = AnimationModel.SelectAnimationClip; if (selectAnimationClip == null) { return; } m_lastTime = EditorApplication.timeSinceStartup; m_playStartTime = m_lastTime; EditorApplication.update += Update; m_modelAnimation.Play(selectAnimationClip); if (m_isNoWeaponClip) { return; } if (m_rightWeaponAnimation != null) { AnimationClip clip = WeaponModel.GetAnimationClip(ModelDataModel.ModelName, m_rightWeapon.name, selectAnimationClip.name); m_rightWeaponAnimation.Play(clip); } if (m_leftWeaponAnimation != null) { AnimationClip clip = WeaponModel.GetAnimationClip(ModelDataModel.ModelName, m_leftWeapon.name, selectAnimationClip.name); m_leftWeaponAnimation.Play(clip); } }
private static void SetWeaponAnimation(bool isRight) { GameObject weapon = isRight ? m_rightWeapon : m_leftWeapon; if (weapon == null) { if (isRight) { m_rightWeaponAnimation = null; } else { m_leftWeaponAnimation = null; } return; } BaseAnimation animation = null; if (WeaponModel.CheckModelHasWeaponClip(ModelDataModel.ModelName, weapon.name)) { SetAnimation(ref animation, WeaponModel.GetGenericState(ModelDataModel.ModelName, weapon.name), weapon); } else { animation = null; } if (isRight) { m_rightWeaponAnimation = animation; } else { m_leftWeaponAnimation = animation; } }
private static void SetWeapon(int index, bool isRight) { string parentNodeName = isRight ? Config.RightWeaponNode : Config.LeftWeaponNode; GameObject weapon = isRight ? m_rightWeapon : m_leftWeapon; string path = WeaponModel.GetWeaponPrefabPath(ModelDataModel.ModelName, index); if (!File.Exists(Tool.ProjectPathToFullPath(path))) { return; } Transform handTransform = Tool.GetTransformByName(m_model, parentNodeName); if (handTransform == null) { return; } if (weapon != null) { Object.DestroyImmediate(weapon); } weapon = LoadPrefab(path); weapon.transform.SetParent(handTransform); Tool.NormalizeTransform(weapon); if (isRight) { m_rightWeapon = weapon; } else { m_leftWeapon = weapon; } SetWeaponAnimation(isRight); }
public static void SetAnimationClipData(int index) { Stop(); ResetDrawHitData(); Tool.NormalizeTransform(m_model); AnimationModel.SetCurrentAnimationClip(index); LuaAnimClipModel.SetCurrentClipName(AnimationModel.SelectAnimationClipName); AnimationClip selectAnimationClip = AnimationModel.SelectAnimationClip; if (selectAnimationClip == null) { m_isNoWeaponClip = true; m_rightWeaponAnimation = null; m_leftWeaponAnimation = null; return; } m_isNoWeaponClip = !WeaponModel.CheckModelHasClip(ModelDataModel.ModelName); SetWeaponAnimation(true); SetWeaponAnimation(false); }
private void WeaponUI(string modelName) { string[] arrayWeaponName = WeaponModel.GetAllWeaponName(modelName); if (arrayWeaponName == null) { return; } SpaceWithLabel(LabelRightWeapon); int[] arrayIndex = WeaponModel.GetAllWeaponNameIndex(modelName); int tempIndex = IntPopup(m_lastRightWeaponIndex, arrayWeaponName, arrayIndex); if (tempIndex != m_lastRightWeaponIndex && tempIndex != Config.ErrorIndex) { m_lastRightWeaponIndex = tempIndex; Controller.SetRightWeapon(m_lastRightWeaponIndex); } SpaceWithLabel(LabelLeftWeapon); tempIndex = IntPopup(m_lastLeftWeaponIndex, arrayWeaponName, arrayIndex); if (tempIndex != m_lastLeftWeaponIndex && tempIndex != Config.ErrorIndex) { m_lastLeftWeaponIndex = tempIndex; Controller.SetLeftWeapon(m_lastLeftWeaponIndex); } }