Collapsing Properties Update + Animation From Beat Method (#575)

* add entity to collapse function, start on new animation thingy

im gonna use fork lifter to demonstrate DoScaledAnimationFromBeatAsync() cuz it uses animations to cue the peas

also i fixed that months old bug where the fork lifter sfx wasn't playing correctly :/

* animation from beat functional, octo machine converted

this looks fantastic i can't wait to implement this into more things

* better anim function

this is more efficient AND it'll produce more consistent results when starting an animation between tempo changes :D
(it no longer iterates through a list twice)
This commit is contained in:
AstrlJelly
2023-10-27 16:19:11 -04:00
committed by GitHub
parent 7624ea6e88
commit b22de5abdb
28 changed files with 624 additions and 622 deletions

View File

@ -5,6 +5,7 @@ using UnityEngine;
using HeavenStudio.Editor.Track;
using Jukebox;
using Jukebox.Legacy;
using System.Linq;
namespace HeavenStudio.Editor
{
@ -111,12 +112,8 @@ namespace HeavenStudio.Editor
EventPropertyPrefab input = ePrefabs[p.propertyName].GetComponent<EventPropertyPrefab>();
foreach (var c in p.collapseParams)
{
List<GameObject> collapseables = new();
foreach (var s in c.collapseables)
{
collapseables.Add(ePrefabs[s]);
}
input.propertyCollapses.Add(new EventPropertyPrefab.PropertyCollapse(collapseables, c.CollapseOn));
List<GameObject> collapseables = c.collapseables.Select(x => ePrefabs[x]).ToList();
input.propertyCollapses.Add(new EventPropertyPrefab.PropertyCollapse(collapseables, c.CollapseOn, entity));
}
input.SetCollapses(p.parameter);
}

View File

@ -8,6 +8,7 @@ using TMPro;
using Starpelly;
using HeavenStudio.Util;
using Jukebox;
namespace HeavenStudio.Editor
{
@ -38,7 +39,7 @@ namespace HeavenStudio.Editor
{
foreach (var c in p.collapseables)
{
if (c != null) c.SetActive(p.collapseOn(type) && gameObject.activeSelf);
if (c != null) c.SetActive(p.collapseOn(type, p.entity) && gameObject.activeSelf);
}
}
}
@ -46,12 +47,14 @@ namespace HeavenStudio.Editor
public class PropertyCollapse
{
public List<GameObject> collapseables;
public Func<object, bool> collapseOn;
public Func<object, RiqEntity, bool> collapseOn;
public RiqEntity entity;
public PropertyCollapse(List<GameObject> collapseables, Func<object, bool> collapseOn)
public PropertyCollapse(List<GameObject> collapseables, Func<object, RiqEntity, bool> collapseOn, RiqEntity entity)
{
this.collapseables = collapseables;
this.collapseOn = collapseOn;
this.entity = entity;
}
}
}