mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-10 03:35:10 +00:00
Auto Spaceball dispense (#286)
This commit is contained in:
parent
14149b57e7
commit
8d375951a8
3 changed files with 19 additions and 8 deletions
|
@ -258,15 +258,20 @@ namespace HeavenStudio
|
|||
}
|
||||
}
|
||||
|
||||
public void SeekAheadAndDoPreEvent(double start, float seekTime = 2f)
|
||||
public void SeekAheadAndDoPreEvent(double start)
|
||||
{
|
||||
List<float> entities = Beatmap.entities.Select(c => c.beat).ToList();
|
||||
if (currentPreSequence < Beatmap.entities.Count && currentPreSequence >= 0)
|
||||
{
|
||||
var seekEntity = Beatmap.entities[currentPreSequence];
|
||||
|
||||
float seekTime = EventCaller.instance.GetGameAction(
|
||||
EventCaller.instance.GetMinigame(seekEntity.datamodel.Split(0)), seekEntity.datamodel.Split(1)).preFunctionLength;
|
||||
|
||||
if (start + seekTime >= entities[currentPreSequence])
|
||||
{
|
||||
float beat = Beatmap.entities[currentPreSequence].beat;
|
||||
var entitiesAtSameBeat = Beatmap.entities.FindAll(c => c.beat == Beatmap.entities[currentPreSequence].beat);
|
||||
float beat = seekEntity.beat;
|
||||
var entitiesAtSameBeat = Beatmap.entities.FindAll(c => c.beat == seekEntity.beat);
|
||||
SortEventsByPriority(entitiesAtSameBeat);
|
||||
foreach (DynamicBeatmap.DynamicEntity entity in entitiesAtSameBeat)
|
||||
{
|
||||
|
@ -340,7 +345,7 @@ namespace HeavenStudio
|
|||
//seek ahead to preload games that have assetbundles
|
||||
SeekAheadAndPreload(Conductor.instance.songPositionInBeatsAsDouble, seekTime);
|
||||
|
||||
SeekAheadAndDoPreEvent(Conductor.instance.songPositionInBeatsAsDouble, 2f);
|
||||
SeekAheadAndDoPreEvent(Conductor.instance.songPositionInBeatsAsDouble);
|
||||
|
||||
if (currentEvent < Beatmap.entities.Count && currentEvent >= 0)
|
||||
{
|
||||
|
|
|
@ -13,7 +13,9 @@ namespace HeavenStudio.Games.Loaders
|
|||
{
|
||||
new GameAction("shoot", "Pitch Ball")
|
||||
{
|
||||
function = delegate { Spaceball.instance.Shoot(eventCaller.currentEntity.beat, false, eventCaller.currentEntity["type"]); },
|
||||
function = delegate { Spaceball.instance.Shoot(eventCaller.currentEntity.beat, false, eventCaller.currentEntity["type"]); },
|
||||
preFunction = delegate { Spaceball.instance.PrepareDispenser(); },
|
||||
preFunctionLength = 1,
|
||||
defaultLength = 2,
|
||||
parameters = new List<Param>()
|
||||
{
|
||||
|
@ -22,7 +24,9 @@ namespace HeavenStudio.Games.Loaders
|
|||
},
|
||||
new GameAction("shootHigh", "Pitch High Ball")
|
||||
{
|
||||
function = delegate { Spaceball.instance.Shoot(eventCaller.currentEntity.beat, true, eventCaller.currentEntity["type"]); },
|
||||
function = delegate { Spaceball.instance.Shoot(eventCaller.currentEntity.beat, true, eventCaller.currentEntity["type"]); },
|
||||
preFunction = delegate { Spaceball.instance.PrepareDispenser(); },
|
||||
preFunctionLength = 1,
|
||||
defaultLength = 3,
|
||||
parameters = new List<Param>()
|
||||
{
|
||||
|
@ -56,7 +60,7 @@ namespace HeavenStudio.Games.Loaders
|
|||
{
|
||||
function = delegate { Spaceball.instance.PrepareDispenser(); },
|
||||
},
|
||||
});
|
||||
});;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -155,6 +155,7 @@ namespace HeavenStudio
|
|||
public int priority = 0;
|
||||
public EventCallback inactiveFunction = delegate { };
|
||||
public EventCallback preFunction = delegate { };
|
||||
public float preFunctionLength = 2.0f;
|
||||
|
||||
/// <summary>
|
||||
/// <para>Creates a block that can be used in the editor. The block's function and attributes are defined in the parentheses.</para>
|
||||
|
@ -172,7 +173,7 @@ namespace HeavenStudio
|
|||
/// <param name="hidden">Prevents the block from being shown in the game list. Block will still function normally if it is in the timeline.</param>
|
||||
/// <param name="preFunction">Runs two beats before this event is reached.</param>
|
||||
/// <param name="priority">Priority of this event. Higher priority events will be run first.</param>
|
||||
public GameAction(string actionName, string displayName, float defaultLength = 1, bool resizable = false, List<Param> parameters = null, EventCallback function = null, EventCallback inactiveFunction = null, EventCallback prescheduleFunction = null, bool hidden = false, EventCallback preFunction = null, int priority = 0)
|
||||
public GameAction(string actionName, string displayName, float defaultLength = 1, bool resizable = false, List<Param> parameters = null, EventCallback function = null, EventCallback inactiveFunction = null, EventCallback prescheduleFunction = null, bool hidden = false, EventCallback preFunction = null, int priority = 0, float preFunctionLength = 2.0f)
|
||||
{
|
||||
this.actionName = actionName;
|
||||
if (displayName == String.Empty) this.displayName = actionName;
|
||||
|
@ -186,6 +187,7 @@ namespace HeavenStudio
|
|||
this.inactiveFunction = inactiveFunction ?? delegate { };
|
||||
this.preFunction = prescheduleFunction ?? delegate { };
|
||||
this.priority = priority;
|
||||
this.preFunctionLength = preFunctionLength;
|
||||
|
||||
|
||||
//todo: converting to new versions of GameActions
|
||||
|
|
Loading…
Reference in a new issue