From 31db916fec011bf6f593dabf62d7a745be6b28cc Mon Sep 17 00:00:00 2001 From: "PC-20230316NUNE\\Administrator" <2858626794@qq.com> Date: Fri, 18 Oct 2024 17:48:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=B4=E6=97=B6=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GameplayCueDurational_PlayerDemo01.cs | 19 +++++++-- .../Demo/Scripts/Gen/GAbilityLib.gen.cs | 28 +++++++++++++ .../Demo/Scripts/Gen/GAbilityLib.gen.cs.meta | 11 +++++ JEX_GAS/Assets/Demo/Scripts/Main.cs | 18 ++++++++ JEX_GAS/Assets/Demo/Scripts/Main.cs.meta | 3 ++ .../GameplayAbilitySystem/GASWatcher.cs | 12 +++--- .../{ObjectPool.cs => JexGasObjectPool.cs} | 18 ++++++-- ...tPool.cs.meta => JexGasObjectPool.cs.meta} | 0 .../GAS/Runtime/Ability/AbilityAreaUtil.cs | 12 +++--- .../GAS/Runtime/Ability/AbilityContainer.cs | 6 +-- .../TimelineAbility/TimelineAbilityPlayer.cs | 8 ++-- .../Runtime/Attribute/AttributeAggregator.cs | 4 +- .../AttributeSet/AttributeSetContainer.cs | 4 +- .../Component/AbilitySystemComponent.cs | 25 +++++++---- .../AbilitySystemPreviewComponent.cs | 21 ++++++++++ .../AbilitySystemPreviewComponent.cs.meta | 3 ++ .../GAS/Runtime/Core/GameplayAbilitySystem.cs | 4 +- .../Runtime/Cue/Base/GameplayCueDurational.cs | 24 +++++++++-- .../Assets/GAS/Runtime/Cue/CueAnimation.cs | 8 ++-- .../GAS/Runtime/Cue/CueAnimationOneShot.cs | 2 +- .../Runtime/Cue/CueAnimationSpeedModifier.cs | 8 ++-- .../Assets/GAS/Runtime/Cue/CuePlaySound.cs | 17 +++++--- JEX_GAS/Assets/GAS/Runtime/Cue/CueVFX.cs | 23 +++++----- .../GAS/Runtime/Effects/GameplayEffect.cs | 8 ++-- .../Effects/GameplayEffectContainer.cs | 8 ++-- .../GAS/Runtime/Effects/GameplayEffectSpec.cs | 42 +++++++++---------- .../Effects/GrantedAbilityFromEffect.cs | 4 +- JEX_GAS/Assets/GAS/Runtime/JexGasManager.cs | 29 +++++++++++++ .../Assets/GAS/Runtime/JexGasManager.cs.meta | 3 ++ .../GAS/Runtime/Tags/GameplayTagAggregator.cs | 8 ++-- JEX_GAS/Assets/Main.unity | 42 ++++++++++++++++--- 31 files changed, 315 insertions(+), 107 deletions(-) create mode 100644 JEX_GAS/Assets/Demo/Scripts/Gen/GAbilityLib.gen.cs create mode 100644 JEX_GAS/Assets/Demo/Scripts/Gen/GAbilityLib.gen.cs.meta create mode 100644 JEX_GAS/Assets/Demo/Scripts/Main.cs create mode 100644 JEX_GAS/Assets/Demo/Scripts/Main.cs.meta rename JEX_GAS/Assets/GAS/General/Util/Pool/{ObjectPool.cs => JexGasObjectPool.cs} (90%) rename JEX_GAS/Assets/GAS/General/Util/Pool/{ObjectPool.cs.meta => JexGasObjectPool.cs.meta} (100%) create mode 100644 JEX_GAS/Assets/GAS/Runtime/Component/AbilitySystemPreviewComponent.cs create mode 100644 JEX_GAS/Assets/GAS/Runtime/Component/AbilitySystemPreviewComponent.cs.meta create mode 100644 JEX_GAS/Assets/GAS/Runtime/JexGasManager.cs create mode 100644 JEX_GAS/Assets/GAS/Runtime/JexGasManager.cs.meta diff --git a/JEX_GAS/Assets/Demo/Scripts/GAS/GameplayCue/GameplayCueDurational_PlayerDemo01.cs b/JEX_GAS/Assets/Demo/Scripts/GAS/GameplayCue/GameplayCueDurational_PlayerDemo01.cs index 886ecddc..cb9269fb 100644 --- a/JEX_GAS/Assets/Demo/Scripts/GAS/GameplayCue/GameplayCueDurational_PlayerDemo01.cs +++ b/JEX_GAS/Assets/Demo/Scripts/GAS/GameplayCue/GameplayCueDurational_PlayerDemo01.cs @@ -37,28 +37,41 @@ namespace Demo.Scripts.GAS.GameplayCue public class GameplayCueDurational_PlayerDemo01_Spec : GameplayCueDurationalSpec { + + private GameplayCueDurational_PlayerDemo01 Cue; + public GameplayCueDurational_PlayerDemo01_Spec(GameplayCueDurational_PlayerDemo01 cue, GameplayCueParameters parameters) : base(cue, parameters) { + Cue = cue; } - public override void OnAdd() + public override void OnAdd(int frame,int startFrame,int endFrame) { + Debug.Log("GameplayCueDurational_PlayerDemo01_Spec OnAdd"); } - public override void OnRemove() + public override void OnRemove(int frame,int startFrame,int endFrame) { + Debug.Log("GameplayCueDurational_PlayerDemo01_Spec OnRemove"); } public override void OnGameplayEffectActivate() { + Debug.Log("GameplayCueDurational_PlayerDemo01_Spec OnGameplayEffectActivate"); } public override void OnGameplayEffectDeactivate() { + Debug.Log("GameplayCueDurational_PlayerDemo01_Spec OnGameplayEffectDeactivate"); } - public override void OnTick() + public override void OnTick(int frame,int startFrame,int endFrame) { + Debug.Log($"GameplayCueDurational_PlayerDemo01_Spec OnTick {frame}"); + if (Owner.GetView() is not null) + { + Owner.GetView().transform.position = Vector3.Lerp(Cue.start, Cue.end, (float)(frame - startFrame) / endFrame); + } } } diff --git a/JEX_GAS/Assets/Demo/Scripts/Gen/GAbilityLib.gen.cs b/JEX_GAS/Assets/Demo/Scripts/Gen/GAbilityLib.gen.cs new file mode 100644 index 00000000..745a8bf6 --- /dev/null +++ b/JEX_GAS/Assets/Demo/Scripts/Gen/GAbilityLib.gen.cs @@ -0,0 +1,28 @@ +/////////////////////////////////// +//// 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 JisolDemo1 = new AbilityInfo { Name = "JisolDemo1", AssetPath = "Assets/Demo/GAS/Config/GameplayAbilityLib/JisolDemo1.asset",AbilityClassType = typeof(GAS.Runtime.TimelineAbility) }; + + + public static Dictionary AbilityMap = new Dictionary + { + ["JisolDemo1"] = JisolDemo1, + }; + } +} \ No newline at end of file diff --git a/JEX_GAS/Assets/Demo/Scripts/Gen/GAbilityLib.gen.cs.meta b/JEX_GAS/Assets/Demo/Scripts/Gen/GAbilityLib.gen.cs.meta new file mode 100644 index 00000000..f4315c50 --- /dev/null +++ b/JEX_GAS/Assets/Demo/Scripts/Gen/GAbilityLib.gen.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 79aaab94f725e0347b32b6383dc6361e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/JEX_GAS/Assets/Demo/Scripts/Main.cs b/JEX_GAS/Assets/Demo/Scripts/Main.cs new file mode 100644 index 00000000..2a1d2197 --- /dev/null +++ b/JEX_GAS/Assets/Demo/Scripts/Main.cs @@ -0,0 +1,18 @@ +using System; +using GAS.Runtime; +using UnityEngine; + +namespace Demo.Scripts +{ + public class Main : MonoBehaviour + { + + public AbilitySystemComponent player; + + private void Start() + { + player.InitWithPreset(1); + player.TryActivateAbility(GAbilityLib.JisolDemo1.Name); + } + } +} \ No newline at end of file diff --git a/JEX_GAS/Assets/Demo/Scripts/Main.cs.meta b/JEX_GAS/Assets/Demo/Scripts/Main.cs.meta new file mode 100644 index 00000000..caf30221 --- /dev/null +++ b/JEX_GAS/Assets/Demo/Scripts/Main.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 0c3aa2f58b904ebe9fc64cc367c63d68 +timeCreated: 1729236756 \ No newline at end of file diff --git a/JEX_GAS/Assets/GAS/Editor/GameplayAbilitySystem/GASWatcher.cs b/JEX_GAS/Assets/GAS/Editor/GameplayAbilitySystem/GASWatcher.cs index 8b011c54..7f8b6a26 100644 --- a/JEX_GAS/Assets/GAS/Editor/GameplayAbilitySystem/GASWatcher.cs +++ b/JEX_GAS/Assets/GAS/Editor/GameplayAbilitySystem/GASWatcher.cs @@ -134,7 +134,7 @@ namespace GAS.Editor { if (IsPlaying) { - if (_selected == null || _selected.gameObject == null) + if (_selected == null || _selected.GetView().gameObject == null) { _selected = GAS.GameplayAbilitySystem.GAS.AbilitySystemComponents.Count > 0 ? GAS.GameplayAbilitySystem.GAS.AbilitySystemComponents[0] as AbilitySystemComponent @@ -169,7 +169,7 @@ namespace GAS.Editor { var asc = (AbilitySystemComponent)iasc; var presetName = asc.Preset != null ? asc.Preset.name : "NoPreset"; - if (GUILayout.Button($"{presetName}#{asc.GetInstanceID()}")) + if (GUILayout.Button($"{presetName}#{asc.GetView().GetInstanceID()}")) { _selected = asc; RefreshAscInfo(); @@ -194,8 +194,8 @@ namespace GAS.Editor return; } - IID = _selected.GetInstanceID(); - instance = _selected.gameObject; + IID = _selected.GetView().GetInstanceID(); + instance = _selected.GetView().gameObject; Level = _selected.Level; RefreshAbilityInfo(); @@ -278,13 +278,13 @@ namespace GAS.Editor case GameplayEffectSpec spec: { DynamicTag.Add( - $" - From: {spec.Owner.GetInstanceID()}'s GE: {spec.GameplayEffect.GameplayEffectName}"); + $" - From: {spec.Owner.EntityId}'s GE: {spec.GameplayEffect.GameplayEffectName}"); break; } case AbilitySpec ability: { DynamicTag.Add( - $" - From: {ability.Owner.GetInstanceID()}'s Ability: {ability.Ability.Name}"); + $" - From: {ability.Owner.EntityId}'s Ability: {ability.Ability.Name}"); break; } } diff --git a/JEX_GAS/Assets/GAS/General/Util/Pool/ObjectPool.cs b/JEX_GAS/Assets/GAS/General/Util/Pool/JexGasObjectPool.cs similarity index 90% rename from JEX_GAS/Assets/GAS/General/Util/Pool/ObjectPool.cs rename to JEX_GAS/Assets/GAS/General/Util/Pool/JexGasObjectPool.cs index 8b4d6cab..ac81a4b0 100644 --- a/JEX_GAS/Assets/GAS/General/Util/Pool/ObjectPool.cs +++ b/JEX_GAS/Assets/GAS/General/Util/Pool/JexGasObjectPool.cs @@ -12,15 +12,27 @@ namespace GAS.General bool IsFromPool { get; set; } } - public class ObjectPool + public class JexGasObjectPool { - private static ObjectPool _singleton; - public static ObjectPool Instance => _singleton ??= new ObjectPool(); + private static JexGasObjectPool _singleton; + + public static JexGasObjectPool Instance => _singleton ??= new JexGasObjectPool(); private readonly ConcurrentDictionary _objPool = new(); private readonly Func _addPoolFunc = type => new Pool(type, 1024); + public static void Awake() + { + _singleton = null; + _singleton = new JexGasObjectPool(); + } + + public static void Destroy() + { + _singleton = null; + } + public T Fetch() where T : class { var type = typeof(T); diff --git a/JEX_GAS/Assets/GAS/General/Util/Pool/ObjectPool.cs.meta b/JEX_GAS/Assets/GAS/General/Util/Pool/JexGasObjectPool.cs.meta similarity index 100% rename from JEX_GAS/Assets/GAS/General/Util/Pool/ObjectPool.cs.meta rename to JEX_GAS/Assets/GAS/General/Util/Pool/JexGasObjectPool.cs.meta diff --git a/JEX_GAS/Assets/GAS/Runtime/Ability/AbilityAreaUtil.cs b/JEX_GAS/Assets/GAS/Runtime/Ability/AbilityAreaUtil.cs index 4525cad7..80245832 100644 --- a/JEX_GAS/Assets/GAS/Runtime/Ability/AbilityAreaUtil.cs +++ b/JEX_GAS/Assets/GAS/Runtime/Ability/AbilityAreaUtil.cs @@ -16,11 +16,11 @@ namespace GAS.Runtime public static Collider2D[] OverlapBox2D(this AbilitySystemComponent asc, Vector2 offset, Vector2 size, float angle, int layerMask, Transform relativeTransform = null) { - relativeTransform ??= asc.transform; + relativeTransform ??= asc.GetView().transform; var center = (Vector2)relativeTransform.position; offset.x *= relativeTransform.lossyScale.x > 0 ? 1 : -1; center += offset; - angle += asc.transform.eulerAngles.z; + angle += asc.GetView().transform.eulerAngles.z; return Physics2D.OverlapBoxAll(center, size, angle, layerMask); } @@ -28,11 +28,11 @@ namespace GAS.Runtime public static int OverlapBox2DNonAlloc(this AbilitySystemComponent asc, Vector2 offset, Vector2 size, float angle, Collider2D[] results, int layerMask, Transform relativeTransform = null) { - relativeTransform ??= asc.transform; + relativeTransform ??= asc.GetView().transform; var center = (Vector2)relativeTransform.position; offset.x *= relativeTransform.lossyScale.x > 0 ? 1 : -1; center += offset; - angle += asc.transform.eulerAngles.z; + angle += asc.GetView().transform.eulerAngles.z; var count = Physics2D.OverlapBoxNonAlloc(center, size, angle, results, layerMask); return count; @@ -55,7 +55,7 @@ namespace GAS.Runtime public static Collider2D[] OverlapCircle2D(this AbilitySystemComponent asc, Vector2 offset, float radius, int layerMask, Transform relativeTransform = null) { - relativeTransform ??= asc.transform; + relativeTransform ??= asc.GetView().transform; var center = (Vector2)relativeTransform.position; offset.x *= relativeTransform.lossyScale.x > 0 ? 1 : -1; center += offset; @@ -66,7 +66,7 @@ namespace GAS.Runtime public static int OverlapCircle2DNonAlloc(this AbilitySystemComponent asc, Vector2 offset, float radius, Collider2D[] results, int layerMask, Transform relativeTransform = null) { - relativeTransform ??= asc.transform; + relativeTransform ??= asc.GetView().transform; var center = (Vector2)relativeTransform.position; offset.x *= relativeTransform.lossyScale.x > 0 ? 1 : -1; center += offset; diff --git a/JEX_GAS/Assets/GAS/Runtime/Ability/AbilityContainer.cs b/JEX_GAS/Assets/GAS/Runtime/Ability/AbilityContainer.cs index d3ad1e21..40c01a60 100644 --- a/JEX_GAS/Assets/GAS/Runtime/Ability/AbilityContainer.cs +++ b/JEX_GAS/Assets/GAS/Runtime/Ability/AbilityContainer.cs @@ -16,7 +16,7 @@ namespace GAS.Runtime public void Tick() { - var abilitySpecs = ObjectPool.Instance.Fetch>(); + var abilitySpecs = JexGasObjectPool.Instance.Fetch>(); abilitySpecs.AddRange(_abilities.Values); foreach (var abilitySpec in abilitySpecs) @@ -25,7 +25,7 @@ namespace GAS.Runtime } abilitySpecs.Clear(); - ObjectPool.Instance.Recycle(abilitySpecs); + JexGasObjectPool.Instance.Recycle(abilitySpecs); } public void GrantAbility(AbstractAbility ability) @@ -61,7 +61,7 @@ namespace GAS.Runtime // 这个输出可以删掉, 某些情况下确实会尝试激活不存在的技能(失败了也无所谓), 但是对开发期间的调试有帮助 Debug.LogWarning( $"you are trying to activate an ability that does not exist: " + - $"abilityName=\"{abilityName}\", GameObject=\"{_owner.name}\", " + + $"abilityName=\"{abilityName}\", GameObject=\"{_owner.EntityId}\", " + $"Preset={(_owner.Preset != null ? _owner.Preset.name : "null")}"); #endif return false; diff --git a/JEX_GAS/Assets/GAS/Runtime/Ability/TimelineAbility/TimelineAbilityPlayer.cs b/JEX_GAS/Assets/GAS/Runtime/Ability/TimelineAbility/TimelineAbilityPlayer.cs index 3001436a..cfc48cc0 100644 --- a/JEX_GAS/Assets/GAS/Runtime/Ability/TimelineAbility/TimelineAbilityPlayer.cs +++ b/JEX_GAS/Assets/GAS/Runtime/Ability/TimelineAbility/TimelineAbilityPlayer.cs @@ -218,7 +218,7 @@ namespace GAS.Runtime foreach (var clip in _cacheDurationalCueTrack) { if (_currentFrame <= clip.endFrame) - clip.cueSpec.OnRemove(); + clip.cueSpec.OnRemove(_currentFrame,clip.startFrame,clip.endFrame); } foreach (var clip in _cacheBuffGameplayEffectTrack) @@ -345,17 +345,17 @@ namespace GAS.Runtime { if (frame == cueClip.startFrame) { - cueClip.cueSpec.OnAdd(); + cueClip.cueSpec.OnAdd(frame,cueClip.startFrame,cueClip.endFrame); } if (frame >= cueClip.startFrame && frame <= cueClip.endFrame) { - cueClip.cueSpec.OnTick(); + cueClip.cueSpec.OnTick(frame,cueClip.startFrame,cueClip.endFrame); } if (frame == cueClip.endFrame) { - cueClip.cueSpec.OnRemove(); + cueClip.cueSpec.OnRemove(frame,cueClip.startFrame,cueClip.endFrame); } } } diff --git a/JEX_GAS/Assets/GAS/Runtime/Attribute/AttributeAggregator.cs b/JEX_GAS/Assets/GAS/Runtime/Attribute/AttributeAggregator.cs index bfaff474..ed044414 100644 --- a/JEX_GAS/Assets/GAS/Runtime/Attribute/AttributeAggregator.cs +++ b/JEX_GAS/Assets/GAS/Runtime/Attribute/AttributeAggregator.cs @@ -80,7 +80,7 @@ namespace GAS.Runtime { if (modifier.AttributeName == _processedAttribute.Name) { - var modifierSpec = ObjectPool.Instance.Fetch(); + var modifierSpec = JexGasObjectPool.Instance.Fetch(); modifierSpec.Init(geSpec, modifier); _modifierCache.Add(modifierSpec); TryRegisterAttributeChangedListen(geSpec, modifier); @@ -104,7 +104,7 @@ namespace GAS.Runtime foreach (var modifierSpec in _modifierCache) { modifierSpec.Release(); - ObjectPool.Instance.Recycle(modifierSpec); + JexGasObjectPool.Instance.Recycle(modifierSpec); } _modifierCache.Clear(); diff --git a/JEX_GAS/Assets/GAS/Runtime/AttributeSet/AttributeSetContainer.cs b/JEX_GAS/Assets/GAS/Runtime/AttributeSet/AttributeSetContainer.cs index b86b42bf..88be3bd7 100644 --- a/JEX_GAS/Assets/GAS/Runtime/AttributeSet/AttributeSetContainer.cs +++ b/JEX_GAS/Assets/GAS/Runtime/AttributeSet/AttributeSetContainer.cs @@ -35,7 +35,7 @@ namespace GAS.Runtime if (!_attributeAggregators.ContainsKey(attrSet[attr])) { var attrAggt = new AttributeAggregator(attrSet[attr], _owner); - if (_owner.enabled) attrAggt.OnEnable(); + attrAggt.OnEnable(); _attributeAggregators.Add(attrSet[attr], attrAggt); } } @@ -112,7 +112,7 @@ namespace GAS.Runtime public Dictionary Snapshot() { - var snapshot = ObjectPool.Instance.Fetch>(); + var snapshot = JexGasObjectPool.Instance.Fetch>(); foreach (var kv in _attributeSets) { var attributeSet = kv.Value; diff --git a/JEX_GAS/Assets/GAS/Runtime/Component/AbilitySystemComponent.cs b/JEX_GAS/Assets/GAS/Runtime/Component/AbilitySystemComponent.cs index ea66664d..25c894f5 100644 --- a/JEX_GAS/Assets/GAS/Runtime/Component/AbilitySystemComponent.cs +++ b/JEX_GAS/Assets/GAS/Runtime/Component/AbilitySystemComponent.cs @@ -4,12 +4,13 @@ using UnityEngine; namespace GAS.Runtime { - public class AbilitySystemComponent : MonoBehaviour, IAbilitySystemComponent + public class AbilitySystemComponent : IAbilitySystemComponent { - [SerializeField] + private AbilitySystemComponentPreset preset; - public AbilitySystemComponentPreset Preset => preset; + + public int EntityId { get; protected set; } public int Level { get; protected set; } @@ -190,7 +191,7 @@ namespace GAS.Runtime if (gameplayEffectSpec == null) { #if UNITY_EDITOR - Debug.LogError($"[EX] Try To Apply a invalid EntityRef of GameplayEffectSpec From {name} To {target.name}!"); + Debug.LogError($"[EX] Try To Apply a invalid EntityRef of GameplayEffectSpec From {EntityId} To {target.EntityId}!"); #endif return null; } @@ -203,7 +204,7 @@ namespace GAS.Runtime if (gameplayEffect == null) { #if UNITY_EDITOR - Debug.LogError($"[EX] Try To Apply a NULL GameplayEffect From {name} To {target.name}!"); + Debug.LogError($"[EX] Try To Apply a NULL GameplayEffect From {EntityId} To {target.EntityId}!"); #endif return null; } @@ -217,7 +218,7 @@ namespace GAS.Runtime if (gameplayEffect == null) { #if UNITY_EDITOR - Debug.LogError($"[EX] Try To Apply a NULL GameplayEffect From {name} To {target.name}!"); + Debug.LogError($"[EX] Try To Apply a NULL GameplayEffect From {EntityId} To {target.EntityId}!"); #endif return null; } @@ -398,5 +399,15 @@ namespace GAS.Runtime { GameplayEffectContainer.ClearGameplayEffect(); } + + /// + /// 返回视图 + /// + /// + public virtual GameObject GetView() + { + return null; + } + } -} \ No newline at end of file +} diff --git a/JEX_GAS/Assets/GAS/Runtime/Component/AbilitySystemPreviewComponent.cs b/JEX_GAS/Assets/GAS/Runtime/Component/AbilitySystemPreviewComponent.cs new file mode 100644 index 00000000..fa53cc99 --- /dev/null +++ b/JEX_GAS/Assets/GAS/Runtime/Component/AbilitySystemPreviewComponent.cs @@ -0,0 +1,21 @@ +using UnityEngine; + +namespace GAS.Runtime +{ + public class AbilitySystemPreviewComponent : AbilitySystemComponent + { + + private GameObject view; + + public AbilitySystemPreviewComponent(GameObject view) + { + this.view = view; + } + + public override GameObject GetView() + { + return view; + } + + } +} \ No newline at end of file diff --git a/JEX_GAS/Assets/GAS/Runtime/Component/AbilitySystemPreviewComponent.cs.meta b/JEX_GAS/Assets/GAS/Runtime/Component/AbilitySystemPreviewComponent.cs.meta new file mode 100644 index 00000000..c2fac298 --- /dev/null +++ b/JEX_GAS/Assets/GAS/Runtime/Component/AbilitySystemPreviewComponent.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: d737dff4fee4418e997631c8d083de40 +timeCreated: 1729243645 \ No newline at end of file diff --git a/JEX_GAS/Assets/GAS/Runtime/Core/GameplayAbilitySystem.cs b/JEX_GAS/Assets/GAS/Runtime/Core/GameplayAbilitySystem.cs index d1296119..074d9bca 100644 --- a/JEX_GAS/Assets/GAS/Runtime/Core/GameplayAbilitySystem.cs +++ b/JEX_GAS/Assets/GAS/Runtime/Core/GameplayAbilitySystem.cs @@ -82,7 +82,7 @@ namespace GAS { Profiler.BeginSample($"{nameof(GameplayAbilitySystem)}::Tick()"); - var abilitySystemComponents = ObjectPool.Instance.Fetch>(); + var abilitySystemComponents = JexGasObjectPool.Instance.Fetch>(); abilitySystemComponents.AddRange(AbilitySystemComponents); foreach (var abilitySystemComponent in abilitySystemComponents) @@ -91,7 +91,7 @@ namespace GAS } abilitySystemComponents.Clear(); - ObjectPool.Instance.Recycle(abilitySystemComponents); + JexGasObjectPool.Instance.Recycle(abilitySystemComponents); Profiler.EndSample(); } diff --git a/JEX_GAS/Assets/GAS/Runtime/Cue/Base/GameplayCueDurational.cs b/JEX_GAS/Assets/GAS/Runtime/Cue/Base/GameplayCueDurational.cs index 09cd7b9a..b803ad39 100644 --- a/JEX_GAS/Assets/GAS/Runtime/Cue/Base/GameplayCueDurational.cs +++ b/JEX_GAS/Assets/GAS/Runtime/Cue/Base/GameplayCueDurational.cs @@ -34,11 +34,29 @@ namespace GAS.Runtime { } - public abstract void OnAdd(); - public abstract void OnRemove(); + /// + /// 添加 + /// + /// 当前帧(不是Timeline类型则返回-1) + /// 开始帧(不是Timeline类型则返回-1) + /// 结束帧(不是Timeline类型则返回-1) + public abstract void OnAdd(int frame,int startFrame,int endFrame); + /// + /// 移除 + /// + /// 当前帧(不是Timeline类型则返回-1) + /// 开始帧(不是Timeline类型则返回-1) + /// 结束帧(不是Timeline类型则返回-1) + public abstract void OnRemove(int frame,int startFrame,int endFrame); public abstract void OnGameplayEffectActivate(); public abstract void OnGameplayEffectDeactivate(); - public abstract void OnTick(); + /// + /// Tick + /// + /// 当前帧(不是Timeline类型则返回-1) + /// 开始帧(不是Timeline类型则返回-1) + /// 结束帧(不是Timeline类型则返回-1) + public abstract void OnTick(int frame,int startFrame,int endFrame); } public abstract class GameplayCueDurationalSpec : GameplayCueDurationalSpec where T : GameplayCueDurational diff --git a/JEX_GAS/Assets/GAS/Runtime/Cue/CueAnimation.cs b/JEX_GAS/Assets/GAS/Runtime/Cue/CueAnimation.cs index f4a91900..4155a006 100644 --- a/JEX_GAS/Assets/GAS/Runtime/Cue/CueAnimation.cs +++ b/JEX_GAS/Assets/GAS/Runtime/Cue/CueAnimation.cs @@ -70,7 +70,7 @@ namespace GAS.Runtime public CueAnimationSpec(CueAnimation cue, GameplayCueParameters parameters) : base(cue, parameters) { - var transform = Owner.transform.Find(cue.AnimatorRelativePath); + var transform = Owner.GetView()?.transform.Find(cue.AnimatorRelativePath); _animator = cue.IncludeChildrenAnimator ? transform.GetComponentInChildren() : transform.GetComponent(); if (_animator == null) { @@ -78,7 +78,7 @@ namespace GAS.Runtime } } - public override void OnAdd() + public override void OnAdd(int frame,int startFrame,int endFrame) { if (_animator != null) { @@ -86,7 +86,7 @@ namespace GAS.Runtime } } - public override void OnRemove() + public override void OnRemove(int frame,int startFrame,int endFrame) { } @@ -98,7 +98,7 @@ namespace GAS.Runtime { } - public override void OnTick() + public override void OnTick(int frame,int startFrame,int endFrame) { } } diff --git a/JEX_GAS/Assets/GAS/Runtime/Cue/CueAnimationOneShot.cs b/JEX_GAS/Assets/GAS/Runtime/Cue/CueAnimationOneShot.cs index a04dd802..69fa7419 100644 --- a/JEX_GAS/Assets/GAS/Runtime/Cue/CueAnimationOneShot.cs +++ b/JEX_GAS/Assets/GAS/Runtime/Cue/CueAnimationOneShot.cs @@ -85,7 +85,7 @@ namespace GAS.Runtime public CueAnimationOneShotSpec(CueAnimationOneShot cue, GameplayCueParameters parameters) : base(cue, parameters) { - var transform = Owner.transform.Find(cue.AnimatorRelativePath); + var transform = Owner.GetView()?.transform.Find(cue.AnimatorRelativePath); if (transform != null) { _animator = cue.IncludeChildrenAnimator diff --git a/JEX_GAS/Assets/GAS/Runtime/Cue/CueAnimationSpeedModifier.cs b/JEX_GAS/Assets/GAS/Runtime/Cue/CueAnimationSpeedModifier.cs index e82501b6..62a1a490 100644 --- a/JEX_GAS/Assets/GAS/Runtime/Cue/CueAnimationSpeedModifier.cs +++ b/JEX_GAS/Assets/GAS/Runtime/Cue/CueAnimationSpeedModifier.cs @@ -43,7 +43,7 @@ namespace GAS.Runtime public GCS_ChangeAnimationSpeed(CueAnimationSpeedModifier cue, GameplayCueParameters parameters) : base(cue, parameters) { - var transform = Owner.transform.Find(cue.animatorRelativePath); + var transform = Owner.GetView()?.transform.Find(cue.animatorRelativePath); if (transform != null) { _animator = cue.includeChildrenAnimator @@ -58,11 +58,11 @@ namespace GAS.Runtime } } - public override void OnAdd() + public override void OnAdd(int frame,int startFrame,int endFrame) { } - public override void OnRemove() + public override void OnRemove(int frame,int startFrame,int endFrame) { } @@ -82,7 +82,7 @@ namespace GAS.Runtime } } - public override void OnTick() + public override void OnTick(int frame,int startFrame,int endFrame) { } } diff --git a/JEX_GAS/Assets/GAS/Runtime/Cue/CuePlaySound.cs b/JEX_GAS/Assets/GAS/Runtime/Cue/CuePlaySound.cs index ce9c6149..4c0788c3 100644 --- a/JEX_GAS/Assets/GAS/Runtime/Cue/CuePlaySound.cs +++ b/JEX_GAS/Assets/GAS/Runtime/Cue/CuePlaySound.cs @@ -31,27 +31,32 @@ namespace GAS.Runtime { if (cue.isAttachToOwner) { - _audioSource = Owner.gameObject.GetComponent(); + _audioSource = Owner.GetView()?.gameObject.GetComponent(); if (_audioSource == null) { - _audioSource = Owner.gameObject.AddComponent(); + _audioSource = Owner.GetView()?.gameObject.AddComponent(); } } else { var soundRoot = new GameObject("SoundRoot"); - soundRoot.transform.position = Owner.transform.position; + + if (Owner.GetView() is not null) + { + soundRoot.transform.position = Owner.GetView().transform.position; + } + _audioSource = soundRoot.AddComponent(); } } - public override void OnAdd() + public override void OnAdd(int frame,int startFrame,int endFrame) { _audioSource.clip = cue.soundEffect; _audioSource.Play(); } - public override void OnRemove() + public override void OnRemove(int frame,int startFrame,int endFrame) { if (!cue.isAttachToOwner) { @@ -71,7 +76,7 @@ namespace GAS.Runtime { } - public override void OnTick() + public override void OnTick(int frame,int startFrame,int endFrame) { } } diff --git a/JEX_GAS/Assets/GAS/Runtime/Cue/CueVFX.cs b/JEX_GAS/Assets/GAS/Runtime/Cue/CueVFX.cs index be169aa1..78e1ba10 100644 --- a/JEX_GAS/Assets/GAS/Runtime/Cue/CueVFX.cs +++ b/JEX_GAS/Assets/GAS/Runtime/Cue/CueVFX.cs @@ -86,18 +86,21 @@ namespace GAS.Runtime { } - public override void OnAdd() + public override void OnAdd(int frame,int startFrame,int endFrame) { if (cue.VfxPrefab != null) { - _vfxInstance = cue.IsAttachToTarget - ? Object.Instantiate(cue.VfxPrefab, Owner.transform) - : Object.Instantiate(cue.VfxPrefab, Owner.transform.position, Quaternion.identity); + if (Owner.GetView() is not null) + { + _vfxInstance = cue.IsAttachToTarget + ? Object.Instantiate(cue.VfxPrefab, Owner.GetView().transform) + : Object.Instantiate(cue.VfxPrefab, Owner.GetView().transform.position, Quaternion.identity); - _vfxInstance.transform.localPosition = cue.Offset; - _vfxInstance.transform.localEulerAngles = cue.Rotation; - _vfxInstance.transform.localScale = cue.Scale; - _vfxInstance.SetActive(cue.ActiveWhenAdded); + _vfxInstance.transform.localPosition = cue.Offset; + _vfxInstance.transform.localEulerAngles = cue.Rotation; + _vfxInstance.transform.localScale = cue.Scale; + _vfxInstance.SetActive(cue.ActiveWhenAdded); + } } else { @@ -107,7 +110,7 @@ namespace GAS.Runtime } } - public override void OnRemove() + public override void OnRemove(int frame,int startFrame,int endFrame) { if (_vfxInstance != null) { @@ -131,7 +134,7 @@ namespace GAS.Runtime } } - public override void OnTick() + public override void OnTick(int frame,int startFrame,int endFrame) { } diff --git a/JEX_GAS/Assets/GAS/Runtime/Effects/GameplayEffect.cs b/JEX_GAS/Assets/GAS/Runtime/Effects/GameplayEffect.cs index 7a1d3cb4..4a52c2d7 100644 --- a/JEX_GAS/Assets/GAS/Runtime/Effects/GameplayEffect.cs +++ b/JEX_GAS/Assets/GAS/Runtime/Effects/GameplayEffect.cs @@ -74,7 +74,7 @@ namespace GAS.Runtime float level = 1, object userData = null) { - var spec = ObjectPool.Instance.Fetch(); + var spec = JexGasObjectPool.Instance.Fetch(); spec.Awake(this, userData); spec.Init(creator, owner, level); return spec; @@ -86,7 +86,7 @@ namespace GAS.Runtime /// public EntityRef CreateSpec(object userData = null) { - var spec = ObjectPool.Instance.Fetch(); + var spec = JexGasObjectPool.Instance.Fetch(); spec.Awake(this, userData); return spec; } @@ -140,7 +140,7 @@ namespace GAS.Runtime return Array.Empty(); } - var grantedAbilityFromEffects = ObjectPool.Instance.Fetch>(); + var grantedAbilityFromEffects = JexGasObjectPool.Instance.Fetch>(); foreach (var grantedAbilityConfig in grantedAbilities) { if (grantedAbilityConfig.AbilityAsset != null) @@ -150,7 +150,7 @@ namespace GAS.Runtime var ret = GrantedAbilityFromEffectArrayPool.Fetch(grantedAbilityFromEffects.Count); grantedAbilityFromEffects.CopyTo(ret); grantedAbilityFromEffects.Clear(); - ObjectPool.Instance.Recycle(grantedAbilityFromEffects); + JexGasObjectPool.Instance.Recycle(grantedAbilityFromEffects); return ret; } diff --git a/JEX_GAS/Assets/GAS/Runtime/Effects/GameplayEffectContainer.cs b/JEX_GAS/Assets/GAS/Runtime/Effects/GameplayEffectContainer.cs index 3856c537..6b3bc630 100644 --- a/JEX_GAS/Assets/GAS/Runtime/Effects/GameplayEffectContainer.cs +++ b/JEX_GAS/Assets/GAS/Runtime/Effects/GameplayEffectContainer.cs @@ -24,7 +24,7 @@ namespace GAS.Runtime public void Tick() { - var gameplayEffectSpecs = ObjectPool.Instance.Fetch>(); + var gameplayEffectSpecs = JexGasObjectPool.Instance.Fetch>(); gameplayEffectSpecs.AddRange(_gameplayEffectSpecs); foreach (var gameplayEffectSpec in gameplayEffectSpecs) @@ -36,7 +36,7 @@ namespace GAS.Runtime } gameplayEffectSpecs.Clear(); - ObjectPool.Instance.Recycle(gameplayEffectSpecs); + JexGasObjectPool.Instance.Recycle(gameplayEffectSpecs); } public void RegisterOnGameplayEffectContainerIsDirty(Action action) @@ -53,7 +53,7 @@ namespace GAS.Runtime { if (tags.Empty) return; - var removeList = ObjectPool.Instance.Fetch>(); + var removeList = JexGasObjectPool.Instance.Fetch>(); foreach (var gameplayEffectSpec in _gameplayEffectSpecs) { @@ -71,7 +71,7 @@ namespace GAS.Runtime foreach (var gameplayEffectSpec in removeList) RemoveGameplayEffectSpec(gameplayEffectSpec); removeList.Clear(); - ObjectPool.Instance.Recycle(removeList); + JexGasObjectPool.Instance.Recycle(removeList); } /// diff --git a/JEX_GAS/Assets/GAS/Runtime/Effects/GameplayEffectSpec.cs b/JEX_GAS/Assets/GAS/Runtime/Effects/GameplayEffectSpec.cs index 5dd9b52e..9770c90a 100644 --- a/JEX_GAS/Assets/GAS/Runtime/Effects/GameplayEffectSpec.cs +++ b/JEX_GAS/Assets/GAS/Runtime/Effects/GameplayEffectSpec.cs @@ -36,7 +36,7 @@ namespace GAS.Runtime Modifiers = GameplayEffect.Modifiers; if (gameplayEffect.DurationPolicy != EffectsDurationPolicy.Instant) { - var periodTicker = ObjectPool.Instance.Fetch(); + var periodTicker = JexGasObjectPool.Instance.Fetch(); periodTicker.Awake(this); // EntityRef之前必须确定InstanceId的值 PeriodTicker = periodTicker; @@ -61,7 +61,7 @@ namespace GAS.Runtime if (gameplayEffectPeriodTicker != null) { gameplayEffectPeriodTicker.Release(); - ObjectPool.Instance.Recycle(gameplayEffectPeriodTicker); + JexGasObjectPool.Instance.Recycle(gameplayEffectPeriodTicker); } PeriodTicker = default; @@ -79,12 +79,12 @@ namespace GAS.Runtime if (grantedAbilitySpecFromEffect != null) { grantedAbilitySpecFromEffect.Release(); - ObjectPool.Instance.Recycle(grantedAbilitySpecFromEffect); + JexGasObjectPool.Instance.Recycle(grantedAbilitySpecFromEffect); } } GrantedAbilitiesSpecFromEffect.Clear(); - ObjectPool.Instance.Recycle(GrantedAbilitiesSpecFromEffect); + JexGasObjectPool.Instance.Recycle(GrantedAbilitiesSpecFromEffect); GrantedAbilitiesSpecFromEffect = default; } @@ -94,13 +94,13 @@ namespace GAS.Runtime if (SnapshotSourceAttributes != null) { SnapshotSourceAttributes.Clear(); - ObjectPool.Instance.Recycle(SnapshotSourceAttributes); + JexGasObjectPool.Instance.Recycle(SnapshotSourceAttributes); } if (SnapshotTargetAttributes != null && SnapshotSourceAttributes != SnapshotTargetAttributes) { SnapshotTargetAttributes.Clear(); - ObjectPool.Instance.Recycle(SnapshotTargetAttributes); + JexGasObjectPool.Instance.Recycle(SnapshotTargetAttributes); } SnapshotSourceAttributes = null; @@ -111,14 +111,14 @@ namespace GAS.Runtime if (_valueMapWithTag != null) { _valueMapWithTag.Clear(); - ObjectPool.Instance.Recycle(_valueMapWithTag); + JexGasObjectPool.Instance.Recycle(_valueMapWithTag); _valueMapWithTag = null; } if (_valueMapWithName != null) { _valueMapWithName.Clear(); - ObjectPool.Instance.Recycle(_valueMapWithName); + JexGasObjectPool.Instance.Recycle(_valueMapWithName); _valueMapWithName = null; } @@ -128,7 +128,7 @@ namespace GAS.Runtime OnStackChanged = default; } - ObjectPool.Instance.Recycle(this); + JexGasObjectPool.Instance.Recycle(this); } public void Init(AbilitySystemComponent source, AbilitySystemComponent owner, float level = 1) @@ -220,7 +220,7 @@ namespace GAS.Runtime if (grantedAbilityFromEffects is null) return; if (grantedAbilityFromEffects.Length == 0) return; - GrantedAbilitiesSpecFromEffect = ObjectPool.Instance.Fetch>>(); + GrantedAbilitiesSpecFromEffect = JexGasObjectPool.Instance.Fetch>>(); foreach (var grantedAbilityFromEffect in grantedAbilityFromEffects) { GrantedAbilitiesSpecFromEffect.Add(grantedAbilityFromEffect.CreateSpec(this)); @@ -236,12 +236,12 @@ namespace GAS.Runtime if (grantedAbilitySpecFromEffect != null) { grantedAbilitySpecFromEffect.Release(); - ObjectPool.Instance.Recycle(grantedAbilitySpecFromEffect); + JexGasObjectPool.Instance.Recycle(grantedAbilitySpecFromEffect); } } GrantedAbilitiesSpecFromEffect.Clear(); - ObjectPool.Instance.Recycle(GrantedAbilitiesSpecFromEffect); + JexGasObjectPool.Instance.Recycle(GrantedAbilitiesSpecFromEffect); } public void SetStacking(GameplayEffectStacking stacking) @@ -315,7 +315,7 @@ namespace GAS.Runtime ReleaseCueDurationalSpecs(); if (GameplayEffect.CueDurational is { Length: > 0 }) { - _cueDurationalSpecs = ObjectPool.Instance.Fetch>(); + _cueDurationalSpecs = JexGasObjectPool.Instance.Fetch>(); foreach (var cueDurational in GameplayEffect.CueDurational) { var cueSpec = cueDurational.ApplyFrom(this); @@ -323,7 +323,7 @@ namespace GAS.Runtime } foreach (var cue in _cueDurationalSpecs) - cue.OnAdd(); + cue.OnAdd(-1,-1,-1); } } catch (Exception e) @@ -342,7 +342,7 @@ namespace GAS.Runtime if (_cueDurationalSpecs != null) { foreach (var cue in _cueDurationalSpecs) - cue.OnRemove(); + cue.OnRemove(-1,-1,-1); } } catch (Exception e) @@ -401,7 +401,7 @@ namespace GAS.Runtime if (_cueDurationalSpecs != null) { foreach (var cue in _cueDurationalSpecs) - cue.OnTick(); + cue.OnTick(-1,-1,-1); } } catch (Exception e) @@ -487,7 +487,7 @@ namespace GAS.Runtime { case GameplayEffectSpecifiedSnapshotConfig.ESnapshotTarget.Source: { - SnapshotSourceAttributes ??= ObjectPool.Instance.Fetch>(); + SnapshotSourceAttributes ??= JexGasObjectPool.Instance.Fetch>(); var attribute = Source.AttributeSetContainer.GetAttributeAttributeValue(config.AttributeSetName, config.AttributeShortName); if (attribute != null) { @@ -502,7 +502,7 @@ namespace GAS.Runtime } case GameplayEffectSpecifiedSnapshotConfig.ESnapshotTarget.Target: { - SnapshotTargetAttributes ??= ObjectPool.Instance.Fetch>(); + SnapshotTargetAttributes ??= JexGasObjectPool.Instance.Fetch>(); var attribute = Owner.AttributeSetContainer.GetAttributeAttributeValue(config.AttributeSetName, config.AttributeShortName); if (attribute != null) { @@ -540,13 +540,13 @@ namespace GAS.Runtime public void RegisterValue(in GameplayTag tag, float value) { - _valueMapWithTag ??= ObjectPool.Instance.Fetch>(); + _valueMapWithTag ??= JexGasObjectPool.Instance.Fetch>(); _valueMapWithTag[tag] = value; } public void RegisterValue(string name, float value) { - _valueMapWithName ??= ObjectPool.Instance.Fetch>(); + _valueMapWithName ??= JexGasObjectPool.Instance.Fetch>(); _valueMapWithName[name] = value; } @@ -616,7 +616,7 @@ namespace GAS.Runtime if (_cueDurationalSpecs != null) { _cueDurationalSpecs.Clear(); - ObjectPool.Instance.Recycle(_cueDurationalSpecs); + JexGasObjectPool.Instance.Recycle(_cueDurationalSpecs); _cueDurationalSpecs = null; } } diff --git a/JEX_GAS/Assets/GAS/Runtime/Effects/GrantedAbilityFromEffect.cs b/JEX_GAS/Assets/GAS/Runtime/Effects/GrantedAbilityFromEffect.cs index b4172209..7f740c47 100644 --- a/JEX_GAS/Assets/GAS/Runtime/Effects/GrantedAbilityFromEffect.cs +++ b/JEX_GAS/Assets/GAS/Runtime/Effects/GrantedAbilityFromEffect.cs @@ -148,7 +148,7 @@ namespace GAS.Runtime public GrantedAbilitySpecFromEffect CreateSpec(GameplayEffectSpec sourceEffectSpec) { - var grantedAbilitySpecFromEffect = ObjectPool.Instance.Fetch(); + var grantedAbilitySpecFromEffect = JexGasObjectPool.Instance.Fetch(); grantedAbilitySpecFromEffect.Awake(this, sourceEffectSpec); return grantedAbilitySpecFromEffect; } @@ -178,7 +178,7 @@ namespace GAS.Runtime Owner = SourceEffectSpec.Owner; if (Owner.AbilityContainer.HasAbility(AbilityName)) { - Debug.LogError($"GrantedAbilitySpecFromEffect: {Owner.name} already has ability {AbilityName}"); + Debug.LogError($"GrantedAbilitySpecFromEffect: {Owner.EntityId} already has ability {AbilityName}"); } Owner.GrantAbility(GrantedAbility.Ability); diff --git a/JEX_GAS/Assets/GAS/Runtime/JexGasManager.cs b/JEX_GAS/Assets/GAS/Runtime/JexGasManager.cs new file mode 100644 index 00000000..fc15baa0 --- /dev/null +++ b/JEX_GAS/Assets/GAS/Runtime/JexGasManager.cs @@ -0,0 +1,29 @@ +using GAS.General; + +namespace GAS.Runtime +{ + /// + /// 帧同步 EX_GAS 管理器 每次游戏开始和结束必须调用 Awake Destroy + /// + public class JexGasManager + { + + public static void Awake() + { + //初始化 GAS 对象池 + JexGasObjectPool.Awake(); + } + + public static void Destroy() + { + //销毁 GAS 对象池 + JexGasObjectPool.Destroy(); + } + + public static void Update() + { + + } + + } +} \ No newline at end of file diff --git a/JEX_GAS/Assets/GAS/Runtime/JexGasManager.cs.meta b/JEX_GAS/Assets/GAS/Runtime/JexGasManager.cs.meta new file mode 100644 index 00000000..bd869cd6 --- /dev/null +++ b/JEX_GAS/Assets/GAS/Runtime/JexGasManager.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b0b041f9937946109449a4143e1072a7 +timeCreated: 1729241013 \ No newline at end of file diff --git a/JEX_GAS/Assets/GAS/Runtime/Tags/GameplayTagAggregator.cs b/JEX_GAS/Assets/GAS/Runtime/Tags/GameplayTagAggregator.cs index 929de4da..860143e8 100644 --- a/JEX_GAS/Assets/GAS/Runtime/Tags/GameplayTagAggregator.cs +++ b/JEX_GAS/Assets/GAS/Runtime/Tags/GameplayTagAggregator.cs @@ -157,7 +157,7 @@ namespace GAS.Runtime } else { - var list = ObjectPool.Instance.Fetch>(); + var list = JexGasObjectPool.Instance.Fetch>(); list.Add(source); _dynamicAddedTags.Add(tag, list); } @@ -172,7 +172,7 @@ namespace GAS.Runtime if (_dynamicAddedTags.TryGetValue(tag, out var addedTag)) { addedTag.Clear(); - ObjectPool.Instance.Recycle(addedTag); + JexGasObjectPool.Instance.Recycle(addedTag); dirty = _dynamicAddedTags.Remove(tag); } @@ -184,7 +184,7 @@ namespace GAS.Runtime } else { - var list = ObjectPool.Instance.Fetch>(); + var list = JexGasObjectPool.Instance.Fetch>(); list.Add(source); _dynamicRemovedTags.Add(tag, list); } @@ -205,7 +205,7 @@ namespace GAS.Runtime dirty = tagList.Count == 0; if (dirty) { - ObjectPool.Instance.Recycle(tagList); + JexGasObjectPool.Instance.Recycle(tagList); dynamicTag.Remove(tag); } } diff --git a/JEX_GAS/Assets/Main.unity b/JEX_GAS/Assets/Main.unity index 66d65893..e11e42f3 100644 --- a/JEX_GAS/Assets/Main.unity +++ b/JEX_GAS/Assets/Main.unity @@ -229,7 +229,6 @@ GameObject: - component: {fileID: 857251292} - component: {fileID: 857251291} - component: {fileID: 857251290} - - component: {fileID: 857251294} m_Layer: 0 m_Name: Cube m_TagString: Untagged @@ -316,26 +315,57 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 857251289} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalPosition: {x: 1, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &857251294 +--- !u!1 &1745439352 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1745439354} + - component: {fileID: 1745439353} + m_Layer: 0 + m_Name: Main + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1745439353 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 857251289} + m_GameObject: {fileID: 1745439352} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 183fdb9275244e99bf882bd2e9cb85d5, type: 3} + m_Script: {fileID: 11500000, guid: 0c3aa2f58b904ebe9fc64cc367c63d68, type: 3} m_Name: m_EditorClassIdentifier: - preset: {fileID: 11400000, guid: 7692a8d07949a5c46b6b5325ebb9a422, type: 2} +--- !u!4 &1745439354 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1745439352} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &2104190881 GameObject: m_ObjectHideFlags: 0