add:添加基础的角色、装备、buff

master
zxl 2025-02-12 17:53:59 +08:00
parent 537f3504bc
commit 7eace863c7
19 changed files with 328 additions and 3 deletions

3
Assets/Scripts/Buff.meta Normal file
View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b2b24013a50f4b40a164996d624dc0c7
timeCreated: 1739349795

View File

@ -0,0 +1,43 @@
using UnityEngine;
namespace Game
{
public abstract class Buff
{
// 血量、蓝量、攻击力、防御力、攻击速度、回蓝速度、回血速度、
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);
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 8d22c7eb21d24e93bc65a3c9c056e41b
timeCreated: 1739351664

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a2b2459c45520e34b8e78302dfab3e68
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,12 @@
namespace Game
{
public interface ICharacter
{
}
public class Character : ICharacter
{
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 8d1a909b724440269892ef788c3d897d
timeCreated: 1739345661

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 1e01ba4f1da043b3a8b63a01ede13114
timeCreated: 1739341587

View File

@ -0,0 +1,54 @@
namespace Game
{
public enum BuffType
{
Buff,
DeBuff,
// None,
// 加血,
// 加蓝,
// 加攻击力,
// 加防御力,
// 加攻击速度,
// 加回蓝速度,
// 加回血速度,
}
public class BuffConfig
{
/// <summary>
/// Buff ID
/// </summary>
public int BuffId;
/// <summary>
/// Buff名字
/// </summary>
public string BuffName;
/// <summary>
/// Buff类型
/// </summary>
public BuffType BuffType;
/// <summary>
/// 持续时间
/// </summary>
public float Duration;
/// <summary>
/// 每次Tick造成5点伤害
/// </summary>
public float DamagePerTick = 5;
/// <summary>
/// 每1秒Tick一次
/// </summary>
public float TickInterval = 1;
/// <summary>
/// 最大层数
/// </summary>
public int MaxLayerNumber = 1;
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 275425062831452b84de25faf1677ee7
timeCreated: 1739351951

View File

@ -0,0 +1,90 @@
using UnityEngine;
namespace Game
{
/// <summary>
/// 角色配置
/// </summary>
public class CharacterConfig
{
/// <summary>
/// 角色ID
/// </summary>
public int ID;
/// <summary>
/// 名字
/// </summary>
public string Name;
/// <summary>
/// 描述
/// </summary>
public string Description;
/// <summary>
/// 稀有度
/// </summary>
public int Rarity;
/// <summary>
/// 星级
/// </summary>
public int StarLevel;
/// <summary>
/// 最大等级目前最大为3级
/// </summary>
public int MaxLevel;
/// <summary>
/// 血量
/// </summary>
public int Hp;
/// <summary>
/// 最大血量
/// </summary>
public int MaxHp;
/// <summary>
/// 蓝量
/// </summary>
public int Mp;
/// <summary>
/// 最大蓝量
/// </summary>
public int MaxMp;
/// <summary>
/// 攻击力
/// </summary>
public float Attack;
/// <summary>
/// 防御力
/// </summary>
public float Defense;
/// <summary>
/// 移动速度
/// </summary>
public float MoveSpeed;
/// <summary>
/// 攻击速度
/// </summary>
public float AttackSpeed;
/// <summary>
/// 回蓝速度
/// </summary>
public float BluingBackSpeed;
/// <summary>
/// 回血速度
/// </summary>
public float RevitalizeSpeed;
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 4397ae39049342d9a96af9a35f4ba466
timeCreated: 1739340665

View File

@ -0,0 +1,68 @@
using System.Collections.Generic;
namespace Game
{
/// <summary>
/// 装备配置
/// </summary>
public class EquipmentConfig
{
/// <summary>
/// ID
/// </summary>
public int ID;
/// <summary>
/// 名字
/// </summary>
public string Name;
/// <summary>
/// 描述
/// </summary>
public string Description;
/// <summary>
/// 血量
/// </summary>
public int Hp;
/// <summary>
/// 蓝量
/// </summary>
public int Mp;
/// <summary>
/// 攻击力
/// </summary>
public float Attack;
/// <summary>
/// 防御力
/// </summary>
public float Defense;
/// <summary>
/// 移动速度
/// </summary>
public float MoveSpeed;
/// <summary>
/// 攻击速度
/// </summary>
public float AttackSpeed;
/// <summary>
/// 回蓝速度
/// </summary>
public float BluingBackSpeed;
/// <summary>
/// 回血速度
/// </summary>
public float RevitalizeSpeed;
public List<Buff> Buffs;
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 47a7d9b0ed9e47da9853f87dab16a22d
timeCreated: 1739341647

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 3ab4297d58314734b5b7c065c6389429
timeCreated: 1739341138

View File

@ -0,0 +1,23 @@

namespace Game
{
public interface IEquipment
{
public EquipmentConfig Config { get; }
}
public class Equipment: IEquipment
{
private readonly EquipmentConfig _config;
public EquipmentConfig Config => _config;
public Equipment(EquipmentConfig config)
{
_config = config;
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 9d49492e3d874d77bcfd8d0c6f8c9cdf
timeCreated: 1739341157

View File

@ -1,7 +1,7 @@
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
namespace DefaultNamespace namespace Game
{ {
public class GridCellView : MonoBehaviour public class GridCellView : MonoBehaviour
{ {

View File

@ -1,7 +1,7 @@
using System; using System;
using UnityEngine; using UnityEngine;
namespace DefaultNamespace namespace Game
{ {
public interface IGridManager public interface IGridManager
{ {

View File

@ -1,7 +1,7 @@
using System; using System;
using UnityEngine; using UnityEngine;
namespace DefaultNamespace namespace Game
{ {
public interface IGridCell public interface IGridCell
{ {