1. 添加数值系统 2. 战斗系统
This commit is contained in:
parent
985d01173b
commit
7b57b715d7
@ -0,0 +1,32 @@
|
||||
using Fantasy.Entitas;
|
||||
using TEngine;
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
public class BattleSystem : BaseLogicSys<BattleSystem>,IEventAttributeUpdate
|
||||
{
|
||||
public override bool OnInit()
|
||||
{
|
||||
GameEvent.AddEventListener<AttributeType, float>(IEventAttributeUpdate_Event.AttributeUpdate,
|
||||
AttributeUpdate);
|
||||
return base.OnInit();
|
||||
}
|
||||
|
||||
public override void OnStart()
|
||||
{
|
||||
base.OnStart();
|
||||
}
|
||||
|
||||
public override void OnDestroy()
|
||||
{
|
||||
base.OnDestroy();
|
||||
GameEvent.RemoveEventListener<AttributeType, float>(IEventAttributeUpdate_Event.AttributeUpdate,
|
||||
AttributeUpdate);
|
||||
}
|
||||
|
||||
public void AttributeUpdate(AttributeType attributeType, float value)
|
||||
{
|
||||
Log.Info(attributeType.ToString() + " : " + value);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2e41988cff5945bf996cafcb511ed38c
|
||||
timeCreated: 1744698261
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 30e8f64e12874c63976fa0992492e464
|
||||
timeCreated: 1744689626
|
@ -0,0 +1,22 @@
|
||||
namespace GameLogic
|
||||
{
|
||||
public enum NumericType
|
||||
{
|
||||
/// <summary>
|
||||
/// 基础值添加
|
||||
/// </summary>
|
||||
BaseAdd,
|
||||
/// <summary>
|
||||
/// 基础百分比添加
|
||||
/// </summary>
|
||||
BaseAddPct,
|
||||
/// <summary>
|
||||
/// 最终值添加
|
||||
/// </summary>
|
||||
FinalAdd,
|
||||
/// <summary>
|
||||
/// 最终百分比添加
|
||||
/// </summary>
|
||||
FinalPct
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e58deca923444384b44bc3dea63bab1a
|
||||
timeCreated: 1744689635
|
@ -2,11 +2,12 @@ using Sirenix.OdinInspector;
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
public enum EAttributeType
|
||||
public enum AttributeType
|
||||
{
|
||||
|
||||
None,
|
||||
[LabelText("生命值")]Hp,
|
||||
[LabelText("魔法值")]Mp,
|
||||
[LabelText("攻击力")]Attack,
|
||||
[LabelText("移动速度")]MoveSpeed,
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 27625cf85a714acc9c48a0428d5569c7
|
||||
timeCreated: 1744696274
|
@ -0,0 +1,12 @@
|
||||
using Fantasy.Entitas;
|
||||
using TEngine;
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
|
||||
[EventInterface(EEventGroup.GroupLogic)]
|
||||
public interface IEventAttributeUpdate
|
||||
{
|
||||
void AttributeUpdate(AttributeType attributeType,float value);
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e970508288fb421197b5249dc3ebfe37
|
||||
timeCreated: 1744696279
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 56c4a0e9d7c04144b57e0835916e6693
|
||||
timeCreated: 1744696119
|
@ -0,0 +1,9 @@
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
public class GameAttribute : Entity
|
||||
{
|
||||
public AttributeType AttributeType;
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f59051adf2f14430a39ec492e171d9ec
|
||||
timeCreated: 1744696126
|
@ -0,0 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using Fantasy.Entitas;
|
||||
using GAS.Runtime;
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
public class AttributeComponent : Entity
|
||||
{
|
||||
public readonly Dictionary<int, GameAttribute> Attributes = new Dictionary<int, GameAttribute>();
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
using Fantasy.Entitas;
|
||||
using GAS.Runtime;
|
||||
using UnityEngine;
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
public class CombatUnit : Entity
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 67200439e91a4cebbef820589c225c59
|
||||
timeCreated: 1744688715
|
@ -0,0 +1,16 @@
|
||||
using System.Collections.Generic;
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
public class NumericComponent : Entity
|
||||
{
|
||||
public float Value;
|
||||
public float BaseValue;
|
||||
public float BaseAdd;
|
||||
public float BaseAddPct;
|
||||
public float FinalAdd;
|
||||
public float FinalAddPct;
|
||||
public readonly Dictionary<int,NumericModifyCollection> ModifyCollections = new Dictionary<int,NumericModifyCollection>();
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ca63bb9196664804bb766677aae6a4c5
|
||||
timeCreated: 1744688875
|
@ -0,0 +1,10 @@
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
public class NumericModify : Entity
|
||||
{
|
||||
public float Value;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ffafb053a37346e6b8282b45c13cc455
|
||||
timeCreated: 1744688983
|
@ -0,0 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
public class NumericModifyCollection : Entity
|
||||
{
|
||||
public float TotalValue = 0;
|
||||
public readonly List<NumericModify> Modifiers = new List<NumericModify>();
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 81190edc97fa4d01b00ed5012c8fa95e
|
||||
timeCreated: 1744689104
|
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4e24d18095dde964a835aa9ee0220519
|
||||
guid: e9a676c8c28b8e34a86386a6fae2d6ee
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6c31e74b39dbf604ea6964cd2ea97cc4
|
||||
guid: e4aa22096f74feb4eb25608e1a54dd5f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d35ed0655a094c73be40e9f641335920
|
||||
timeCreated: 1744696112
|
@ -0,0 +1,50 @@
|
||||
using System.Collections.Generic;
|
||||
using Fantasy.Entitas.Interface;
|
||||
using TEngine;
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
|
||||
public class GameAttributeComponentAwakeSystem : AwakeSystem<AttributeComponent>
|
||||
{
|
||||
protected override void Awake(AttributeComponent self)
|
||||
{
|
||||
self.AddAttribute(AttributeType.Hp,1000);
|
||||
self.AddAttribute(AttributeType.Mp,1000);
|
||||
self.AddAttribute(AttributeType.MoveSpeed,100);
|
||||
}
|
||||
}
|
||||
|
||||
public class GameAttributeComponentDestroySystem : DestroySystem<AttributeComponent>
|
||||
{
|
||||
protected override void Destroy(AttributeComponent self)
|
||||
{
|
||||
foreach (var attribute in self.Attributes.Values)
|
||||
{
|
||||
attribute.Dispose();
|
||||
}
|
||||
self.Attributes.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public static class GameAttributeComponentSystem
|
||||
{
|
||||
public static void AddAttribute(this AttributeComponent self, AttributeType attributeType,float baseValue = 0)
|
||||
{
|
||||
if (self.Attributes.TryGetValue((int)attributeType,out var attribute))
|
||||
{
|
||||
Log.Warning($"Attribute {attributeType} already exists.(属性已经存在)");
|
||||
return;
|
||||
}
|
||||
attribute = GameAttributeFactory.Create(attributeType);
|
||||
attribute.SetBase(baseValue);
|
||||
self.Attributes.Add((int)attributeType, attribute);
|
||||
}
|
||||
|
||||
public static GameAttribute GetAttribute(this AttributeComponent self, AttributeType attributeType)
|
||||
{
|
||||
return self.Attributes.GetValueOrDefault((int)attributeType);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 762295776d374735a314b4512e52f2b5
|
||||
timeCreated: 1744696826
|
@ -0,0 +1,14 @@
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
public static class GameAttributeFactory
|
||||
{
|
||||
public static GameAttribute Create(AttributeType attributeType)
|
||||
{
|
||||
var attribute = Entity.Create<GameAttribute>(GameManager.GameScene, true, true);
|
||||
attribute.AttributeType = attributeType;
|
||||
return attribute;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: df3a99798d5e4584ac1b38b72b2ac9ee
|
||||
timeCreated: 1744697416
|
@ -0,0 +1,67 @@
|
||||
using Fantasy.Entitas.Interface;
|
||||
using TEngine;
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
public class AttributeAwakeSystem : AwakeSystem<GameAttribute>
|
||||
{
|
||||
protected override void Awake(GameAttribute self)
|
||||
{
|
||||
self.AddComponent<NumericComponent>();
|
||||
}
|
||||
}
|
||||
|
||||
public class AttributeDestroySystem : DestroySystem<GameAttribute>
|
||||
{
|
||||
protected override void Destroy(GameAttribute self)
|
||||
{
|
||||
self.AttributeType = AttributeType.None;
|
||||
}
|
||||
}
|
||||
|
||||
public static class GameAttributeSystem
|
||||
{
|
||||
public static void SetBase(this GameAttribute self,float baseValue)
|
||||
{
|
||||
self.GetComponent<NumericComponent>().SetBase(NumericType.BaseAdd,baseValue);
|
||||
self.UpdateHandle();
|
||||
|
||||
}
|
||||
|
||||
public static void AddBase(this GameAttribute self, float baseValue)
|
||||
{
|
||||
self.GetComponent<NumericComponent>().AddBase(NumericType.BaseAdd,baseValue);
|
||||
self.UpdateHandle();
|
||||
}
|
||||
|
||||
public static void MinusBase(this GameAttribute self, float baseValue)
|
||||
{
|
||||
self.GetComponent<NumericComponent>().MinusBase(NumericType.BaseAdd,baseValue);
|
||||
self.UpdateHandle();
|
||||
}
|
||||
|
||||
public static void AddModify(this GameAttribute self,NumericType numericType,NumericModify modify)
|
||||
{
|
||||
self.GetComponent<NumericComponent>().AddModify(numericType,modify);
|
||||
self.UpdateHandle();
|
||||
}
|
||||
public static void RemoveModify(this GameAttribute self,NumericType numericType,NumericModify modify)
|
||||
{
|
||||
self.GetComponent<NumericComponent>().RemoveModify(numericType,modify);
|
||||
self.UpdateHandle();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static void UpdateAttribute(this GameAttribute self,AttributeType attributeType, float value)
|
||||
{
|
||||
GameEvent.Get<IEventAttributeUpdate>().AttributeUpdate(attributeType, value);
|
||||
}
|
||||
|
||||
private static void UpdateHandle(this GameAttribute self)
|
||||
{
|
||||
var numericComponent = self.GetComponent<NumericComponent>();
|
||||
self.UpdateAttribute(self.AttributeType, numericComponent.GetValue());
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5f717193353e45928f0089f0b4ba4675
|
||||
timeCreated: 1744696147
|
@ -0,0 +1,42 @@
|
||||
using Fantasy.Entitas.Interface;
|
||||
using TEngine;
|
||||
using UnityEngine;
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
public class CombatUnitAwakeSystem : AwakeSystem<CombatUnit>
|
||||
{
|
||||
protected override void Awake(CombatUnit self)
|
||||
{
|
||||
self.AddComponent<AttributeComponent>();
|
||||
}
|
||||
}
|
||||
|
||||
public class CombatUnitUpdateSystem : UpdateSystem<CombatUnit>
|
||||
{
|
||||
protected override void Update(CombatUnit self)
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.S))
|
||||
{
|
||||
var hp = self.GetComponent<AttributeComponent>().GetAttribute(AttributeType.Hp);
|
||||
|
||||
if (hp == null)
|
||||
{
|
||||
Log.Warning($"Attribute is not exist{hp.AttributeType}");
|
||||
return;
|
||||
}
|
||||
|
||||
var modify = NumericFactory.CreateModify();
|
||||
modify.Value = 20;
|
||||
|
||||
hp.AddModify(NumericType.BaseAddPct, modify);
|
||||
Log.Info("修改生命数值");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class CombatUnitSystem
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1bbafd8f30924b5e9f9847660559c65c
|
||||
timeCreated: 1744698864
|
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: acb10d4e7ff416f4981f2b8f1b0aefc8
|
||||
guid: b61b8b26dc492e141938c4cf5c98978b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
@ -0,0 +1,107 @@
|
||||
using Animancer;
|
||||
using Fantasy.Entitas.Interface;
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
|
||||
public class NumericComponentAwakeSystem : AwakeSystem<NumericComponent>
|
||||
{
|
||||
protected override void Awake(NumericComponent self)
|
||||
{
|
||||
self.Value = 0;
|
||||
self.BaseValue = 0;
|
||||
self.BaseAdd = 0;
|
||||
self.BaseAddPct = 0;
|
||||
self.FinalAdd = 0;
|
||||
self.FinalAddPct = 0;
|
||||
|
||||
self.ModifyCollections.Add((int)NumericType.BaseAdd, NumericFactory.CreateModifyCollection());
|
||||
self.ModifyCollections.Add((int)NumericType.BaseAddPct, NumericFactory.CreateModifyCollection());
|
||||
self.ModifyCollections.Add((int)NumericType.FinalAdd, NumericFactory.CreateModifyCollection());
|
||||
self.ModifyCollections.Add((int)NumericType.FinalPct, NumericFactory.CreateModifyCollection());
|
||||
}
|
||||
}
|
||||
|
||||
public class NumericComponentDestroySystem : DestroySystem<NumericComponent>
|
||||
{
|
||||
protected override void Destroy(NumericComponent self)
|
||||
{
|
||||
self.Value = 0;
|
||||
self.BaseValue = 0;
|
||||
self.BaseAdd = 0;
|
||||
self.BaseAddPct = 0;
|
||||
self.FinalAdd = 0;
|
||||
self.FinalAddPct = 0;
|
||||
|
||||
foreach (var collection in self.ModifyCollections.Values )
|
||||
{
|
||||
collection.Dispose();
|
||||
}
|
||||
self.ModifyCollections.Clear();
|
||||
}
|
||||
}
|
||||
public static class NumericComponentSystem
|
||||
{
|
||||
public static void SetBase(this NumericComponent self,NumericType numericType,float value)
|
||||
{
|
||||
self.BaseValue = value;
|
||||
self.CalculateNumeric();
|
||||
}
|
||||
|
||||
public static void AddBase(this NumericComponent self, NumericType numericType, float value)
|
||||
{
|
||||
self.BaseValue += value;
|
||||
self.CalculateNumeric();
|
||||
}
|
||||
|
||||
public static void MinusBase(this NumericComponent self, NumericType numericType, float value)
|
||||
{
|
||||
self.BaseValue -= value;
|
||||
self.CalculateNumeric();
|
||||
}
|
||||
|
||||
public static void AddModify(this NumericComponent self, NumericType numericType,NumericModify modify)
|
||||
{
|
||||
var value = self.ModifyCollections[(int)numericType].AddModify(modify);
|
||||
SetNumericParameters(self, numericType, value);
|
||||
}
|
||||
|
||||
public static void RemoveModify(this NumericComponent self, NumericType numericType, NumericModify modify)
|
||||
{
|
||||
var value = self.ModifyCollections[(int)numericType].RemoveModify(modify);
|
||||
if(numericType == NumericType.BaseAdd) self.BaseAdd = value;
|
||||
if(numericType == NumericType.BaseAddPct) self.BaseAddPct = value;
|
||||
if(numericType == NumericType.FinalAdd) self.FinalAdd = value;
|
||||
if(numericType == NumericType.BaseAddPct) self.BaseAddPct = value;
|
||||
self.CalculateNumeric();
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static void SetNumericParameters(NumericComponent self, NumericType numericType, float value)
|
||||
{
|
||||
if(numericType == NumericType.BaseAdd) self.BaseAdd = value;
|
||||
if(numericType == NumericType.BaseAddPct) self.BaseAddPct = value;
|
||||
if(numericType == NumericType.FinalAdd) self.FinalAdd = value;
|
||||
if(numericType == NumericType.BaseAddPct) self.BaseAddPct = value;
|
||||
self.CalculateNumeric();
|
||||
}
|
||||
private static void CalculateNumeric(this NumericComponent self)
|
||||
{
|
||||
var baseValue =(self.BaseValue + self.BaseAdd) * (100 + self.BaseAddPct) / 100f;
|
||||
var finalValue = (baseValue + self.FinalAdd) * (100 + self.FinalAddPct) / 100f;
|
||||
self.Value = finalValue;
|
||||
}
|
||||
|
||||
|
||||
public static float GetValue(this NumericComponent self)
|
||||
{
|
||||
return self.Value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 68517455694e4d179c4e75295a1ff290
|
||||
timeCreated: 1744689616
|
@ -0,0 +1,20 @@
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
public static class NumericFactory
|
||||
{
|
||||
public static NumericModifyCollection CreateModifyCollection()
|
||||
{
|
||||
var collection = Entity.Create<NumericModifyCollection>(GameManager.GameScene,false,false);
|
||||
return collection;
|
||||
}
|
||||
|
||||
public static NumericModify CreateModify()
|
||||
{
|
||||
var modify = Entity.Create<NumericModify>(GameManager.GameScene,true,true);
|
||||
return modify;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5a58c981254c4ea7b67355e475c25985
|
||||
timeCreated: 1744695167
|
@ -0,0 +1,29 @@
|
||||
namespace GameLogic
|
||||
{
|
||||
public static class NumericModifyCollectionSystem
|
||||
{
|
||||
|
||||
public static float AddModify(this NumericModifyCollection self,NumericModify numericModify)
|
||||
{
|
||||
self.Modifiers.Add(numericModify);
|
||||
CalculateValue(self);
|
||||
return self.TotalValue;
|
||||
}
|
||||
public static float RemoveModify(this NumericModifyCollection self, NumericModify numericModify)
|
||||
{
|
||||
self.Modifiers.Remove(numericModify);
|
||||
CalculateValue(self);
|
||||
return self.TotalValue;
|
||||
}
|
||||
private static void CalculateValue(this NumericModifyCollection self)
|
||||
{
|
||||
self.TotalValue = 0;
|
||||
foreach (var modify in self.Modifiers)
|
||||
{
|
||||
self.TotalValue += modify.Value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6605a7d28bc04814b5da01523ec935fd
|
||||
timeCreated: 1744689192
|
@ -0,0 +1,12 @@
|
||||
using Fantasy.Entitas.Interface;
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
public class NumericModifyDestroySystem : DestroySystem<NumericModify>
|
||||
{
|
||||
protected override void Destroy(NumericModify self)
|
||||
{
|
||||
self.Value = 0;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e81986e5ada54a62adf92c09ec1b2b53
|
||||
timeCreated: 1744701940
|
@ -1,19 +0,0 @@
|
||||
using GAS.Runtime;
|
||||
using UnityEngine;
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
public class Fire : AbstractAbility<FireAsset>
|
||||
{
|
||||
|
||||
public GameObject m_bulletPrefab => AbilityAsset.m_bulletPrefab;
|
||||
public Fire(FireAsset abilityAsset) : base(abilityAsset)
|
||||
{
|
||||
}
|
||||
|
||||
public override AbilitySpec CreateSpec(AbilitySystemComponent owner)
|
||||
{
|
||||
return new FireSpec(this, owner); // 对应下文Fire的AbilitySpec
|
||||
}
|
||||
}
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 217d9cb626844b44a82164647f7e5824
|
@ -1,14 +0,0 @@
|
||||
using System;
|
||||
using GAS.Runtime;
|
||||
using UnityEngine;
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
public class FireAsset : AbilityAsset
|
||||
{
|
||||
|
||||
public GameObject m_bulletPrefab;
|
||||
public override Type AbilityType() => typeof(Fire);
|
||||
|
||||
}
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6824f0c9f4933ff4c8137122a38997dd
|
@ -1,31 +0,0 @@
|
||||
using GAS.Runtime;
|
||||
using UnityEngine;
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
public class FireSpec : AbilitySpec<Fire>
|
||||
{
|
||||
public FireSpec(Fire ability, AbilitySystemComponent owner) : base(ability, owner)
|
||||
{
|
||||
}
|
||||
|
||||
public override void ActivateAbility(params object[] args)
|
||||
{
|
||||
|
||||
var bullet = Object.Instantiate(Data.m_bulletPrefab).GetComponent<AS_Bullet>();
|
||||
var transform = Owner.transform;
|
||||
//bullet.InitAttack();
|
||||
TryEndAbility();
|
||||
}
|
||||
|
||||
public override void CancelAbility()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void EndAbility()
|
||||
{
|
||||
//throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8ecd860ce3143ad43842b9ffa20084f9
|
@ -1,44 +0,0 @@
|
||||
///////////////////////////////////
|
||||
//// This is a generated file. ////
|
||||
//// Do not modify it. ////
|
||||
///////////////////////////////////
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
namespace GAS.Runtime
|
||||
{
|
||||
public static class AbilitySystemComponentExtension
|
||||
{
|
||||
public static Type[] PresetAttributeSetTypes(this AbilitySystemComponent asc)
|
||||
{
|
||||
if (asc.Preset == null) return null;
|
||||
var attrSetTypes = new Type[asc.Preset.AttributeSets.Length];
|
||||
for (var i = 0; i < asc.Preset.AttributeSets.Length; i++)
|
||||
attrSetTypes[i] = GAttrSetLib.AttrSetTypeDict[asc.Preset.AttributeSets[i]];
|
||||
return attrSetTypes;
|
||||
}
|
||||
|
||||
public static GameplayTag[] PresetBaseTags(this AbilitySystemComponent asc)
|
||||
{
|
||||
if (asc.Preset == null) return null;
|
||||
return asc.Preset.BaseTags;
|
||||
}
|
||||
|
||||
public static void InitWithPreset(this AbilitySystemComponent asc, int level, AbilitySystemComponentPreset preset = null)
|
||||
{
|
||||
if (preset != null) asc.SetPreset(preset);
|
||||
if (asc.Preset == null) return;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
if (asc.Preset.BaseAbilities != null && asc.Preset.BaseAbilities.Any(x => x == null))
|
||||
{
|
||||
Debug.LogWarning($"BaseAbilities contains null in preset: {asc.Preset.name}");
|
||||
}
|
||||
#endif
|
||||
|
||||
asc.Init(asc.PresetBaseTags(), asc.PresetAttributeSetTypes(), asc.Preset.BaseAbilities, level);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6992ebd7ea621634a80aca4770919b2e
|
@ -1,34 +0,0 @@
|
||||
///////////////////////////////////
|
||||
//// This is a generated file. ////
|
||||
//// Do not modify it. ////
|
||||
///////////////////////////////////
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace GAS.Runtime
|
||||
{
|
||||
public static class GAbilityLib
|
||||
{
|
||||
public struct AbilityInfo
|
||||
{
|
||||
public string Name;
|
||||
public string AssetPath;
|
||||
public Type AbilityClassType;
|
||||
}
|
||||
|
||||
public static AbilityInfo Bomb = new AbilityInfo { Name = "Bomb", AssetPath = "Assets/AssetRaw/Configs/GAS/GameplayAbilityLib/Bomb.asset",AbilityClassType = typeof(GAS.Runtime.TimelineAbility) };
|
||||
|
||||
public static AbilityInfo Fire = new AbilityInfo { Name = "Fire", AssetPath = "Assets/AssetRaw/Configs/GAS/GameplayAbilityLib/Fire.asset",AbilityClassType = typeof(GameLogic.Fire) };
|
||||
|
||||
public static AbilityInfo Sweep = new AbilityInfo { Name = "Sweep", AssetPath = "Assets/AssetRaw/Configs/GAS/GameplayAbilityLib/Sweep.asset",AbilityClassType = typeof(GAS.Runtime.TimelineAbility) };
|
||||
|
||||
|
||||
public static Dictionary<string, AbilityInfo> AbilityMap = new Dictionary<string, AbilityInfo>
|
||||
{
|
||||
["Bomb"] = Bomb,
|
||||
["Fire"] = Fire,
|
||||
["Sweep"] = Sweep,
|
||||
};
|
||||
}
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: df6bef22cd394324688e0bf862d9f41f
|
@ -1,41 +0,0 @@
|
||||
///////////////////////////////////
|
||||
//// This is a generated file. ////
|
||||
//// Do not modify it. ////
|
||||
///////////////////////////////////
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace GAS.Runtime
|
||||
{
|
||||
public static class GAttrLib
|
||||
{
|
||||
/// <summary>
|
||||
/// 生命值
|
||||
/// </summary>
|
||||
public const string HP = "HP";
|
||||
|
||||
/// <summary>
|
||||
/// 移动速度
|
||||
/// </summary>
|
||||
public const string Speed = "Speed";
|
||||
|
||||
/// <summary>
|
||||
/// 攻击力
|
||||
/// </summary>
|
||||
public const string Attack = "Attack";
|
||||
|
||||
/// <summary>
|
||||
/// 魔法值
|
||||
/// </summary>
|
||||
public const string MP = "MP";
|
||||
|
||||
// For facilitating the creation of a Value Dropdown in the editor.
|
||||
public static List<string> AttributeNames = new List<string>()
|
||||
{
|
||||
"HP",
|
||||
"Speed",
|
||||
"Attack",
|
||||
"MP",
|
||||
};
|
||||
}
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 84494e6afc8339a48914aa0cced3aa46
|
@ -1,315 +0,0 @@
|
||||
///////////////////////////////////
|
||||
//// This is a generated file. ////
|
||||
//// Do not modify it. ////
|
||||
///////////////////////////////////
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace GAS.Runtime
|
||||
{
|
||||
public class AS_Bullet : AttributeSet
|
||||
{
|
||||
#region Attack
|
||||
|
||||
/// <summary>
|
||||
/// 攻击力
|
||||
/// </summary>
|
||||
public AttributeBase Attack { get; } = new ("AS_Bullet", "Attack", 0f, CalculateMode.Stacking, (SupportedOperation)31, 0, 150);
|
||||
|
||||
public void InitAttack(float value)
|
||||
{
|
||||
Attack.SetBaseValue(value);
|
||||
Attack.SetCurrentValue(value);
|
||||
}
|
||||
|
||||
public void SetCurrentAttack(float value)
|
||||
{
|
||||
Attack.SetCurrentValue(value);
|
||||
}
|
||||
|
||||
public void SetBaseAttack(float value)
|
||||
{
|
||||
Attack.SetBaseValue(value);
|
||||
}
|
||||
|
||||
public void SetMinAttack(float value)
|
||||
{
|
||||
Attack.SetMinValue(value);
|
||||
}
|
||||
|
||||
public void SetMaxAttack(float value)
|
||||
{
|
||||
Attack.SetMaxValue(value);
|
||||
}
|
||||
|
||||
public void SetMinMaxAttack(float min, float max)
|
||||
{
|
||||
Attack.SetMinMaxValue(min, max);
|
||||
}
|
||||
|
||||
#endregion Attack
|
||||
|
||||
public override AttributeBase this[string key]
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case "Attack":
|
||||
return Attack;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public override string[] AttributeNames { get; } =
|
||||
{
|
||||
"Attack",
|
||||
};
|
||||
|
||||
public override void SetOwner(AbilitySystemComponent owner)
|
||||
{
|
||||
_owner = owner;
|
||||
Attack.SetOwner(owner);
|
||||
}
|
||||
|
||||
public static class Lookup
|
||||
{
|
||||
public const string Attack = "AS_Bullet.Attack";
|
||||
}
|
||||
}
|
||||
|
||||
public class AS_Fight : AttributeSet
|
||||
{
|
||||
#region Attack
|
||||
|
||||
/// <summary>
|
||||
/// 攻击力
|
||||
/// </summary>
|
||||
public AttributeBase Attack { get; } = new ("AS_Fight", "Attack", 0f, CalculateMode.Stacking, (SupportedOperation)31, 0, 150);
|
||||
|
||||
public void InitAttack(float value)
|
||||
{
|
||||
Attack.SetBaseValue(value);
|
||||
Attack.SetCurrentValue(value);
|
||||
}
|
||||
|
||||
public void SetCurrentAttack(float value)
|
||||
{
|
||||
Attack.SetCurrentValue(value);
|
||||
}
|
||||
|
||||
public void SetBaseAttack(float value)
|
||||
{
|
||||
Attack.SetBaseValue(value);
|
||||
}
|
||||
|
||||
public void SetMinAttack(float value)
|
||||
{
|
||||
Attack.SetMinValue(value);
|
||||
}
|
||||
|
||||
public void SetMaxAttack(float value)
|
||||
{
|
||||
Attack.SetMaxValue(value);
|
||||
}
|
||||
|
||||
public void SetMinMaxAttack(float min, float max)
|
||||
{
|
||||
Attack.SetMinMaxValue(min, max);
|
||||
}
|
||||
|
||||
#endregion Attack
|
||||
|
||||
#region HP
|
||||
|
||||
/// <summary>
|
||||
/// 生命值
|
||||
/// </summary>
|
||||
public AttributeBase HP { get; } = new ("AS_Fight", "HP", 0f, CalculateMode.Stacking, (SupportedOperation)31, 0, 10000);
|
||||
|
||||
public void InitHP(float value)
|
||||
{
|
||||
HP.SetBaseValue(value);
|
||||
HP.SetCurrentValue(value);
|
||||
}
|
||||
|
||||
public void SetCurrentHP(float value)
|
||||
{
|
||||
HP.SetCurrentValue(value);
|
||||
}
|
||||
|
||||
public void SetBaseHP(float value)
|
||||
{
|
||||
HP.SetBaseValue(value);
|
||||
}
|
||||
|
||||
public void SetMinHP(float value)
|
||||
{
|
||||
HP.SetMinValue(value);
|
||||
}
|
||||
|
||||
public void SetMaxHP(float value)
|
||||
{
|
||||
HP.SetMaxValue(value);
|
||||
}
|
||||
|
||||
public void SetMinMaxHP(float min, float max)
|
||||
{
|
||||
HP.SetMinMaxValue(min, max);
|
||||
}
|
||||
|
||||
#endregion HP
|
||||
|
||||
#region MP
|
||||
|
||||
/// <summary>
|
||||
/// 魔法值
|
||||
/// </summary>
|
||||
public AttributeBase MP { get; } = new ("AS_Fight", "MP", 0f, CalculateMode.Stacking, (SupportedOperation)31, 0, 1000);
|
||||
|
||||
public void InitMP(float value)
|
||||
{
|
||||
MP.SetBaseValue(value);
|
||||
MP.SetCurrentValue(value);
|
||||
}
|
||||
|
||||
public void SetCurrentMP(float value)
|
||||
{
|
||||
MP.SetCurrentValue(value);
|
||||
}
|
||||
|
||||
public void SetBaseMP(float value)
|
||||
{
|
||||
MP.SetBaseValue(value);
|
||||
}
|
||||
|
||||
public void SetMinMP(float value)
|
||||
{
|
||||
MP.SetMinValue(value);
|
||||
}
|
||||
|
||||
public void SetMaxMP(float value)
|
||||
{
|
||||
MP.SetMaxValue(value);
|
||||
}
|
||||
|
||||
public void SetMinMaxMP(float min, float max)
|
||||
{
|
||||
MP.SetMinMaxValue(min, max);
|
||||
}
|
||||
|
||||
#endregion MP
|
||||
|
||||
#region Speed
|
||||
|
||||
/// <summary>
|
||||
/// 移动速度
|
||||
/// </summary>
|
||||
public AttributeBase Speed { get; } = new ("AS_Fight", "Speed", 0f, CalculateMode.Stacking, (SupportedOperation)31, 0, 3.402823E+38f);
|
||||
|
||||
public void InitSpeed(float value)
|
||||
{
|
||||
Speed.SetBaseValue(value);
|
||||
Speed.SetCurrentValue(value);
|
||||
}
|
||||
|
||||
public void SetCurrentSpeed(float value)
|
||||
{
|
||||
Speed.SetCurrentValue(value);
|
||||
}
|
||||
|
||||
public void SetBaseSpeed(float value)
|
||||
{
|
||||
Speed.SetBaseValue(value);
|
||||
}
|
||||
|
||||
public void SetMinSpeed(float value)
|
||||
{
|
||||
Speed.SetMinValue(value);
|
||||
}
|
||||
|
||||
public void SetMaxSpeed(float value)
|
||||
{
|
||||
Speed.SetMaxValue(value);
|
||||
}
|
||||
|
||||
public void SetMinMaxSpeed(float min, float max)
|
||||
{
|
||||
Speed.SetMinMaxValue(min, max);
|
||||
}
|
||||
|
||||
#endregion Speed
|
||||
|
||||
public override AttributeBase this[string key]
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case "HP":
|
||||
return HP;
|
||||
case "Speed":
|
||||
return Speed;
|
||||
case "Attack":
|
||||
return Attack;
|
||||
case "MP":
|
||||
return MP;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public override string[] AttributeNames { get; } =
|
||||
{
|
||||
"HP",
|
||||
"Speed",
|
||||
"Attack",
|
||||
"MP",
|
||||
};
|
||||
|
||||
public override void SetOwner(AbilitySystemComponent owner)
|
||||
{
|
||||
_owner = owner;
|
||||
HP.SetOwner(owner);
|
||||
Speed.SetOwner(owner);
|
||||
Attack.SetOwner(owner);
|
||||
MP.SetOwner(owner);
|
||||
}
|
||||
|
||||
public static class Lookup
|
||||
{
|
||||
public const string HP = "AS_Fight.HP";
|
||||
public const string Speed = "AS_Fight.Speed";
|
||||
public const string Attack = "AS_Fight.Attack";
|
||||
public const string MP = "AS_Fight.MP";
|
||||
}
|
||||
}
|
||||
|
||||
public static class GAttrSetLib
|
||||
{
|
||||
public static readonly Dictionary<string, Type> AttrSetTypeDict = new Dictionary<string, Type>()
|
||||
{
|
||||
{ "Fight", typeof(AS_Fight) },
|
||||
{ "Bullet", typeof(AS_Bullet) },
|
||||
};
|
||||
|
||||
public static readonly Dictionary<Type, string> TypeToName = new Dictionary<Type, string>
|
||||
{
|
||||
{ typeof(AS_Fight), nameof(AS_Fight) },
|
||||
{ typeof(AS_Bullet), nameof(AS_Bullet) },
|
||||
};
|
||||
|
||||
public static List<string> AttributeFullNames = new List<string>()
|
||||
{
|
||||
"AS_Fight.HP",
|
||||
"AS_Fight.Speed",
|
||||
"AS_Fight.Attack",
|
||||
"AS_Fight.MP",
|
||||
"AS_Bullet.Attack",
|
||||
};
|
||||
}
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c28e24a4401272a4ba8ae2194b529340
|
@ -1,49 +0,0 @@
|
||||
///////////////////////////////////
|
||||
//// This is a generated file. ////
|
||||
//// Do not modify it. ////
|
||||
///////////////////////////////////
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace GAS.Runtime
|
||||
{
|
||||
public static class GTagLib
|
||||
{
|
||||
public static GameplayTag Ability { get; } = new GameplayTag("Ability");
|
||||
public static GameplayTag Ability_Die { get; } = new GameplayTag("Ability.Die");
|
||||
public static GameplayTag Ability_Fire { get; } = new GameplayTag("Ability.Fire");
|
||||
public static GameplayTag Ability_Jump { get; } = new GameplayTag("Ability.Jump");
|
||||
public static GameplayTag Ability_Move { get; } = new GameplayTag("Ability.Move");
|
||||
public static GameplayTag Ability_NormalAttack { get; } = new GameplayTag("Ability.NormalAttack");
|
||||
public static GameplayTag CD { get; } = new GameplayTag("CD");
|
||||
public static GameplayTag CD_Sweep { get; } = new GameplayTag("CD.Sweep");
|
||||
public static GameplayTag Event { get; } = new GameplayTag("Event");
|
||||
public static GameplayTag Event_Moving { get; } = new GameplayTag("Event.Moving");
|
||||
public static GameplayTag Faction { get; } = new GameplayTag("Faction");
|
||||
public static GameplayTag Faction_Emeny { get; } = new GameplayTag("Faction.Emeny");
|
||||
public static GameplayTag Faction_Player { get; } = new GameplayTag("Faction.Player");
|
||||
public static GameplayTag State { get; } = new GameplayTag("State");
|
||||
public static GameplayTag State_Debuff { get; } = new GameplayTag("State.Debuff");
|
||||
public static GameplayTag State_Debuff_Cold { get; } = new GameplayTag("State.Debuff.Cold");
|
||||
|
||||
public static Dictionary<string, GameplayTag> TagMap = new Dictionary<string, GameplayTag>
|
||||
{
|
||||
["Ability"] = Ability,
|
||||
["Ability.Die"] = Ability_Die,
|
||||
["Ability.Fire"] = Ability_Fire,
|
||||
["Ability.Jump"] = Ability_Jump,
|
||||
["Ability.Move"] = Ability_Move,
|
||||
["Ability.NormalAttack"] = Ability_NormalAttack,
|
||||
["CD"] = CD,
|
||||
["CD.Sweep"] = CD_Sweep,
|
||||
["Event"] = Event,
|
||||
["Event.Moving"] = Event_Moving,
|
||||
["Faction"] = Faction,
|
||||
["Faction.Emeny"] = Faction_Emeny,
|
||||
["Faction.Player"] = Faction_Player,
|
||||
["State"] = State,
|
||||
["State.Debuff"] = State_Debuff,
|
||||
["State.Debuff.Cold"] = State_Debuff_Cold,
|
||||
};
|
||||
}
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9c0673795bc107440961382b92f70529
|
@ -14,7 +14,7 @@ namespace GameLogic
|
||||
public class GameManager : SingletonBehaviour<GameManager>
|
||||
{
|
||||
|
||||
public static Scene GameScene { get; set; }
|
||||
public static Scene GameScene => GameNetSystem.Instance.m_gameScene;
|
||||
|
||||
private List<ILogicSys> _logicSystems = new List<ILogicSys>();
|
||||
private IFsm<GameManager> _modeFsm;
|
||||
@ -56,6 +56,7 @@ namespace GameLogic
|
||||
_logicSystems.Add(WeatherSystem.Instance);
|
||||
_logicSystems.Add(CameraSystem.Instance);
|
||||
_logicSystems.Add(GameNetSystem.Instance);
|
||||
_logicSystems.Add(BattleSystem.Instance);
|
||||
|
||||
for (int i = 0; i < _logicSystems.Count; i++)
|
||||
{
|
||||
@ -71,7 +72,14 @@ namespace GameLogic
|
||||
_modeFsm = GameModule.Fsm.CreateFsm("ModeFsm", this,_states);
|
||||
_modeFsm.Start<DefaultMode>();
|
||||
}
|
||||
|
||||
|
||||
private void Start()
|
||||
{
|
||||
foreach (var system in _logicSystems.ToArray())
|
||||
{
|
||||
system.OnStart();
|
||||
}
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
|
@ -1,14 +0,0 @@
|
||||
using GAS.Runtime;
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
public interface ICombatComponent
|
||||
{
|
||||
AbilitySystemComponent ASC { get;}
|
||||
void Init();
|
||||
void OnEnable();
|
||||
void OnUpdate();
|
||||
void OnDisable();
|
||||
void OnDestroy();
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 42076b4c306f433aa7a2eaa20d8edeea
|
||||
timeCreated: 1743497803
|
@ -1,37 +0,0 @@
|
||||
using Fantasy.Entitas;
|
||||
using GAS.Runtime;
|
||||
using UnityEngine;
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
public class CombatEntity : Entity
|
||||
{
|
||||
private AbilitySystemComponent m_abilitySystem;
|
||||
public AbilitySystemComponent ASC => m_abilitySystem;
|
||||
#region 生命周期
|
||||
/// <summary>
|
||||
/// 初始化
|
||||
/// </summary>
|
||||
public void Init(AbilitySystemComponent asc)
|
||||
{
|
||||
m_abilitySystem = asc;
|
||||
AddComponent<AttributeComponent>();
|
||||
|
||||
}
|
||||
|
||||
private void OnUpdate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ebcad2909c4f452ba2b8940ebde8eaab
|
||||
timeCreated: 1743497187
|
@ -1,118 +0,0 @@
|
||||
using Fantasy.Entitas;
|
||||
using GAS.Runtime;
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
public class AttributeComponent : Entity,ICombatComponent
|
||||
{
|
||||
public AbilitySystemComponent ASC => (Parent as CombatEntity)?.ASC;
|
||||
#region 生命周期
|
||||
public void Init()
|
||||
{
|
||||
var roleUnit = DataSystem.Instance.GetData<UnitDataConfigMgr>().GetRoleUnit((int)Parent.Id);
|
||||
if(roleUnit == null) return;
|
||||
ASC.AttrSet<AS_Fight>().InitHP(roleUnit.Hp);
|
||||
ASC.AttrSet<AS_Fight>().InitMP(roleUnit.Mp);
|
||||
ASC.AttrSet<AS_Fight>().InitAttack(roleUnit.Attck);
|
||||
ASC.AttrSet<AS_Fight>().InitSpeed(roleUnit.MoveSpeed);
|
||||
}
|
||||
|
||||
public void OnEnable()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnUpdate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnDisable()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnDestroy()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void SetBaseValue(EAttributeType attribute,float value)
|
||||
{
|
||||
switch (attribute)
|
||||
{
|
||||
case EAttributeType.Hp:
|
||||
ASC.AttrSet<AS_Fight>().SetBaseHP(value);
|
||||
break;
|
||||
case EAttributeType.Mp:
|
||||
ASC.AttrSet<AS_Fight>().SetBaseMP(value);
|
||||
break;
|
||||
case EAttributeType.Attack:
|
||||
ASC.AttrSet<AS_Fight>().SetBaseAttack(value);
|
||||
break;
|
||||
case EAttributeType.MoveSpeed:
|
||||
ASC.AttrSet<AS_Fight>().SetBaseSpeed(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetCurrentValue(EAttributeType attribute,float value)
|
||||
{
|
||||
switch (attribute)
|
||||
{
|
||||
case EAttributeType.Hp:
|
||||
ASC.AttrSet<AS_Fight>().SetCurrentHP(value);
|
||||
break;
|
||||
case EAttributeType.Mp:
|
||||
ASC.AttrSet<AS_Fight>().SetCurrentMP(value);
|
||||
break;
|
||||
case EAttributeType.Attack:
|
||||
ASC.AttrSet<AS_Fight>().SetCurrentAttack(value);
|
||||
break;
|
||||
case EAttributeType.MoveSpeed:
|
||||
ASC.AttrSet<AS_Fight>().SetCurrentSpeed(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetMaxValue(EAttributeType attribute,float value)
|
||||
{
|
||||
switch (attribute)
|
||||
{
|
||||
case EAttributeType.Hp:
|
||||
ASC.AttrSet<AS_Fight>().SetMaxHP(value);
|
||||
break;
|
||||
case EAttributeType.Mp:
|
||||
ASC.AttrSet<AS_Fight>().SetMaxMP(value);
|
||||
break;
|
||||
case EAttributeType.Attack:
|
||||
ASC.AttrSet<AS_Fight>().SetMaxAttack(value);
|
||||
break;
|
||||
case EAttributeType.MoveSpeed:
|
||||
ASC.AttrSet<AS_Fight>().SetMaxSpeed(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetMinValue(EAttributeType attribute,float value)
|
||||
{
|
||||
switch (attribute)
|
||||
{
|
||||
case EAttributeType.Hp:
|
||||
ASC.AttrSet<AS_Fight>().SetMinHP(value);
|
||||
break;
|
||||
case EAttributeType.Mp:
|
||||
ASC.AttrSet<AS_Fight>().SetMinMP(value);
|
||||
break;
|
||||
case EAttributeType.Attack:
|
||||
ASC.AttrSet<AS_Fight>().SetMinAttack(value);
|
||||
break;
|
||||
case EAttributeType.MoveSpeed:
|
||||
ASC.AttrSet<AS_Fight>().SetMinSpeed(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -36,14 +36,15 @@ namespace GameLogic
|
||||
// 创建一个Scene,这个Scene代表一个客户端的场景,客户端的所有逻辑都可以写这里
|
||||
// 如果有自己的框架,也可以就单纯拿这个Scene做网络通讯也没问题。
|
||||
m_gameScene = await Scene.Create(SceneRuntimeType.MainThread);
|
||||
GameManager.GameScene = m_gameScene;
|
||||
if (m_gameScene == null)
|
||||
{
|
||||
Log.Info("连接服务器失败");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
InitCommand();
|
||||
|
||||
CombatUnit combat = Entity.Create<CombatUnit>(GameManager.GameScene,true,true);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
"dependencies": {
|
||||
"com.code-philosophy.hybridclr": "https://gitee.com/focus-creative-games/hybridclr_unity.git",
|
||||
"com.coffee.ui-effect": "5.6.1",
|
||||
"com.fantasy.unity": "2024.2.24",
|
||||
"com.fantasy.unity": "2024.2.25",
|
||||
"com.tuyoogame.yooasset": "2.1.2",
|
||||
"com.unity.2d.sprite": "1.0.0",
|
||||
"com.unity.2d.tilemap": "1.0.0",
|
||||
|
@ -29,7 +29,7 @@
|
||||
"dependencies": {}
|
||||
},
|
||||
"com.fantasy.unity": {
|
||||
"version": "2024.2.24",
|
||||
"version": "2024.2.25",
|
||||
"depth": 0,
|
||||
"source": "registry",
|
||||
"dependencies": {
|
||||
|
@ -30,7 +30,7 @@ MonoBehaviour:
|
||||
LimitMinValue: 1
|
||||
MinValue: 0
|
||||
LimitMaxValue: 1
|
||||
MaxValue: 3.4028235e+38
|
||||
MaxValue: 300
|
||||
- Name: Attack
|
||||
Comment: "\u653B\u51FB\u529B"
|
||||
CalculateMode: 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user