public override void OnInspectorGUI() { LevelEvent pElem = target as LevelEvent; MapTriggerType pType = (MapTriggerType)EditorGUILayout.EnumPopup("触发事件类型", pElem.Type); if (pType != pElem.Type) { pElem.Type = pType; pElem.SetName(); } int pTypeId = EditorGUILayout.IntField("触发事件类型ID", pElem.TypeId); if (pTypeId != pElem.TypeId) { pElem.TypeId = pTypeId; pElem.SetName(); } bool pActive = EditorGUILayout.Toggle("激活或者销毁", pElem.Active); if (pActive != pElem.Active) { pElem.Active = pActive; } ConditionRelationType pR1 = (ConditionRelationType)EditorGUILayout.EnumPopup("首次触发条件之间关系", pElem.Relation1); if (pR1 != pElem.Relation1) { pElem.Relation1 = pR1; } float pTriggerDelay = EditorGUILayout.FloatField("触发延迟", pElem.TriggerDelay); if (pElem.TriggerDelay != pTriggerDelay) { pElem.TriggerDelay = pTriggerDelay; } EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("首次触发条件"); if (UnityEngine.GUILayout.Button("添加")) { pElem.Conditions1.Add(new MapEventCondition()); } EditorGUILayout.EndHorizontal(); int pDeleteIndex1 = -1; for (int i = 0; i < pElem.Conditions1.Count; i++) { EditorGUILayout.Space(); EditorGUIUtility.labelWidth = 100; MapEventCondition data = pElem.Conditions1[i]; EditorGUILayout.LabelField("条件" + (i + 1)); EditorGUIUtility.labelWidth = 100; TriggerConditionType p = (TriggerConditionType)EditorGUILayout.EnumPopup("类型", data.Type); if (p != data.Type) { data.Type = p; } EditorGUILayout.BeginHorizontal(); EditorGUIUtility.labelWidth = 100; string s = EditorGUILayout.TextField("参数", data.Args); if (s != data.Args) { data.Args = s; } if (UnityEngine.GUILayout.Button("删除")) { pDeleteIndex1 = i; } EditorGUILayout.EndHorizontal(); } if (pDeleteIndex1 >= 0) { pElem.Conditions1.RemoveAt(pDeleteIndex1); } EditorGUILayout.Space(); EditorGUILayout.Space(); bool pUseTriggerInterval = EditorGUILayout.Toggle("是否间隔触发", pElem.UseIntervalTrigger); if (pElem.UseIntervalTrigger != pUseTriggerInterval) { pElem.UseIntervalTrigger = pUseTriggerInterval; } if (pElem.UseIntervalTrigger == false) { return; } EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("间隔触发条件"); if (UnityEngine.GUILayout.Button("添加")) { pElem.Conditions2.Add(new MapEventCondition()); } EditorGUILayout.EndHorizontal(); int pTriggerNum = EditorGUILayout.IntField("间隔触发次数(<=0代表无限)", pElem.TriggerNum); if (pElem.TriggerNum != pTriggerNum) { pElem.TriggerNum = pTriggerNum; } float pTriggerInterval = EditorGUILayout.FloatField("触发间隔时间", pElem.TriggerInterval); if (pElem.TriggerInterval != pTriggerInterval) { pElem.TriggerInterval = pTriggerInterval; } int pDeleteIndex2 = -1; for (int i = 0; i < pElem.Conditions2.Count; i++) { EditorGUILayout.Space(); MapEventCondition data = pElem.Conditions2[i]; TriggerConditionType p = (TriggerConditionType)EditorGUILayout.EnumPopup(GlobalTools.Format("条件{0}: 类型", i + 1), data.Type); if (p != data.Type) { data.Type = p; } string s = EditorGUILayout.TextField("参数", data.Args); if (s != data.Args) { data.Args = s; } if (UnityEngine.GUILayout.Button("删除")) { pDeleteIndex2 = i; } } if (pDeleteIndex2 >= 0) { pElem.Conditions2.RemoveAt(pDeleteIndex2); } }
public static string GetLevelConfigAsset(string assetName) { return(GlobalTools.Format("Assets/GameMain/Configs/Level/{0}.xml", assetName)); }
public static string GetLevelObjectAsset(string assetName) { return(GlobalTools.Format("Assets/GameMain/Entities/Level/{0}.prefab", assetName)); }
protected override void OnUpdate(IFsm <ActorBase> fsm, float elapseSeconds, float realElapseSeconds) { base.OnUpdate(fsm, elapseSeconds, realElapseSeconds); switch (m_Owner.ActorType) { case ActorType.Monster: { if (m_Owner.Target == null) { return; } float dist = GlobalTools.GetHorizontalDistance(m_Owner.Pos, m_Owner.Target.Pos); if (dist > AI.WaringDist) { ChangeState <AIBackState>(); } else if (dist < AI.AttackDist) { ChangeState <AIFightState>(); return; } } break; case ActorType.Partner: { if (m_Owner.Target?.CachedTransform == null) { ChangeState <AIIdleState>(); return; } float dist = GlobalTools.GetHorizontalDistance(m_Owner.Pos, m_Owner.Target.Pos); if (dist > AI.WaringDist) { ChangeState <AIIdleState>(); return; } else if (dist < AI.AttackDist) { ChangeState <AIFightState>(); return; } } break; case ActorType.Player: { if (m_Owner.Target == null) { ChangeState <AIIdleState>(); return; } float dist = GlobalTools.GetHorizontalDistance(m_Owner.Pos, m_Owner.Target.Pos); if (dist < AI.AttackDist) { ChangeState <AIFightState>(); return; } } break; } if (m_Owner.Target != null) { m_Owner.ExecuteCommand(new AutoMoveCommand(m_Owner.Target)); } }
public static string GetSkillScriptAsset(string assetName) { return(GlobalTools.Format("Assets/GameMain/Configs/ActorSkill/{0}.xml", assetName)); }
public static void Write(TextWriter os, string name, Vector3 x) { string s = GlobalTools.Format("({0},{1},{2})", x.x.ToString("0.00"), x.y.ToString("0.00"), x.z.ToString("0.00")); os.WriteLine("<{0}>{1}</{0}>", name, s); }
public SkillTree FindNextSkillByDist(Vector3 dest) { float dist = GlobalTools.GetHorizontalDistance(dest, m_Owner.Pos); return(FindNextSkillByDist(dist)); }
public static string GetUIFormAsset(string assetName) { return(GlobalTools.Format("Assets/GameMain/UI/UIForms/{0}.prefab", assetName)); }
public static string GetFairyGuiPackageAsset(string packageName) { return(GlobalTools.Format("Assets/GameMain/UI/UIPackage/{0}", packageName)); }
public static string GetMusicAsset(string assetName) { return(GlobalTools.Format("Assets/GameMain/Music/{0}.mp3", assetName)); }
public static string GetSoundAsset(string assetName) { return(GlobalTools.Format("Assets/GameMain/Sounds/{0}.wav", assetName)); }
public static string GetSceneAsset(string assetName) { return(GlobalTools.Format("Assets/GameMain/Scenes/{0}.unity", assetName)); }
public static string GetFontAsset(string assetName) { return(GlobalTools.Format("Assets/GameMain/Localization/{0}/Fonts/{1}.ttf", GameEntry.Localization.Language.ToString(), assetName)); }
public static string GetDictionaryAsset(string assetName) { return(GlobalTools.Format("Assets/GameMain/Localization/{0}/Dictionaries/{1}.xml", GameEntry.Localization.Language.ToString(), assetName)); }
public Transform GetRidePoint() { return(GlobalTools.GetBone(CachedTransform, "Bone026")); }
public static string GetBuffIconAsset(int id) { return(GlobalTools.Format("Assets/GameMain/Textures/Buff/{0}.png", id)); }
public static Vector3 ReadVector3(XmlNode node) { return(GlobalTools.ToVector3(node.InnerText, true)); }
public static string GetDataTableAsset(string assetName) { return(GlobalTools.Format("Assets/GameMain/DataTables/{0}.txt", assetName)); }
public static int Copy(object destination, object source, Type type) { return(GlobalTools.Copy(destination, source, type, null)); }
public static string GetLuaAsset(string assetName) { return(GlobalTools.Format("Assets/GameMain/Lua/{0}.txt", assetName)); }
private Transform GetRidePoint() { return(GlobalTools.GetBone(CacheTransform, "Bone026")); }
private void LoadTaskScriptByTaskID(ref TaskData data, int pTaskID) { data.SubTasks.Clear(); data.Load(GlobalTools.Format("Text/Task/{0}", pTaskID)); }