void Update() { if (animView == null) { animView = gameObject.GetComponent <MonobitAnimatorView>(); } if (!monobitView.isMine) { return; } foreach (var settings in KeyAndAnimSettings) { DoAction(settings, GetKeyActiveValue(settings)); } }
public void OnDrawGizmos() { _monobitView = GetComponent <MonobitView>(); if (_monobitView == null) { _monobitView = gameObject.AddComponent <MonobitView>(); } Debug.Log("aaa"); //MonobitTransformViewを追加------------------------ MonobitTransformView t = GetComponent <MonobitTransformView>(); if (t == null) { t = gameObject.AddComponent <MonobitEngine.MonobitTransformView>(); } _monobitView.ObservedComponents = new List <Component>(); _monobitView.ObservedComponents.Add(t); //MonobitAnimatorViewを追加------------------------ MonobitAnimatorView a = GetComponent <MonobitAnimatorView>(); if (GetComponent <Animator>() != null && a == null) { a = gameObject.AddComponent <MonobitEngine.MonobitAnimatorView>(); } if (a != null) { _monobitView.ObservedComponents.Add(a); } //自作クラスの実装 var sn = GetComponents <SyncNetWorkBehavior>(); foreach (var snc in sn) { _monobitView.ObservedComponents.Add(snc); } if (_monobitView != null) { _monobitView?.UpdateSerializeViewMethod(); } }
/** * Inspector上のGUI表示. */ public override void OnInspectorGUI() { // 変数の初期化 this.m_View = this.target as MonobitAnimatorView; this.m_View.m_Animator = m_View.GetComponent <Animator>(); this.m_View.m_Controller = m_View.GetAnimController(); if (this.m_View == null) { return; } if (this.m_View.m_Animator == null) { EditorGUILayout.HelpBox("It doesn't have an Animator Component.", MessageType.Warning, true); return; } if (this.m_View.m_Controller == null) { EditorGUILayout.HelpBox("It doesn't have an Animator Controller in Animator Component.", MessageType.Warning, true); return; } // アニメーションレイヤー情報の更新 m_View.UpdateAnimLayer(); // アニメーションパラメータ情報の更新 m_View.UpdateAnimParameter(); // アニメーションレイヤーの設定 AnimLayerSetting(); // アニメーションパラメータの設定 AnimParamSetting(); // データの更新 if (GUI.changed) { serializedObject.ApplyModifiedProperties(); EditorUtility.SetDirty(m_View); MonobitEditor.MarkSceneDirty(); } }
/** * */ public void EntryKeyAndAnim() { if (animView == null) { animView = gameObject.GetComponent <MonobitAnimatorView>(); } if (animView != null && this.KeyAndAnimSettings != null) { List <MonobitAnimatorView.AnimLayerInfo> animLayer = animView.SyncAnimLayers; List <MonobitAnimatorView.AnimParamInfo> animParam = animView.SyncAnimParams; foreach (MonobitPlayerMoveTemplate.MonobitKeySettings settings in this.KeyAndAnimSettings) { for (int i = settings.layerInfo.Count - 1; i >= 0; --i) { bool bFound = false; foreach (var layer in animLayer) { if (layer.m_Name == settings.layerInfo[i].m_Name) { bFound = true; break; } } if (bFound == false) { settings.layerInfo.RemoveAt(i); } } for (int i = settings.paramInfo.Count - 1; i >= 0; --i) { bool bFound = false; foreach (var param in animParam) { if (param.m_Name == settings.paramInfo[i].m_Name) { bFound = true; break; } } if (bFound == false) { settings.paramInfo.RemoveAt(i); } } } foreach (MonobitPlayerMoveTemplate.MonobitKeySettings settings in this.KeyAndAnimSettings) { foreach (MonobitAnimatorView.AnimLayerInfo layer in animLayer) { bool bFound = false; if (settings.layerInfo != null) { foreach (MonobitPlayerMoveTemplate.AnimLayerInfo layerInfo in settings.layerInfo) { if (layer.m_Name == layerInfo.m_Name) { bFound = true; break; } } if (bFound == false) { settings.layerInfo.Add(new MonobitPlayerMoveTemplate.AnimLayerInfo { m_Index = layer.m_Index, m_Name = layer.m_Name, m_animWeight = (animView.m_Animator.isActiveAndEnabled) ? animView.m_Animator.GetLayerWeight(layer.m_Index) : 0.0f }); } } } foreach (MonobitAnimatorView.AnimParamInfo param in animParam) { bool bFound = false; if (settings.paramInfo != null) { foreach (MonobitPlayerMoveTemplate.AnimParamInfo paramInfo in settings.paramInfo) { if (param.m_Name == paramInfo.m_Name) { bFound = true; break; } } if (bFound == false) { switch (param.m_Type) { case MonobitAnimatorView.AnimatorControllerParameterType.Bool: settings.paramInfo.Add(new MonobitPlayerMoveTemplate.AnimParamInfo { m_Type = param.m_Type, m_Name = param.m_Name, m_boolValue = (animView.m_Animator.isActiveAndEnabled) ? animView.m_Animator.GetBool(param.m_Name): false }); break; case MonobitAnimatorView.AnimatorControllerParameterType.Float: settings.paramInfo.Add(new MonobitPlayerMoveTemplate.AnimParamInfo { m_Type = param.m_Type, m_Name = param.m_Name, m_floatValue = (animView.m_Animator.isActiveAndEnabled) ? animView.m_Animator.GetFloat(param.m_Name): 0.0f }); break; case MonobitAnimatorView.AnimatorControllerParameterType.Int: settings.paramInfo.Add(new MonobitPlayerMoveTemplate.AnimParamInfo { m_Type = param.m_Type, m_Name = param.m_Name, m_intValue = (animView.m_Animator.isActiveAndEnabled) ? animView.m_Animator.GetInteger(param.m_Name): 0 }); break; case MonobitAnimatorView.AnimatorControllerParameterType.Trigger: break; } } } } } } }