更新至unity6并且更改Scriptable完成
This commit is contained in:
@@ -15,18 +15,30 @@ namespace Demo.Game
|
||||
InteractableIntervalThatCanScoreBest = 0
|
||||
}
|
||||
|
||||
[Content, SerializeField] private IInteraction MyInteractionModule;
|
||||
[Content, SerializeField] private IInteraction m_MyInteractionModule;
|
||||
[Content, SerializeField] private InteractiveEffectType MyInteractiveLevel = default;
|
||||
|
||||
private IInteraction MyInteractionModule
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_MyInteractionModule == null)
|
||||
m_MyInteractionModule = Parent.GetComponent<IInteraction>();
|
||||
return m_MyInteractionModule;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_MyInteractionModule = value;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void OnInit();
|
||||
public abstract void OnBegin();
|
||||
public abstract void OnEnd();
|
||||
|
||||
public override IEnumerator LoadScript(string script)
|
||||
protected override IEnumerator DoSomethingDuringApplyScript()
|
||||
{
|
||||
yield return base.LoadScript(script);
|
||||
if (MyInteractionModule == null)
|
||||
MyInteractionModule = Parent.GetComponent<IInteraction>();
|
||||
yield return base.DoSomethingDuringApplyScript();
|
||||
switch (MyInteractiveLevel)
|
||||
{
|
||||
case InteractiveEffectType.VisibleDuration:
|
||||
@@ -96,7 +108,6 @@ namespace Demo.Game
|
||||
}
|
||||
break;
|
||||
}
|
||||
MyInteractionModule = null;
|
||||
yield return base.UnloadScript();
|
||||
}
|
||||
|
||||
@@ -115,9 +126,9 @@ namespace Demo.Game
|
||||
/// </summary>
|
||||
/// <param name="type">VisibleDuration,InteractiveDuration,InteractableScoreInterval,InteractableIntervalThatCanScoreBest</param>
|
||||
[Convention.RScript.Variable.Attr.Method]
|
||||
public void SetInteractiveEffectType(string type)
|
||||
public void SetInteractiveEffectType(InteractiveEffectType type)
|
||||
{
|
||||
MyInteractiveLevel = Enum.Parse<InteractiveEffectType>(type);
|
||||
MyInteractiveLevel = type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,15 +128,6 @@ namespace Demo.Game
|
||||
|
||||
public const int JudgementLevelCount = 3;
|
||||
|
||||
public override IEnumerator LoadScript(string script)
|
||||
{
|
||||
yield return base.LoadScript(script);
|
||||
if (BestJudgementTimePoint <= 0)
|
||||
{
|
||||
DoSetupJudgement(0);
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerator UnloadScript()
|
||||
{
|
||||
yield return base.UnloadScript();
|
||||
@@ -324,9 +315,9 @@ namespace Demo.Game
|
||||
/// </summary>
|
||||
/// <param name="bestJudgementTimePoint">最佳判定点</param>
|
||||
[Convention.RScript.Variable.Attr.Method]
|
||||
public void SetupJudgement(string bestJudgementTimePoint)
|
||||
public void SetupJudgement(float bestJudgementTimePoint)
|
||||
{
|
||||
DoSetupJudgement(Parse(bestJudgementTimePoint));
|
||||
DoSetupJudgement(bestJudgementTimePoint);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -343,18 +334,18 @@ namespace Demo.Game
|
||||
/// (bestJudgementTimePoint-visibleDuration/2,bestJudgementTimePoint+visibleDuration/2)</param>
|
||||
[Convention.RScript.Variable.Attr.Method]
|
||||
public void SetupJudgementLevels(
|
||||
string bestJudgementTimePoint,
|
||||
string interactableIntervalThatCanScoreBest,
|
||||
string interactableScoreInterval,
|
||||
string interactiveDuration,
|
||||
string visibleDuration)
|
||||
float bestJudgementTimePoint,
|
||||
float interactableIntervalThatCanScoreBest,
|
||||
float interactableScoreInterval,
|
||||
float interactiveDuration,
|
||||
float visibleDuration)
|
||||
{
|
||||
DoSetupJudgementLevels(
|
||||
Parse(bestJudgementTimePoint),
|
||||
Parse(interactableIntervalThatCanScoreBest),
|
||||
Parse(interactableScoreInterval),
|
||||
Parse(interactiveDuration),
|
||||
Parse(visibleDuration));
|
||||
bestJudgementTimePoint,
|
||||
interactableIntervalThatCanScoreBest,
|
||||
interactableScoreInterval,
|
||||
interactiveDuration,
|
||||
visibleDuration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -362,18 +353,18 @@ namespace Demo.Game
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
[Convention.RScript.Variable.Attr.Method]
|
||||
public void SetVisibleDurationBegin(string value)
|
||||
public void SetVisibleDurationBegin(float value)
|
||||
{
|
||||
VisibleDuration.x = Parse(value);
|
||||
VisibleDuration.x = value;
|
||||
}
|
||||
/// <summary>
|
||||
/// 设置可见区间(显现但不可判定,3级判定区间)结束时间
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
[Convention.RScript.Variable.Attr.Method]
|
||||
public void SetVisibleDurationEnd(string value)
|
||||
public void SetVisibleDurationEnd(float value)
|
||||
{
|
||||
VisibleDuration.y = Parse(value);
|
||||
VisibleDuration.y = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -381,18 +372,18 @@ namespace Demo.Game
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
[Convention.RScript.Variable.Attr.Method]
|
||||
public void SetInteractiveDurationBegin(string value)
|
||||
public void SetInteractiveDurationBegin(float value)
|
||||
{
|
||||
InteractiveDuration.x = Parse(value);
|
||||
InteractiveDuration.x = value;
|
||||
}
|
||||
/// <summary>
|
||||
/// 设置2级判定区间(可判定但错误的)结束时间
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
[Convention.RScript.Variable.Attr.Method]
|
||||
public void SetInteractiveDurationEnd(string value)
|
||||
public void SetInteractiveDurationEnd(float value)
|
||||
{
|
||||
InteractiveDuration.y = Parse(value);
|
||||
InteractiveDuration.y = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -400,18 +391,18 @@ namespace Demo.Game
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
[Convention.RScript.Variable.Attr.Method]
|
||||
public void SetInteractableScoreIntervalBegin(string value)
|
||||
public void SetInteractableScoreIntervalBegin(float value)
|
||||
{
|
||||
InteractableScoreInterval.x = Parse(value);
|
||||
InteractableScoreInterval.x = value;
|
||||
}
|
||||
/// <summary>
|
||||
/// 设置1级判定区间(可判定的)结束时间
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
[Convention.RScript.Variable.Attr.Method]
|
||||
public void SetInteractableScoreIntervalEnd(string value)
|
||||
public void SetInteractableScoreIntervalEnd(float value)
|
||||
{
|
||||
InteractableScoreInterval.y = Parse(value);
|
||||
InteractableScoreInterval.y = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -419,9 +410,9 @@ namespace Demo.Game
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
[Convention.RScript.Variable.Attr.Method]
|
||||
public void SetInteractableIntervalThatCanScoreBestBegin(string value)
|
||||
public void SetInteractableIntervalThatCanScoreBestBegin(float value)
|
||||
{
|
||||
InteractableIntervalThatCanScoreBest.x = Parse(value);
|
||||
InteractableIntervalThatCanScoreBest.x = value;
|
||||
if (BestJudgementTimePoint < 0)
|
||||
{
|
||||
BestJudgementTimePoint = Mathf.Lerp(InteractableIntervalThatCanScoreBest.x, InteractableIntervalThatCanScoreBest.y, 0.5f);
|
||||
@@ -432,9 +423,9 @@ namespace Demo.Game
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
[Convention.RScript.Variable.Attr.Method]
|
||||
public void SetInteractableIntervalThatCanScoreBestEnd(string value)
|
||||
public void SetInteractableIntervalThatCanScoreBestEnd(float value)
|
||||
{
|
||||
InteractableIntervalThatCanScoreBest.y = Parse(value);
|
||||
InteractableIntervalThatCanScoreBest.y = value;
|
||||
if (BestJudgementTimePoint < 0)
|
||||
{
|
||||
BestJudgementTimePoint = Mathf.Lerp(InteractableIntervalThatCanScoreBest.x, InteractableIntervalThatCanScoreBest.y, 0.5f);
|
||||
|
||||
@@ -7,15 +7,26 @@ namespace Demo.Game
|
||||
public abstract class IJudgementHookObject : ScriptableObject, IHookInteraction
|
||||
{
|
||||
|
||||
[Content, SerializeField] private IInteraction MyInteractionModule;
|
||||
[Content, SerializeField] private IInteraction m_MyInteractionModule;
|
||||
private IInteraction MyInteractionModule
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_MyInteractionModule == null)
|
||||
m_MyInteractionModule = Parent.GetComponent<IInteraction>();
|
||||
return m_MyInteractionModule;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_MyInteractionModule = value;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void OnJudgement(IInteraction.JudgementLevel level);
|
||||
|
||||
public override IEnumerator LoadScript(string script)
|
||||
protected override IEnumerator DoSomethingDuringApplyScript()
|
||||
{
|
||||
yield return base.LoadScript(script);
|
||||
if (MyInteractionModule == null)
|
||||
MyInteractionModule = Parent.GetComponent<IInteraction>();
|
||||
yield return base.DoSomethingDuringApplyScript();
|
||||
MyInteractionModule.JudgementEvent.AddListener(OnJudgement);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user