public static void Remove(MonoEntity cell) { Init(); if (m_CellList.Contains(cell)) { m_CellList.Remove(cell); } }
public GameRangeAttributeInstance(MonoEntity monoCell, GameRangeAttribute attribute) { this.m_MonoCell = monoCell; this.m_GameRangeAttribute = attribute; m_GameAttributeMinModifiersList = new List <GameAttributeModifier>(); m_GameAttributeMaxModifiersList = new List <GameAttributeModifier>(); m_GameAttributeDeltaModifiersList = new List <GameAttributeModifier>(); Current = attribute.Max.Value; }
public static void SetOtherAnimatorSpeed(MonoEntity entity, float speed) { for (int i = 0; i < m_CellList.Count; i++) { if (m_CellList[i]!=entity) { m_CellList[i].SetAnimatorSpeed(speed); } } }
public static void Add(MonoEntity cell,params object[] objs) { Init(); if (!m_CellList.Contains(cell)) { cell.Init(objs); m_CellList.Add(cell); m_CellList.OrderByDescending(m => m.Index); } }
private static void Remove(MonoEntity entity, int index) { if (entity.runTime) { // entity.Entity.RemoveByTypeID(entity.Entity.GetEntityData().componentTypes.ElementAt(index)); // remove = false; } else { entity.Components.RemoveAt(index); remove = false; } }
public static void DrawComponentBox(MonoEntity entity, int index, SerializedProperty prop) { if (index >= entity.ComponentsCount) { return; } EntityGUI.Vertical(EntityGUI.GetColorStyle(entity.ComponentsCount, index), () => { DrawProperty(entity, index, prop); }); if (remove) { Remove(entity, index); } }
private static void DrawProperty(MonoEntity entity, int index, SerializedProperty prop) { var component = entity.Components[index]; if (component == null) { entity.Components = entity.Components.Where(x => x != null).ToList(); return; } EntityGUI.Horizontal(() => { EditorGUILayout.LabelField(component.GetType().Name, EditorStyles.boldLabel); RemoveBtn(); }); EditorGUI.indentLevel++; DrawProperties(prop, true); EditorGUI.indentLevel--; }
private static void DrawEditorMode(MonoEntity entity, int index) { var component = entity.Components[index]; if (component == null) { entity.Components = entity.Components.Where(x => x != null).ToList(); return; } var type = component.GetType(); var fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public); EntityGUI.Horizontal(() => { EditorGUILayout.LabelField($"{type.Name}", EditorStyles.boldLabel); RemoveBtn(); }); foreach (var field in fields) { DrawTypeField(component, field); } }
private void Start() { _monoEntity = GetComponent <MonoEntity>(); }
public static void StopOtherTime(MonoEntity mono, bool value) { MonoBehaviourManager.SetOtherAnimatorSpeed(mono, value?0:1); IsTimeStop = value; }
public static void SetAnimatorSpeed(MonoEntity entity,float speed) { entity.SetAnimatorSpeed(speed); }
List <GameAttributeModifier> m_GameAttributeModifiersList; //附加值 public GameAttributeInstance(MonoEntity monoCell, GameAttribute attribute) { this.m_MonoCell = monoCell; this.m_GameAttribute = attribute; m_GameAttributeModifiersList = new List <GameAttributeModifier>(); }
public MonoAttribute(MonoEntity entity) { this.m_Owner = entity; m_AttributesList = new List <GameAttributeInstance>(); m_RangeAttributesList = new List <GameRangeAttributeInstance>(); }
public override void OnInspectorGUI() { //DrawDefaultInspector(); entity = (MonoEntity)target; if (!entity.runTime) { EditorGUI.BeginChangeCheck(); } worldProviderProperty.objectReferenceValue = EditorGUILayout.ObjectField("World provider", worldProviderProperty.objectReferenceValue, typeof(EcsWorldProvider), false); if (entity.runTime) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.Space(); if (GUILayout.Button(new GUIContent("Kill Entity"), GUILayout.Width(154), GUILayout.Height(24))) { entity.entity.Destroy(); } EditorGUILayout.Space(); EditorGUILayout.EndHorizontal(); } else { EditorGUILayout.BeginHorizontal(); entity.destroyComponent = EditorGUILayout.Toggle("Destroy MonoBeh", entity.destroyComponent); entity.destroyObject = EditorGUILayout.Toggle("Destroy GO", entity.destroyObject); EditorGUILayout.EndHorizontal(); } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Run Time", entity.runTime ? "✔" : "✘", EditorStyles.largeLabel); EditorGUILayout.LabelField($"ID:{entity.entity.GetInternalId().ToString()}"); EditorGUILayout.EndHorizontal(); EntityGUI.Vertical(GUI.skin.box, () => { if (entity.runTime) { if (!entity.entity.IsAlive()) { EditorGUILayout.LabelField("ENTITY DEAD", EditorStyles.whiteLargeLabel); return; } } EntityGUI.Horizontal(() => { EditorGUILayout.LabelField($"ECS Components [{entity.ComponentsCount.ToString()}]", EditorStyles.boldLabel); if (GUILayout.Button(new GUIContent("Clear", "Remove All Components"))) { RemoveAll(); } }); EntityGUI.Horizontal(() => { EditorGUILayout.LabelField("Add Component"); if (GUILayout.Button(new GUIContent("▼"), GUILayout.Width(21), GUILayout.Height(21))) { flowed = !flowed; } }); if (ComponentTypesList.Count > 1) { entity.lastIndex = EditorGUILayout.Popup(entity.lastIndex, ComponentTypesList.GetAllInArray()); } else { ComponentTypesList.Init(); } if (entity.lastIndex != 0) { AddComponent(entity.lastIndex); } EditorGUILayout.BeginVertical(GUI.skin.box); if (!flowed) { DrawComponents(); } EditorGUILayout.EndVertical(); }); if (entity.runTime) { return; } if (EditorGUI.EndChangeCheck()) { EditorUtility.SetDirty(target); serializedObject.ApplyModifiedProperties(); } }