HeavenStudioPlus/Assets/Scripts/LevelEditor/EventSelector/EventPropertyPrefab.cs
AstrlJelly b22de5abdb
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)
2023-10-27 20:19:11 +00:00

61 lines
No EOL
1.8 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System;
using System.Linq;
using TMPro;
using Starpelly;
using HeavenStudio.Util;
using Jukebox;
namespace HeavenStudio.Editor
{
public class EventPropertyPrefab : MonoBehaviour
{
public TMP_Text caption;
protected string _captionText;
public EventParameterManager parameterManager;
public string propertyName;
public List<PropertyCollapse> propertyCollapses = new List<PropertyCollapse>();
public void SetProperties(string propertyName, object type, string caption) {}
public virtual void SetCollapses(object type) { }
public void InitProperties(string propertyName, string caption)
{
this.parameterManager = EventParameterManager.instance;
this.propertyName = propertyName;
_captionText = caption;
this.caption.text = _captionText;
}
public void UpdateCollapse(object type)
{
foreach (var p in propertyCollapses)
{
foreach (var c in p.collapseables)
{
if (c != null) c.SetActive(p.collapseOn(type, p.entity) && gameObject.activeSelf);
}
}
}
public class PropertyCollapse
{
public List<GameObject> collapseables;
public Func<object, RiqEntity, bool> collapseOn;
public RiqEntity entity;
public PropertyCollapse(List<GameObject> collapseables, Func<object, RiqEntity, bool> collapseOn, RiqEntity entity)
{
this.collapseables = collapseables;
this.collapseOn = collapseOn;
this.entity = entity;
}
}
}
}