临时提交

This commit is contained in:
PC-20230316NUNE\Administrator
2024-10-18 17:48:59 +08:00
parent 8cea537319
commit 31db916fec
31 changed files with 315 additions and 107 deletions

View File

@@ -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;

View File

@@ -16,7 +16,7 @@ namespace GAS.Runtime
public void Tick()
{
var abilitySpecs = ObjectPool.Instance.Fetch<List<AbilitySpec>>();
var abilitySpecs = JexGasObjectPool.Instance.Fetch<List<AbilitySpec>>();
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;

View File

@@ -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);
}
}
}

View File

@@ -80,7 +80,7 @@ namespace GAS.Runtime
{
if (modifier.AttributeName == _processedAttribute.Name)
{
var modifierSpec = ObjectPool.Instance.Fetch<ModifierSpec>();
var modifierSpec = JexGasObjectPool.Instance.Fetch<ModifierSpec>();
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();

View File

@@ -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<string, float> Snapshot()
{
var snapshot = ObjectPool.Instance.Fetch<Dictionary<string, float>>();
var snapshot = JexGasObjectPool.Instance.Fetch<Dictionary<string, float>>();
foreach (var kv in _attributeSets)
{
var attributeSet = kv.Value;

View File

@@ -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();
}
/// <summary>
/// 返回视图
/// </summary>
/// <returns></returns>
public virtual GameObject GetView()
{
return null;
}
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: d737dff4fee4418e997631c8d083de40
timeCreated: 1729243645

View File

@@ -82,7 +82,7 @@ namespace GAS
{
Profiler.BeginSample($"{nameof(GameplayAbilitySystem)}::Tick()");
var abilitySystemComponents = ObjectPool.Instance.Fetch<List<AbilitySystemComponent>>();
var abilitySystemComponents = JexGasObjectPool.Instance.Fetch<List<AbilitySystemComponent>>();
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();
}

View File

@@ -34,11 +34,29 @@ namespace GAS.Runtime
{
}
public abstract void OnAdd();
public abstract void OnRemove();
/// <summary>
/// 添加
/// </summary>
/// <param name="frame">当前帧(不是Timeline类型则返回-1)</param>
/// <param name="startFrame">开始帧(不是Timeline类型则返回-1)</param>
/// <param name="endFrame">结束帧(不是Timeline类型则返回-1)</param>
public abstract void OnAdd(int frame,int startFrame,int endFrame);
/// <summary>
/// 移除
/// </summary>
/// <param name="frame">当前帧(不是Timeline类型则返回-1)</param>
/// <param name="startFrame">开始帧(不是Timeline类型则返回-1)</param>
/// <param name="endFrame">结束帧(不是Timeline类型则返回-1)</param>
public abstract void OnRemove(int frame,int startFrame,int endFrame);
public abstract void OnGameplayEffectActivate();
public abstract void OnGameplayEffectDeactivate();
public abstract void OnTick();
/// <summary>
/// Tick
/// </summary>
/// <param name="frame">当前帧(不是Timeline类型则返回-1)</param>
/// <param name="startFrame">开始帧(不是Timeline类型则返回-1)</param>
/// <param name="endFrame">结束帧(不是Timeline类型则返回-1)</param>
public abstract void OnTick(int frame,int startFrame,int endFrame);
}
public abstract class GameplayCueDurationalSpec<T> : GameplayCueDurationalSpec where T : GameplayCueDurational

View File

@@ -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<Animator>() : transform.GetComponent<Animator>();
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)
{
}
}

View File

@@ -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

View File

@@ -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)
{
}
}

View File

@@ -31,27 +31,32 @@ namespace GAS.Runtime
{
if (cue.isAttachToOwner)
{
_audioSource = Owner.gameObject.GetComponent<AudioSource>();
_audioSource = Owner.GetView()?.gameObject.GetComponent<AudioSource>();
if (_audioSource == null)
{
_audioSource = Owner.gameObject.AddComponent<AudioSource>();
_audioSource = Owner.GetView()?.gameObject.AddComponent<AudioSource>();
}
}
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<AudioSource>();
}
}
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)
{
}
}

View File

@@ -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)
{
}

View File

