特效范例
This commit is contained in:
@@ -14,8 +14,14 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public float bloomTime;
|
||||
public float bloomPeak;
|
||||
|
||||
[Button("Test Bloom Shake")]
|
||||
|
||||
public BloomShake(float bloomTime, float bloomPeak)
|
||||
{
|
||||
this.effectTime = 0;
|
||||
this.bloomTime = bloomTime;
|
||||
this.bloomPeak = bloomPeak;
|
||||
}
|
||||
|
||||
public override void Adjust()
|
||||
{
|
||||
MMF_Player effect = LeanPool.Spawn(EditorManager.instance.basePrefabs.bloomShake).GetComponent<MMF_Player>();
|
||||
@@ -27,12 +33,40 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public override EffectBase_BM ConvertToBM()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
return new BloomShake_BM(bloomTime, bloomPeak);
|
||||
}
|
||||
|
||||
public override void SetUpInspector()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var container = inspector.GenerateContainer("Bloom Shake");
|
||||
var effectTimeField = inspector.GenerateInputField(this, container, "Bloom Time", nameof(bloomTime));
|
||||
var bloomPeakField = inspector.GenerateInputField(this, container, "Bloom Peak", nameof(bloomPeak));
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class BloomShake_BM : EffectBase_BM
|
||||
{
|
||||
public float bloomTime;
|
||||
public float bloomPeak;
|
||||
|
||||
public BloomShake_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public BloomShake_BM(float bloomTime, float bloomPeak)
|
||||
{
|
||||
this.effectTime = 0;
|
||||
this.bloomTime = bloomTime;
|
||||
this.bloomPeak = bloomPeak;
|
||||
}
|
||||
|
||||
public override EffectBase ConvertToGameType()
|
||||
{
|
||||
return new BloomShake(bloomTime, bloomPeak);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -11,10 +12,12 @@ namespace Ichni.RhythmGame
|
||||
public EffectSubmodule effectSubmodule { get; set; }
|
||||
public float time;
|
||||
|
||||
public static TimeEffectsCollection CreateTimeEffectsCollection(float time)
|
||||
public static TimeEffectsCollection GenerateElement(string name, Guid guid, List<string> tags,
|
||||
bool isFirstGenerated, GameElement parentElement, float time)
|
||||
{
|
||||
TimeEffectsCollection timeEffectsCollection = Instantiate(EditorManager.instance.basePrefabs.emptyObject)
|
||||
.AddComponent<TimeEffectsCollection>();
|
||||
timeEffectsCollection.Initialize(name, guid, tags, isFirstGenerated, parentElement);
|
||||
timeEffectsCollection.time = time;
|
||||
return timeEffectsCollection;
|
||||
}
|
||||
@@ -34,18 +37,53 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
|
||||
matchedBM = new TimeEffectsCollection_BM(this);
|
||||
}
|
||||
|
||||
public override void SetUpInspector()
|
||||
{
|
||||
var container = inspector.GenerateContainer("Time Effects Collection");
|
||||
var timeInputField = inspector.GenerateInputField(this, container, "Time", nameof(time));
|
||||
var addEffectButton = inspector.GenerateButton(this, container, "Add Effect", () =>
|
||||
{
|
||||
IHaveEffectSubmodule.EffectCollection.TryGetValue("BloomShake", out var effect);
|
||||
effectSubmodule.effectCollection["Default"].Add(effect);
|
||||
});
|
||||
|
||||
foreach (var effect in effectSubmodule.effectCollection["Default"])
|
||||
{
|
||||
effect.SetUpInspector();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
|
||||
public class TimeEffectsCollection_BM : GameElement_BM
|
||||
{
|
||||
public float time;
|
||||
|
||||
public TimeEffectsCollection_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public TimeEffectsCollection_BM(TimeEffectsCollection timeEffectsCollection)
|
||||
{
|
||||
time = timeEffectsCollection.time;
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
matchedElement = TimeEffectsCollection.GenerateElement("Time Effects Collection", elementGuid,
|
||||
tags, false, GetElement(attachedElementGuid), time);
|
||||
}
|
||||
|
||||
public override GameElement DuplicateBM(GameElement attached)
|
||||
{
|
||||
return TimeEffectsCollection.GenerateElement("Time Effects Collection", elementGuid,
|
||||
tags, false, attached, time);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user