mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 10:46:17 +00:00
临时提交
This commit is contained in:
@@ -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
|
||||
|
@@ -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)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -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)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@@ -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)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user