@@ -74,7 +74,7 @@ namespace GAS.Runtime
float level = 1,
object userData = null)
{
var spec = ObjectPool.Instance.Fetch<GameplayEffectSpec>();
var spec = JexGasObjectPool.Instance.Fetch<GameplayEffectSpec>();
spec.Awake(this, userData);
spec.Init(creator, owner, level);
return spec;
@@ -86,7 +86,7 @@ namespace GAS.Runtime
/// <returns></returns>
public EntityRef<GameplayEffectSpec> CreateSpec(object userData = null)
{
var spec = ObjectPool.Instance.Fetch<GameplayEffectSpec>();
var spec = JexGasObjectPool.Instance.Fetch<GameplayEffectSpec>();
spec.Awake(this, userData);
return spec;
}
@@ -140,7 +140,7 @@ namespace GAS.Runtime
return Array.Empty<GrantedAbilityFromEffect>();
}
var grantedAbilityFromEffects = ObjectPool.Instance.Fetch<List<GrantedAbilityFromEffect>>();
var grantedAbilityFromEffects = JexGasObjectPool.Instance.Fetch<List<GrantedAbilityFromEffect>>();
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;
}

View File

@@ -24,7 +24,7 @@ namespace GAS.Runtime
public void Tick()
{
var gameplayEffectSpecs = ObjectPool.Instance.Fetch<List<GameplayEffectSpec>>();
var gameplayEffectSpecs = JexGasObjectPool.Instance.Fetch<List<GameplayEffectSpec>>();
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<List<GameplayEffectSpec>>();
var removeList = JexGasObjectPool.Instance.Fetch<List<GameplayEffectSpec>>();
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);
}
/// <summary>

View File

@@ -36,7 +36,7 @@ namespace GAS.Runtime
Modifiers = GameplayEffect.Modifiers;
if (gameplayEffect.DurationPolicy != EffectsDurationPolicy.Instant)
{
var periodTicker = ObjectPool.Instance.Fetch<GameplayEffectPeriodTicker>();
var periodTicker = JexGasObjectPool.Instance.Fetch<GameplayEffectPeriodTicker>();
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<List<EntityRef<GrantedAbilitySpecFromEffect>>>();
GrantedAbilitiesSpecFromEffect = JexGasObjectPool.Instance.Fetch<List<EntityRef<GrantedAbilitySpecFromEffect>>>();
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<List<GameplayCueDurationalSpec>>();
_cueDurationalSpecs = JexGasObjectPool.Instance.Fetch<List<GameplayCueDurationalSpec>>();
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<Dictionary<string, float>>();
SnapshotSourceAttributes ??= JexGasObjectPool.Instance.Fetch<Dictionary<string, float>>();
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<Dictionary<string, float>>();
SnapshotTargetAttributes ??= JexGasObjectPool.Instance.Fetch<Dictionary<string, float>>();
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<Dictionary<GameplayTag, float>>();
_valueMapWithTag ??= JexGasObjectPool.Instance.Fetch<Dictionary<GameplayTag, float>>();
_valueMapWithTag[tag] = value;
}
public void RegisterValue(string name, float value)
{
_valueMapWithName ??= ObjectPool.Instance.Fetch<Dictionary<string, float>>();
_valueMapWithName ??= JexGasObjectPool.Instance.Fetch<Dictionary<string, float>>();
_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;
}
}

View File

@@ -148,7 +148,7 @@ namespace GAS.Runtime
public GrantedAbilitySpecFromEffect CreateSpec(GameplayEffectSpec sourceEffectSpec)
{
var grantedAbilitySpecFromEffect = ObjectPool.Instance.Fetch<GrantedAbilitySpecFromEffect>();
var grantedAbilitySpecFromEffect = JexGasObjectPool.Instance.Fetch<GrantedAbilitySpecFromEffect>();
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);

View File

@@ -0,0 +1,29 @@
using GAS.General;
namespace GAS.Runtime
{
/// <summary>
/// 帧同步 EX_GAS 管理器 每次游戏开始和结束必须调用 Awake Destroy
/// </summary>
public class JexGasManager
{
public static void Awake()
{
//初始化 GAS 对象池
JexGasObjectPool.Awake();
}
public static void Destroy()
{
//销毁 GAS 对象池
JexGasObjectPool.Destroy();
}
public static void Update()
{
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b0b041f9937946109449a4143e1072a7
timeCreated: 1729241013

View File

@@ -157,7 +157,7 @@ namespace GAS.Runtime
}
else
{
var list = ObjectPool.Instance.Fetch<List<object>>();
var list = JexGasObjectPool.Instance.Fetch<List<object>>();
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<List<object>>();
var list = JexGasObjectPool.Instance.Fetch<List<object>>();
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);
}
}