NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/Gameplay/Level/LevelData.cs

219 lines
6.1 KiB
C#
Raw Normal View History

2023-08-22 19:08:45 +08:00
using Sirenix.OdinInspector;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using UnityEngine;
namespace Gameplay.Level
{
[Serializable]
public class LevelData
{
[Serializable]
public struct Goal
{
public enum GoalType
{
[LabelText("占领")]
Occupy,
[LabelText("撤退")]
FallBack,
[LabelText("歼灭")]
KillAll,
[LabelText("摧毁")]
Destroy,
}
[LabelText("目标")]
public GoalType goalType;
[LabelText("位置"), ShowIf("@this.goalType == GoalType.Occupy || this.goalType == GoalType.FallBack")]
public Vector2Int position;
[LabelText("id"), ShowIf("@this.goalType == GoalType.Destroy")]
[MinValue(1), DefaultValue(1)]
public int id;
}
[Serializable]
public struct StarGoal
{
public enum StarGoalType
{
[LabelText("无伤亡")]
AllAlive,
// 至少使用N个某职业角色
[LabelText("使用某职业")]
LeastJob,
[LabelText("使用某部队")]
LeastFaction,
[LabelText("使用某稀有度")]
LeastRarity,
[LabelText("时间内")]
LeastTime,
}
[LabelText("星级目标")]
public StarGoalType starGoalType;
[LabelText("职业"), ShowIf("@this.starGoalType == StarGoalType.LeastJob")]
public cfg.CharacterCfg.Ejob job;
[LabelText("部队阵营"), ShowIf("@this.starGoalType == StarGoalType.LeastFaction")]
public cfg.CharacterCfg.Efaction faction;
[LabelText("稀有度"), ShowIf("@this.starGoalType == StarGoalType.LeastRarity")]
public int rarity;
[LabelText("最少数量"), ShowIf("@this.starGoalType == StarGoalType.LeastJob " +
"|| this.starGoalType == StarGoalType.LeastFaction " +
"|| this.starGoalType == StarGoalType.LeastRarity")]
[MinValue(1)]
public int count;
[LabelText("时间内(秒)"), ShowIf("@this.starGoalType == StarGoalType.LeastTime")]
[MinValue(1)]
public int time;
}
[Serializable]
public struct FailCondition
{
public enum FailType
{
[LabelText("我方全灭")]
AllDead,
}
[LabelText("失败条件")]
public FailType failType;
}
[Serializable]
public class Stage
{
[LabelText("名称")]
private string name;
[LabelText("描述")]
private string desc;
[LabelText("胜利条件")]
public Goal goal;
[LabelText("失败条件")]
public List<FailCondition> failConditions = new List<FailCondition>(4);
}
public enum WeatherType
{
[LabelText("晴天")]
Sunny,
[LabelText("沙尘暴")]
SandStorm,
[LabelText("雨天")]
Rain,
[LabelText("雪天")]
Snow,
[LabelText("雾天")]
Fog,
}
2023-10-19 15:00:19 +08:00
public enum DayNightType
{
[LabelText("白天")]
Day,
[LabelText("晚上")]
Night,
}
2023-08-22 19:08:45 +08:00
[Serializable]
public class NPCInfo
{
public int id;
public int level;
public Vector2Int position;
[LabelText("AI类型")]
public AIType aIType;
[LabelText("特殊触发AI")]
public AttachAIType attachAIType;
[LabelText("朝向")]
public CharacterToward npcToward;
2023-10-19 15:00:19 +08:00
[LabelText("巡逻信息")]
public List<PatrolInfo> patrolInfos = new List<PatrolInfo>(4);
}
[Serializable]
public class PatrolInfo
{
[HorizontalGroup("PatrolInfo")]
[LabelText("巡逻点位")]
public Vector2Int patrolPoint;
[HorizontalGroup("PatrolInfo")]
[LabelText("等待时间")]
public float waitTime = 0f;
2023-08-22 19:08:45 +08:00
}
public enum CharacterToward
{
TopLeft,
TopRight,
Right,
BottomRight,
BottomLeft,
Left,
}
public enum AIType
{
BasicAI,
FallBackAI,
2023-10-19 15:00:19 +08:00
FallBackIntensifyAI,
2023-08-22 19:08:45 +08:00
OutflankAI,
2023-10-19 15:00:19 +08:00
2023-08-22 19:08:45 +08:00
}
public enum AttachAIType
{
None,
ChainAI,
ProvokeAI,
SpecialBehaviorAI,
}
public LevelData(string id) {
this.id = id;
}
[LabelText("关卡ID")]
public string id;
[Sirenix.OdinInspector.ReadOnly]
[LabelText("地图名称")]
public string mapName;
[LabelText("出战区")]
public int preparingRegionId;
[LabelText("出战区朝向")]
public CharacterToward preparingRegionToward;
[LabelText("撤退区")]
public int fallbackRegionId;
[LabelText("敌方撤退区")]
public int enemyFallbackRegionId;
[LabelText("天气")]
public WeatherType weatherType = WeatherType.Sunny;
2023-10-19 15:00:19 +08:00
[LabelText("昼夜")]
public DayNightType dayNightType = DayNightType.Day;
2023-08-22 19:08:45 +08:00
[LabelText("阶段")]
public List<Stage> stages = new List<Stage>(8);
[LabelText("星级目标")]
public List<StarGoal> starGoals = new List<StarGoal>(8);
[InfoBox("敌人默认朝向为六边形TopLeft以游戏视角的六边形为模板方向")]
[LabelText("敌人")]
public List<NPCInfo> npcInfos = new List<NPCInfo>(16);
}
}