Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
 public static string GetLevelConfigAsset(string assetName)
 {
     return(GlobalTools.Format("Assets/GameMain/Configs/Level/{0}.xml", assetName));
 }
Exemplo n.º 3
0
 public static string GetLevelObjectAsset(string assetName)
 {
     return(GlobalTools.Format("Assets/GameMain/Entities/Level/{0}.prefab", assetName));
 }
Exemplo n.º 4
0
        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));
            }
        }
Exemplo n.º 5
0
 public static string GetSkillScriptAsset(string assetName)
 {
     return(GlobalTools.Format("Assets/GameMain/Configs/ActorSkill/{0}.xml", assetName));
 }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
        public SkillTree FindNextSkillByDist(Vector3 dest)
        {
            float dist = GlobalTools.GetHorizontalDistance(dest, m_Owner.Pos);

            return(FindNextSkillByDist(dist));
        }
Exemplo n.º 8
0
 public static string GetUIFormAsset(string assetName)
 {
     return(GlobalTools.Format("Assets/GameMain/UI/UIForms/{0}.prefab", assetName));
 }
Exemplo n.º 9
0
 public static string GetFairyGuiPackageAsset(string packageName)
 {
     return(GlobalTools.Format("Assets/GameMain/UI/UIPackage/{0}", packageName));
 }
Exemplo n.º 10
0
 public static string GetMusicAsset(string assetName)
 {
     return(GlobalTools.Format("Assets/GameMain/Music/{0}.mp3", assetName));
 }
Exemplo n.º 11
0
 public static string GetSoundAsset(string assetName)
 {
     return(GlobalTools.Format("Assets/GameMain/Sounds/{0}.wav", assetName));
 }
Exemplo n.º 12
0
 public static string GetSceneAsset(string assetName)
 {
     return(GlobalTools.Format("Assets/GameMain/Scenes/{0}.unity", assetName));
 }
Exemplo n.º 13
0
 public static string GetFontAsset(string assetName)
 {
     return(GlobalTools.Format("Assets/GameMain/Localization/{0}/Fonts/{1}.ttf", GameEntry.Localization.Language.ToString(), assetName));
 }
Exemplo n.º 14
0
 public static string GetDictionaryAsset(string assetName)
 {
     return(GlobalTools.Format("Assets/GameMain/Localization/{0}/Dictionaries/{1}.xml", GameEntry.Localization.Language.ToString(), assetName));
 }
Exemplo n.º 15
0
 public Transform GetRidePoint()
 {
     return(GlobalTools.GetBone(CachedTransform, "Bone026"));
 }
Exemplo n.º 16
0
 public static string GetBuffIconAsset(int id)
 {
     return(GlobalTools.Format("Assets/GameMain/Textures/Buff/{0}.png", id));
 }
Exemplo n.º 17
0
 public static Vector3 ReadVector3(XmlNode node)
 {
     return(GlobalTools.ToVector3(node.InnerText, true));
 }
Exemplo n.º 18
0
 public static string GetDataTableAsset(string assetName)
 {
     return(GlobalTools.Format("Assets/GameMain/DataTables/{0}.txt", assetName));
 }
Exemplo n.º 19
0
 public static int Copy(object destination, object source, Type type)
 {
     return(GlobalTools.Copy(destination, source, type, null));
 }
Exemplo n.º 20
0
 public static string GetLuaAsset(string assetName)
 {
     return(GlobalTools.Format("Assets/GameMain/Lua/{0}.txt", assetName));
 }
Exemplo n.º 21
0
 private Transform GetRidePoint()
 {
     return(GlobalTools.GetBone(CacheTransform, "Bone026"));
 }
Exemplo n.º 22
0
 private void LoadTaskScriptByTaskID(ref TaskData data, int pTaskID)
 {
     data.SubTasks.Clear();
     data.Load(GlobalTools.Format("Text/Task/{0}", pTaskID));
 }