diff --git a/Assets/Configs/Buff.meta b/Assets/Configs/Buff.meta new file mode 100644 index 0000000..46fcc03 --- /dev/null +++ b/Assets/Configs/Buff.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7d340dea7ed4bbe49947498a16e3d524 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Editor/CharacterEditor/BuffEditor.cs b/Assets/Scripts/Editor/CharacterEditor/BuffEditor.cs new file mode 100644 index 0000000..9f0fce3 --- /dev/null +++ b/Assets/Scripts/Editor/CharacterEditor/BuffEditor.cs @@ -0,0 +1,47 @@ +using System.IO; +using Game; +using Sirenix.OdinInspector; +using Sirenix.OdinInspector.Editor; +using UnityEditor; +using UnityEngine.Serialization; + +namespace ZEditor +{ + public class BuffEditor : OdinEditorWindow + { + [MenuItem("Game/Editor Buff Editor")] + static void GetWindow() + { + GetWindow("BuffEditor").Show(); + } + + [LabelText("路径")] [FolderPath] public string savePath = "Assets/Configs/Buff"; + + [LabelText("Buff配置")] [ReadOnly] public string title = "Buff配置"; + [LabelText("基本属性")] public BuffConfig Buff = new BuffConfig(); + + [Button("保存Config")] + void SaveConfig() + { + if (!Directory.Exists(savePath)) + Directory.CreateDirectory(savePath); + + if (string.IsNullOrEmpty(Buff.Name)) + return; + + string path = $"{savePath}/{Buff.Name}.asset"; + var config = CreateInstance(); + config.config = Buff; + + AssetDatabase.CreateAsset(config, path); + AssetDatabase.SaveAssets(); + AssetDatabase.Refresh(); + Refresh(); + } + + void Refresh() + { + Buff = new BuffConfig(); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Editor/CharacterEditor/BuffEditor.cs.meta b/Assets/Scripts/Editor/CharacterEditor/BuffEditor.cs.meta new file mode 100644 index 0000000..368f942 --- /dev/null +++ b/Assets/Scripts/Editor/CharacterEditor/BuffEditor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 0d8f3ba130bc46bda35cada586decfac +timeCreated: 1739784075 \ No newline at end of file diff --git a/Assets/Scripts/Editor/CharacterEditor/CharacterEditor.cs b/Assets/Scripts/Editor/CharacterEditor/CharacterEditor.cs index 53e82a2..77906bb 100644 --- a/Assets/Scripts/Editor/CharacterEditor/CharacterEditor.cs +++ b/Assets/Scripts/Editor/CharacterEditor/CharacterEditor.cs @@ -19,7 +19,7 @@ namespace ZEditor [LabelText("路径")] [FolderPath] public string savePath = "Assets/Configs/Character"; [LabelText("英雄配置")] [ReadOnly] public string title = "英雄配置"; - [LabelText("基本属性")] public HeroConfig HeroConfig = new HeroConfig(); + [LabelText("基本属性")] public CharacterConfig HeroConfig = new CharacterConfig(); [Button("保存Config")] void SaveConfig() @@ -31,8 +31,8 @@ namespace ZEditor return; string path = $"{savePath}/{HeroConfig.BasicStats.Name}.asset"; - var config = CreateInstance(); - config.heroConfig = HeroConfig; + var config = CreateInstance(); + config.config = HeroConfig; AssetDatabase.CreateAsset(config, path); AssetDatabase.SaveAssets(); @@ -42,7 +42,7 @@ namespace ZEditor void Refresh() { - HeroConfig = new HeroConfig(); + HeroConfig = new CharacterConfig(); } } diff --git a/Assets/Scripts/Editor/CharacterEditor/EquipmentEditor.cs b/Assets/Scripts/Editor/CharacterEditor/EquipmentEditor.cs index a65f18e..f45c5c8 100644 --- a/Assets/Scripts/Editor/CharacterEditor/EquipmentEditor.cs +++ b/Assets/Scripts/Editor/CharacterEditor/EquipmentEditor.cs @@ -31,7 +31,7 @@ namespace ZEditor string path = $"{savePath}/{Equipment.Name}.asset"; var config = CreateInstance(); - config.equipmentConfig = Equipment; + config.config = Equipment; AssetDatabase.CreateAsset(config, path); AssetDatabase.SaveAssets(); diff --git a/Assets/Scripts/Game/Buff/Buff.cs b/Assets/Scripts/Game/Buff/Buff.cs index e1e0449..04f726e 100644 --- a/Assets/Scripts/Game/Buff/Buff.cs +++ b/Assets/Scripts/Game/Buff/Buff.cs @@ -1,43 +1,52 @@ - +using System.Collections.Generic; using UnityEngine; namespace Game { - public abstract class Buff + public class Buff { - // 血量、蓝量、攻击力、防御力、攻击速度、回蓝速度、回血速度、 - public string BuffName; - public float BuffDuration; // Buff 持续时间(秒) - public float TimeRemaining; // 剩余时间 - public Character ApplyCharacter; + public string Name; // Buff的名称,例如"战士"、"游侠"等 + public string Description; // Buff的描述 + public List Effects; // Buff带来的效果(可以是多个效果) - protected Buff(string buffName, float buffDuration) + public Buff(string name, string description, List effects) { - BuffName = buffName; - BuffDuration = buffDuration; + Name = name; + Description = description; + Effects = effects; } - // Buff 更新,减少剩余时间 - public void Update(float deltaTime) - { - TimeRemaining -= deltaTime; - if (TimeRemaining <= 0) - { - OnBuffExpire(); - } - } // Buff 过期时调用 - - protected virtual void OnBuffExpire() - { - Debug.Log($"{BuffName} expired!"); - } - - // Buff 应用效果 - public abstract void ApplyEffect(Character character); - - // Buff 移除效果 - public abstract void RemoveEffect(Character character); + // // 血量、蓝量、攻击力、防御力、攻击速度、回蓝速度、回血速度、 + // public string BuffName; + // public float BuffDuration; // Buff 持续时间(秒) + // public float TimeRemaining; // 剩余时间 + // public Character ApplyCharacter; + // + // protected Buff(string buffName, float buffDuration) + // { + // BuffName = buffName; + // BuffDuration = buffDuration; + // } + // + // // Buff 更新,减少剩余时间 + // public void Update(float deltaTime) + // { + // TimeRemaining -= deltaTime; + // if (TimeRemaining <= 0) + // { + // OnBuffExpire(); + // } + // } // Buff 过期时调用 + // + // protected virtual void OnBuffExpire() + // { + // Debug.Log($"{BuffName} expired!"); + // } + // + // // Buff 应用效果 + // public abstract void ApplyEffect(Character character); + // + // // Buff 移除效果 + // public abstract void RemoveEffect(Character character); } - - } \ No newline at end of file diff --git a/Assets/Scripts/Game/Buff/FactionBuffManager.cs b/Assets/Scripts/Game/Buff/FactionBuffManager.cs new file mode 100644 index 0000000..5670c60 --- /dev/null +++ b/Assets/Scripts/Game/Buff/FactionBuffManager.cs @@ -0,0 +1,136 @@ +using System.Collections.Generic; + +namespace Game +{ + public class FactionBuffManager + { + private Dictionary activeBuffs; // 激活的buff列表 + + public FactionBuffManager() + { + activeBuffs = new Dictionary(); + } + + // 处理职业或种族buff的激活 + public void CheckBuffs(List characters) + { + Dictionary countByFaction = new Dictionary(); + + // 统计每个职业/种族的数量 + foreach (var character in characters) + { + foreach (var faction in character.Config.Professions) // 职业/种族 + { + if (!countByFaction.ContainsKey(faction)) + { + countByFaction[faction] = 0; + } + + countByFaction[faction]++; + } + } + + // 遍历每个职业/种族,查看是否满足Buff的条件 + foreach (var entry in countByFaction) + { + string factionName = entry.Key; + int count = entry.Value; + + // 如果满足Buff条件,就激活Buff + Buff factionBuff = GetBuffByFaction(factionName, count); + if (factionBuff != null) + { + if (!activeBuffs.ContainsKey(factionName)) + { + activeBuffs.Add(factionName, factionBuff); + ApplyBuffToCharacters(factionBuff, characters); + } + } + else + { + // 如果该buff不再满足条件,则去除 + if (activeBuffs.ContainsKey(factionName)) + { + activeBuffs.Remove(factionName); + RemoveBuffFromCharacters(factionName, characters); + } + } + } + } + + // 根据职业/种族数量获取对应的Buff + private Buff GetBuffByFaction(string factionName, int count) + { + // 你可以根据预设的条件(例如战士类英雄数量达到3个,给全体战士加护甲等)来决定返回哪个Buff + if (factionName == "战士" && count >= 3) + { + return new Buff("战士Buff", "战士增加30%护甲", new List + { + new BuffEffect(BuffEffectType.Armor, 0.3f, true) + }); + } + + return null; + } + + private void ApplyBuffToCharacters(Buff buff, List characters) + { + foreach (var character in characters) + { + // 遍历角色的Factions,如果该角色属于该buff的职业/种族,应用buff + if (character.Config.Professions.Name.Contains(buff.Name)) + { + foreach (var effect in buff.Effects) + { + ApplyEffectToCharacter(effect, character); + } + } + } + } + + private void RemoveBuffFromCharacters(string factionName, List characters) + { + // 遍历角色并移除buff的效果 + foreach (var character in characters) + { + if (character.Config.Professions.Name.Contains(factionName)) + { + foreach (var effect in activeBuffs[factionName].Effects) + { + RemoveEffectFromCharacter(effect, character); + } + } + } + } + + private void ApplyEffectToCharacter(BuffEffect effect, Character character) + { + switch (effect.EffectType) + { + case BuffEffectType.AttackDamage: + character.OtherAttackDamage += + effect.IsPercentage ? character.OtherAttackDamage * effect.Value : effect.Value; + break; + case BuffEffectType.Armor: + character.OtherArmor += effect.IsPercentage ? character.OtherArmor * effect.Value : effect.Value; + break; + // 其他效果的处理逻辑... + } + } + + private void RemoveEffectFromCharacter(BuffEffect effect, Character character) + { + switch (effect.EffectType) + { + case BuffEffectType.AttackDamage: + character.OtherAttackDamage -= + effect.IsPercentage ? character.OtherAttackDamage * effect.Value : effect.Value; + break; + case BuffEffectType.Armor: + character.OtherArmor -= effect.IsPercentage ? character.OtherArmor * effect.Value : effect.Value; + break; + // 其他效果的移除逻辑... + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Game/Buff/FactionBuffManager.cs.meta b/Assets/Scripts/Game/Buff/FactionBuffManager.cs.meta new file mode 100644 index 0000000..472cb04 --- /dev/null +++ b/Assets/Scripts/Game/Buff/FactionBuffManager.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: a8ae173a145949c9a6d40b3976f9eb36 +timeCreated: 1739784251 \ No newline at end of file diff --git a/Assets/Scripts/Game/Character/Character.cs b/Assets/Scripts/Game/Character/Character.cs new file mode 100644 index 0000000..29ead2d --- /dev/null +++ b/Assets/Scripts/Game/Character/Character.cs @@ -0,0 +1,178 @@ +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace Game +{ + public interface ICharacter + { + public int AttackDamage { get; } + public float AttackSpeed { get; } + public int Mana { get; } + public int StartingMana { get; } + public int AttackRange { get; } + public int CriticalHitChance { get; } + public int Armor { get; } + public int MagicResistance { get; } + } + + public class Character : ICharacter + { + private int _level; + CharacterConfig _config; + + public Character(CharacterConfig config) + { + this._config = config; + } + + public int AttackDamage => _config.BasicStats.AttackDamage[_level]; + public float AttackSpeed => _config.BasicStats.AttackSpeed[_level]; + public int Mana => _config.BasicStats.Mana[_level]; + public int StartingMana => _config.BasicStats.StartingMana[_level]; + public int AttackRange => _config.BasicStats.AttackRange[_level]; + public int CriticalHitChance => _config.BasicStats.CriticalHitChance[_level]; + public int Armor => _config.BasicStats.Armor[_level]; + public int MagicResistance => _config.BasicStats.MagicResistance[_level]; + + public CharacterConfig Config => _config; + + // tmp Other + public float OtherAttackDamage; + public float OtherArmor; + + } + + + /// + /// 角色不具备战斗逻辑,所有战斗逻辑由战斗系统完成 + /// 自走棋的角色不具备自动回血功能,只能通过技能buff进行回血 + /// + // public interface ICharacter + // { + // CharacterConfig Config { get; } + // GameObject Go { get; } + // + // string Name { get; } + // string Description { get; } + // int Level { get; } + // float Hp { get; } + // float Mp { get; } + // float Attack { get; } + // float Defense { get; } + // float MoveSpeed { get; } + // float AttackSpeed { get; } + // bool IsDead { get; } + // + // IReadOnlyList Equipments { get; } + // IReadOnlyList Buffs { get; } + // + // bool AddEquipment(IEquipment equipment); + // bool RemoveAllEquipment(out List equipments); + // + // void OnAttack(Character character); + // } + // + // public class Character : ICharacter + // { + // private CharacterConfig _characterConfig; + // private GameObject _go; + // private List _equipments; + // private string _name; + // private string _description; + // private int _level; + // private float _hp; + // private float _mp; + // private float _attack; + // private float _defense; + // private float _moveSpeed; + // private float _attackSpeed; + // + // private float tmphp; + // private float tmpmp; + // private float tmpattack; + // private float tmpdefense; + // private float tmpmoveSpeed; + // private float tmpattackSpeed; + // private IReadOnlyList _buffs; + // + // public CharacterConfig Config => _characterConfig; + // + // public GameObject Go => _go; + // + // public string Name => _name; + // + // public string Description => _description; + // + // public int Level => _level; + // + // public float Hp => _hp + tmphp; + // + // public float Mp => _mp + tmpmp; + // + // public float Attack => _attack + tmpattack; + // + // public float Defense => _defense + tmpdefense; + // + // public float MoveSpeed => _moveSpeed + tmpmoveSpeed; + // + // public float AttackSpeed => _attackSpeed + tmpattackSpeed; + // + // public bool IsDead => _hp <= 0; + // + // public IReadOnlyList Equipments => _equipments; + // + // public IReadOnlyList Buffs => _buffs; + // + // public Character(CharacterConfig characterConfig, GameObject go) + // { + // _characterConfig = characterConfig; + // _go = go; + // _name = _characterConfig.BasicStats.Name; + // _description = _characterConfig.BasicStats.Description; + // // _hp = _characterConfig.MaxHp; + // // _mp = _characterConfig.MaxMp; + // _equipments = new List(); + // } + // + // public bool AddEquipment(IEquipment equipment) + // { + // // if (_equipments.Count >= _characterConfig.MaxEquipmentCount) + // // return false; + // + // _equipments.Add(equipment); + // // tmphp += equipment.Config.Hp; + // // tmpmp += equipment.Config.Mp; + // // tmpattack += equipment.Config.Attack; + // // tmpdefense += equipment.Config.Defense; + // // tmpmoveSpeed += equipment.Config.MoveSpeed; + // // tmpattackSpeed += equipment.Config.AttackSpeed; + // return true; + // } + // + // public bool RemoveAllEquipment(out List equipments) + // { + // equipments = _equipments.ToList(); + // // foreach (var equipment in _equipments) + // // { + // // tmphp -= equipment.Config.Hp; + // // tmpmp -= equipment.Config.Mp; + // // tmpattack -= equipment.Config.Attack; + // // tmpdefense -= equipment.Config.Defense; + // // tmpmoveSpeed -= equipment.Config.MoveSpeed; + // // tmpattackSpeed -= equipment.Config.AttackSpeed; + // // } + // + // _equipments.Clear(); + // return true; + // } + // + // public void OnAttack(Character target) + // { + // foreach (var equipment in _equipments) + // { + // + // } + // } + // } +} \ No newline at end of file diff --git a/Assets/Scripts/Game/Character/ICharacter.cs.meta b/Assets/Scripts/Game/Character/Character.cs.meta similarity index 100% rename from Assets/Scripts/Game/Character/ICharacter.cs.meta rename to Assets/Scripts/Game/Character/Character.cs.meta diff --git a/Assets/Scripts/Game/Character/ICharacter.cs b/Assets/Scripts/Game/Character/ICharacter.cs deleted file mode 100644 index fa5cef1..0000000 --- a/Assets/Scripts/Game/Character/ICharacter.cs +++ /dev/null @@ -1,138 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using UnityEngine; - -namespace Game -{ - /// - /// 角色不具备战斗逻辑,所有战斗逻辑由战斗系统完成 - /// 自走棋的角色不具备自动回血功能,只能通过技能buff进行回血 - /// - public interface ICharacter - { - HeroConfig Config { get; } - GameObject Go { get; } - - string Name { get; } - string Description { get; } - int Level { get; } - float Hp { get; } - float Mp { get; } - float Attack { get; } - float Defense { get; } - float MoveSpeed { get; } - float AttackSpeed { get; } - bool IsDead { get; } - - IReadOnlyList Equipments { get; } - IReadOnlyList Buffs { get; } - - bool AddEquipment(IEquipment equipment); - bool RemoveAllEquipment(out List equipments); - - void OnAttack(Character character); - } - - public class Character : ICharacter - { - private HeroConfig _characterConfig; - private GameObject _go; - private List _equipments; - private string _name; - private string _description; - private int _level; - private float _hp; - private float _mp; - private float _attack; - private float _defense; - private float _moveSpeed; - private float _attackSpeed; - - private float tmphp; - private float tmpmp; - private float tmpattack; - private float tmpdefense; - private float tmpmoveSpeed; - private float tmpattackSpeed; - private IReadOnlyList _buffs; - - public HeroConfig Config => _characterConfig; - - public GameObject Go => _go; - - public string Name => _name; - - public string Description => _description; - - public int Level => _level; - - public float Hp => _hp + tmphp; - - public float Mp => _mp + tmpmp; - - public float Attack => _attack + tmpattack; - - public float Defense => _defense + tmpdefense; - - public float MoveSpeed => _moveSpeed + tmpmoveSpeed; - - public float AttackSpeed => _attackSpeed + tmpattackSpeed; - - public bool IsDead => _hp <= 0; - - public IReadOnlyList Equipments => _equipments; - - public IReadOnlyList Buffs => _buffs; - - public Character(HeroConfig characterConfig, GameObject go) - { - _characterConfig = characterConfig; - _go = go; - _name = _characterConfig.BasicStats.Name; - _description = _characterConfig.BasicStats.Description; - // _hp = _characterConfig.MaxHp; - // _mp = _characterConfig.MaxMp; - _equipments = new List(); - } - - public bool AddEquipment(IEquipment equipment) - { - // if (_equipments.Count >= _characterConfig.MaxEquipmentCount) - // return false; - - _equipments.Add(equipment); - // tmphp += equipment.Config.Hp; - // tmpmp += equipment.Config.Mp; - // tmpattack += equipment.Config.Attack; - // tmpdefense += equipment.Config.Defense; - // tmpmoveSpeed += equipment.Config.MoveSpeed; - // tmpattackSpeed += equipment.Config.AttackSpeed; - return true; - } - - public bool RemoveAllEquipment(out List equipments) - { - equipments = _equipments.ToList(); - // foreach (var equipment in _equipments) - // { - // tmphp -= equipment.Config.Hp; - // tmpmp -= equipment.Config.Mp; - // tmpattack -= equipment.Config.Attack; - // tmpdefense -= equipment.Config.Defense; - // tmpmoveSpeed -= equipment.Config.MoveSpeed; - // tmpattackSpeed -= equipment.Config.AttackSpeed; - // } - - _equipments.Clear(); - return true; - } - - public void OnAttack(Character target) - { - foreach (var equipment in _equipments) - { - - } - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/Game/Config/BuffConfig.cs b/Assets/Scripts/Game/Config/BuffConfig.cs index 81a9f35..d1f889f 100644 --- a/Assets/Scripts/Game/Config/BuffConfig.cs +++ b/Assets/Scripts/Game/Config/BuffConfig.cs @@ -1,55 +1,93 @@ +using System.Collections.Generic; +using Sirenix.OdinInspector; + namespace Game { - public enum BuffType - { - Buff, - DeBuff, - // None, - // 加血, - // 加蓝, - // 加攻击力, - // 加防御力, - // 加攻击速度, - // 加回蓝速度, - // 加回血速度, - } - + // public enum BuffType + // { + // Buff, + // DeBuff, + // // None, + // // 加血, + // // 加蓝, + // // 加攻击力, + // // 加防御力, + // // 加攻击速度, + // // 加回蓝速度, + // // 加回血速度, + // } + // + // [System.Serializable] + // public class BuffConfig + // { + // /// + // /// Buff ID + // /// + // public int BuffId; + // + // /// + // /// Buff名字 + // /// + // public string BuffName; + // + // /// + // /// Buff类型 + // /// + // public BuffType BuffType; + // + // /// + // /// 持续时间 + // /// + // public float Duration; + // + // /// + // /// 每次Tick造成5点伤害 + // /// + // public float DamagePerTick = 5; + // + // /// + // /// 每1秒Tick一次 + // /// + // public float TickInterval = 1; + // + // /// + // /// 最大层数 + // /// + // public int MaxLayerNumber = 1; + // } [System.Serializable] public class BuffConfig { - /// - /// Buff ID - /// - public int BuffId; + [LabelText("Buff的名称")] public string Name; // Buff的名称,例如"战士"、"游侠"等 + [LabelText("Buff的描述")] public string Description; // Buff的描述 + [LabelText("Buff带来的效果(可以是多个效果)")] public List Effects; // Buff带来的效果(可以是多个效果) + } - /// - /// Buff名字 - /// - public string BuffName; + [System.Serializable] + public class BuffEffect + { + [LabelText("效果类型")] public BuffEffectType EffectType; // 增加攻击力、增加生命值等 + [LabelText("效果值,可以是百分比或固定数值")] public float Value; // 效果值,可以是百分比或固定数值 + [LabelText("是否是百分比增益")] public bool IsPercentage; // 是否是百分比增益 - /// - /// Buff类型 - /// - public BuffType BuffType; + public BuffEffect(BuffEffectType effectType, float value, bool isPercentage) + { + EffectType = effectType; + Value = value; + IsPercentage = isPercentage; + } + } - /// - /// 持续时间 - /// - public float Duration; - - /// - /// 每次Tick造成5点伤害 - /// - public float DamagePerTick = 5; - - /// - /// 每1秒Tick一次 - /// - public float TickInterval = 1; - - /// - /// 最大层数 - /// - public int MaxLayerNumber = 1; + public enum BuffEffectType + { + [LabelText("增加攻击力")] AttackDamage = 0, // 增加攻击力 + [LabelText("增加护甲")] Armor, // 增加护甲 + [LabelText("增加魔抗")] MagicResist, // 增加魔抗 + [LabelText("增加生命值")] Health, // 增加生命值 + [LabelText("增加攻击速度")] AttackSpeed, // 增加攻击速度 + [LabelText("增加法术强度")] AbilityPower, // 增加法术强度 + [LabelText("增加暴击几率")] CritChance, // 增加暴击几率 + [LabelText("吸血效果")] Lifesteal, // 吸血效果 + [LabelText("法力恢复")] ManaRegen // 法力恢复 } } \ No newline at end of file diff --git a/Assets/Scripts/Game/Config/BuffConfigObject.cs b/Assets/Scripts/Game/Config/BuffConfigObject.cs index 5398795..aa1b66a 100644 --- a/Assets/Scripts/Game/Config/BuffConfigObject.cs +++ b/Assets/Scripts/Game/Config/BuffConfigObject.cs @@ -1,10 +1,10 @@ -using System.Collections.Generic; +using Sirenix.OdinInspector; using UnityEngine; namespace Game { public class BuffConfigObject : ScriptableObject { - public List configs = new List(); + [LabelText("基本信息")] public BuffConfig config = new BuffConfig(); } } \ No newline at end of file diff --git a/Assets/Scripts/Game/Config/Hero.cs b/Assets/Scripts/Game/Config/CharacterConfig.cs similarity index 93% rename from Assets/Scripts/Game/Config/Hero.cs rename to Assets/Scripts/Game/Config/CharacterConfig.cs index 961b6c6..2cc383b 100644 --- a/Assets/Scripts/Game/Config/Hero.cs +++ b/Assets/Scripts/Game/Config/CharacterConfig.cs @@ -1,8 +1,18 @@ -using System.Collections.Generic; +using System.Collections.Generic; +using Game; using Sirenix.OdinInspector; +using UnityEngine.Serialization; namespace Game { + [System.Serializable] + public class CharacterConfig + { + [LabelText("基本属性")] public BasicStats BasicStats = new BasicStats(); + [LabelText("技能")] public Ability Ability = new Ability(); + [LabelText("职业/羁绊")] public List Professions = new List(); + } + /// /// 基本属性(Basic Stats) /// diff --git a/Assets/Scripts/Game/Config/HeroConfig.cs.meta b/Assets/Scripts/Game/Config/CharacterConfig.cs.meta similarity index 100% rename from Assets/Scripts/Game/Config/HeroConfig.cs.meta rename to Assets/Scripts/Game/Config/CharacterConfig.cs.meta diff --git a/Assets/Scripts/Game/Config/CharacterConfigObject.cs b/Assets/Scripts/Game/Config/CharacterConfigObject.cs new file mode 100644 index 0000000..38b7ee4 --- /dev/null +++ b/Assets/Scripts/Game/Config/CharacterConfigObject.cs @@ -0,0 +1,10 @@ +using Sirenix.OdinInspector; +using UnityEngine; + +namespace Game +{ + public class CharacterConfigObject : ScriptableObject + { + [LabelText("基本信息")] public CharacterConfig config; + } +} \ No newline at end of file diff --git a/Assets/Scripts/Game/Config/HeroConfigObject.cs.meta b/Assets/Scripts/Game/Config/CharacterConfigObject.cs.meta similarity index 100% rename from Assets/Scripts/Game/Config/HeroConfigObject.cs.meta rename to Assets/Scripts/Game/Config/CharacterConfigObject.cs.meta diff --git a/Assets/Scripts/Game/Config/EquipmentConfig.cs b/Assets/Scripts/Game/Config/EquipmentConfig.cs index 5f68fde..45160ec 100644 --- a/Assets/Scripts/Game/Config/EquipmentConfig.cs +++ b/Assets/Scripts/Game/Config/EquipmentConfig.cs @@ -10,7 +10,7 @@ namespace Game [LabelText("装备描述")] public string Description; // 装备描述 [LabelText("装备类型")] public EquipmentType Type; // 装备类型(基础装备、合成装备) [LabelText("装备的属性加成")] public List Stats; // 装备的属性加成(攻击力、生命值等) - [LabelText("装备附带的技能效果")] public List Effects; // 装备附带的技能效果 + [LabelText("装备附带的技能效果")] public List Effects; // 装备附带的技能效果 } /// @@ -55,14 +55,14 @@ namespace Game /// 特效 /// [System.Serializable] - public class Effect + public class EquipmentEffect { [LabelText("特效名称")] public string Name; // 特效名称 [LabelText("特效描述")] public string Description; // 特效描述 - [LabelText("特效类型")] public EffectType EffectType; // 特效类型 + [LabelText("特效类型")] public EquipmentEffectType EffectType; // 特效类型 [LabelText("特效的数值")] public float Value; // 特效的数值 - public Effect(string name, string description, EffectType effectType, float value) + public EquipmentEffect(string name, string description, EquipmentEffectType effectType, float value) { Name = name; Description = description; @@ -74,7 +74,7 @@ namespace Game /// /// 特效类型 /// - public enum EffectType + public enum EquipmentEffectType { [LabelText("攻击")] OnAttack = 0, [LabelText("受伤")] OnHit, diff --git a/Assets/Scripts/Game/Config/EquipmentConfigObject.cs b/Assets/Scripts/Game/Config/EquipmentConfigObject.cs index ff8e200..7b37ce4 100644 --- a/Assets/Scripts/Game/Config/EquipmentConfigObject.cs +++ b/Assets/Scripts/Game/Config/EquipmentConfigObject.cs @@ -1,9 +1,11 @@ +using Sirenix.OdinInspector; using UnityEngine; +using UnityEngine.Serialization; namespace Game { public class EquipmentConfigObject : ScriptableObject { - public EquipmentConfig equipmentConfig; + [LabelText("基本信息")] public EquipmentConfig config; } } \ No newline at end of file diff --git a/Assets/Scripts/Game/Config/Hero.cs.meta b/Assets/Scripts/Game/Config/Hero.cs.meta deleted file mode 100644 index 599a90d..0000000 --- a/Assets/Scripts/Game/Config/Hero.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 467db3e1a96d4773b336e9aee1d8511d -timeCreated: 1739525465 \ No newline at end of file diff --git a/Assets/Scripts/Game/Config/HeroConfig.cs b/Assets/Scripts/Game/Config/HeroConfig.cs deleted file mode 100644 index 8b1b5c1..0000000 --- a/Assets/Scripts/Game/Config/HeroConfig.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Game; -using Sirenix.OdinInspector; - -namespace Game -{ - [System.Serializable] - public class HeroConfig - { - [LabelText("基本属性")] public BasicStats BasicStats = new BasicStats(); - [LabelText("技能")] public Ability Ability = new Ability(); - [LabelText("职业/羁绊")] public Profession Profession = new Profession(); - } -} \ No newline at end of file diff --git a/Assets/Scripts/Game/Config/HeroConfigObject.cs b/Assets/Scripts/Game/Config/HeroConfigObject.cs deleted file mode 100644 index 3ffe97d..0000000 --- a/Assets/Scripts/Game/Config/HeroConfigObject.cs +++ /dev/null @@ -1,9 +0,0 @@ -using UnityEngine; - -namespace Game -{ - public class HeroConfigObject : ScriptableObject - { - public HeroConfig heroConfig; - } -} \ No newline at end of file diff --git a/Assets/Scripts/Game/Equipment/Equipment.cs b/Assets/Scripts/Game/Equipment/Equipment.cs index a998521..617ce28 100644 --- a/Assets/Scripts/Game/Equipment/Equipment.cs +++ b/Assets/Scripts/Game/Equipment/Equipment.cs @@ -8,7 +8,7 @@ namespace Game string Description { get; } EquipmentType Type { get; } List Stats { get; } - List Effects { get; } + List Effects { get; } } public class Equipment : IEquipment @@ -17,16 +17,16 @@ namespace Game private string _description; private EquipmentType _type; private List _stats; - private List _effects; + private List _effects; public string Name => _name; // 装备名称 public string Description => _description; // 装备描述 public EquipmentType Type => _type; // 装备类型(基础装备、合成装备) public List Stats => _stats; // 装备的属性加成(攻击力、生命值等) - public List Effects => _effects; // 装备附带的技能效果 + public List Effects => _effects; // 装备附带的技能效果 public Equipment(string name, string description, EquipmentType type, List stats, - List effects) + List effects) { _name = name; _description = description; diff --git a/Assets/Scripts/Game/Equipment/EquipmentCraftingSystem.cs b/Assets/Scripts/Game/Equipment/EquipmentCraftingSystem.cs index 606e8f1..1aab8fe 100644 --- a/Assets/Scripts/Game/Equipment/EquipmentCraftingSystem.cs +++ b/Assets/Scripts/Game/Equipment/EquipmentCraftingSystem.cs @@ -14,7 +14,7 @@ namespace Game { return new Equipment("巨人杀手", "增加对高生命值单位的伤害", EquipmentType.Composite, new List { new StatModifier(StatType.AttackDamage, 25) }, - new List { new Effect("巨人杀手效果", "对高生命值单位造成额外伤害", EffectType.OnAttack, 0.5f) }); + new List { new EquipmentEffect("巨人杀手效果", "对高生命值单位造成额外伤害", EquipmentEffectType.OnAttack, 0.5f) }); } // 可以加入更多合成配方 return null;