基础案例 准备改帧同步了

This commit is contained in:
DESKTOP-5RP3AKU\Jisol
2024-10-21 02:09:30 +08:00
parent 44e2735899
commit cbacd5a501
117 changed files with 17049 additions and 4808 deletions

View File

@@ -1,5 +1,9 @@
using GAS.General;
using GAS.Runtime;
using GASSamples.Scripts;
using GASSamples.Scripts.Game.GAS;
using JNGame.Math;
using JNGame.Runtime.Odin.TypeCustomize;
using Sirenix.OdinInspector;
using UnityEngine;
@@ -10,10 +14,10 @@ namespace Demo.Scripts.GAS.GameplayCue
[BoxGroup]
[LabelText("开始位置")]
public Vector3 start;
public OdinLVector3 start;
[BoxGroup]
[LabelText("结束位置")]
public Vector3 end;
public OdinLVector3 end;
public override GameplayCueDurationalSpec CreateSpec(GameplayCueParameters parameters)
{
@@ -23,11 +27,11 @@ namespace Demo.Scripts.GAS.GameplayCue
#if UNITY_EDITOR
public override void OnEditorPreview(GameObject previewObject, int frameIndex, int startFrame, int endFrame)
{
Debug.Log($"GameplayCue_PlayerDemo01 {previewObject} {frameIndex}");
Debug.Log($"GameplayCueDurational_PlayerDemo01 {previewObject} {frameIndex}");
if (frameIndex >= startFrame && frameIndex <= endFrame)
{
previewObject.transform.position = Vector3.Lerp(start, end, (float)(frameIndex - startFrame) / endFrame);
previewObject.transform.position = Vector3.Lerp(start.ToVector3(), end.ToVector3(), (float)(frameIndex - startFrame) / endFrame);
}
}
@@ -38,13 +42,10 @@ namespace Demo.Scripts.GAS.GameplayCue
public class GameplayCueDurational_PlayerDemo01_Spec : GameplayCueDurationalSpec<GameplayCueDurational_PlayerDemo01>
{
private GameplayCueDurational_PlayerDemo01 Cue;
public GameplayCueDurational_PlayerDemo01_Spec(GameplayCueDurational_PlayerDemo01 cue, GameplayCueParameters parameters) : base(cue, parameters)
{
Cue = cue;
}
public override void OnAdd(int frame,int startFrame,int endFrame)
{
Debug.Log("GameplayCueDurational_PlayerDemo01_Spec OnAdd");
@@ -67,7 +68,10 @@ namespace Demo.Scripts.GAS.GameplayCue
public override void OnTick(int frame,int startFrame,int endFrame)
{
Debug.Log($"GameplayCueDurational_PlayerDemo01_Spec OnTick {frame}");
((GAbilitySystemComponent)Owner).Entity.Transform.Position = LVector3.Lerp(cue.start.ToLVector3(), cue.end.ToLVector3(), (LFloat)(frame - startFrame) / endFrame);
}
}

View File

@@ -1,4 +1,6 @@
using GAS.Runtime;
using GASSamples.Scripts.Game.GAS;
using JNGame.Math;
using UnityEngine;
namespace Demo.Scripts.GAS.GameplayCue
@@ -10,14 +12,6 @@ namespace Demo.Scripts.GAS.GameplayCue
Debug.Log($"GameplayCue_PlayerDemo01 CreateSpec");
return new GameplayCue_PlayerDemo01_Spec(this,parameters);
}
#if UNITY_EDITOR
public override void OnEditorPreview(GameObject previewObject, int frame, int startFrame)
{
Debug.Log($"GameplayCue_PlayerDemo01 {previewObject}");
}
#endif
}
public class GameplayCue_PlayerDemo01_Spec : GameplayCueInstantSpec
@@ -29,6 +23,7 @@ namespace Demo.Scripts.GAS.GameplayCue
public override void Trigger()
{
((GAbilitySystemComponent)Owner).Entity.Transform.Scale = new LVector3(LFloat.L05,LFloat.L05,LFloat.L05);
}
}

View File

@@ -0,0 +1,32 @@
using GAS.Runtime;
using GASSamples.Scripts.Game.GAS;
using JNGame.Math;
using UnityEngine;
namespace Demo.Scripts.GAS.GameplayCue
{
public class GameplayCue_PlayerDemo02 : GameplayCueInstant
{
public override GameplayCueInstantSpec CreateSpec(GameplayCueParameters parameters)
{
Debug.Log($"GameplayCue_PlayerDemo02 CreateSpec");
return new GameplayCue_PlayerDemo02_Spec(this,parameters);
}
}
public class GameplayCue_PlayerDemo02_Spec : GameplayCueInstantSpec
{
public GameplayCue_PlayerDemo02_Spec(GameplayCueInstant cue, GameplayCueParameters parameters) : base(cue, parameters)
{
}
public override void Trigger()
{
((GAbilitySystemComponent)Owner).Entity.Transform.Scale = new LVector3(1,1,1);
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 725500c3ce824f8daa3a4be247f4f131
timeCreated: 1729419424

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: dd4c4a195812409f935d57313ac16614
timeCreated: 1729418595

View File

@@ -0,0 +1,19 @@
using GAS.Runtime;
using JNGame.Math;
using UnityEngine;
namespace GASSamples.Scripts.GAS.MMC
{
/// <summary>
/// 基础运算
/// </summary>
[CreateAssetMenu(fileName = "AttrModCalculation", menuName = "GAS/MMC/AttrModCalculation")]
public class AttrModCalculation : ModifierMagnitudeCalculation
{
public override float CalculateMagnitude(GameplayEffectSpec spec, float modifierMagnitude)
{
return modifierMagnitude;
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b964e9ee395740d6b0f8e42978c1ba35
timeCreated: 1729418602