mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-22 17:45:16 +00:00
Editor float property type. Swing high kicks for Space Soccer. Merge pull request #22 from jakobwcrowe/megaminerzero
Editor float property type. Swing high kicks for Space Soccer.
This commit is contained in:
commit
26af9ddce8
8 changed files with 1041 additions and 16 deletions
File diff suppressed because it is too large
Load diff
|
@ -24,6 +24,7 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
|||
public float dispensedBeat = 0;
|
||||
public bool dispensing;
|
||||
public float hitTimes;
|
||||
public float highKickSwing = 0f;
|
||||
private float lastSpriteRot;
|
||||
public bool canKick;
|
||||
public GameEvent kicked = new GameEvent();
|
||||
|
@ -66,7 +67,7 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
|||
|
||||
public void HighKick()
|
||||
{
|
||||
hitTimes += 1.5f;
|
||||
hitTimes += GetHighKickLength(false);
|
||||
|
||||
lastSpriteRot = spriteHolder.transform.eulerAngles.z;
|
||||
|
||||
|
@ -83,7 +84,7 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
|||
|
||||
public void Toe()
|
||||
{
|
||||
hitTimes += 1.5f;
|
||||
hitTimes += GetHighKickLength(true);
|
||||
|
||||
lastSpriteRot = spriteHolder.transform.eulerAngles.z;
|
||||
|
||||
|
@ -162,7 +163,7 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
|||
}
|
||||
else if (highKicked.enabled)
|
||||
{
|
||||
float normalizedBeatAnim = Conductor.instance.GetPositionFromBeat(highKicked.startBeat, 1.8f);
|
||||
float normalizedBeatAnim = Conductor.instance.GetPositionFromBeat(highKicked.startBeat, GetHighKickLength(false) + 0.3f);
|
||||
|
||||
highKickCurve.KeyPoints[1].transform.position = new Vector3(kicker.transform.position.x - 3.5f, kicker.transform.position.y - 6f);
|
||||
|
||||
|
@ -189,7 +190,7 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
|||
}
|
||||
else if (toe.enabled)
|
||||
{
|
||||
float normalizedBeatAnim = Conductor.instance.GetPositionFromBeat(toe.startBeat, 1.85f);
|
||||
float normalizedBeatAnim = Conductor.instance.GetPositionFromBeat(toe.startBeat, GetHighKickLength(true) + 0.35f);
|
||||
|
||||
if (!lastKickLeft)
|
||||
{
|
||||
|
@ -213,5 +214,24 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
|||
kickfx.SetActive(true);
|
||||
kickfx.transform.position = holder.transform.position;
|
||||
}
|
||||
|
||||
public float GetHighKickLength(bool fromToe)
|
||||
{
|
||||
if (highKickSwing == 0f)
|
||||
{
|
||||
return 1.5f;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fromToe)
|
||||
{
|
||||
return 2f - (1f - highKickSwing);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 2f - highKickSwing;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -201,6 +201,9 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
|||
{
|
||||
canHighKick = true;
|
||||
canKick = false;
|
||||
|
||||
if (ball)
|
||||
ball.highKickSwing = highKicks[i].valA;
|
||||
break;
|
||||
}
|
||||
else
|
||||
|
@ -255,7 +258,7 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
|||
}
|
||||
else if (ball.highKicked.enabled)
|
||||
{
|
||||
float normalizedBeat = Conductor.instance.GetPositionFromBeat(ball.highKicked.startBeat, 1.5f);
|
||||
float normalizedBeat = Conductor.instance.GetPositionFromBeat(ball.highKicked.startBeat, ball.GetHighKickLength(false));
|
||||
if (!kickPrepare)
|
||||
{
|
||||
float normalizedBeatPrepare = Conductor.instance.GetPositionFromBeat(ball.highKicked.startBeat, 1f);
|
||||
|
@ -293,7 +296,7 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
|||
}
|
||||
else if (ball.toe.enabled)
|
||||
{
|
||||
float normalizedBeat = Conductor.instance.GetPositionFromBeat(ball.toe.startBeat, 1.5f);
|
||||
float normalizedBeat = Conductor.instance.GetPositionFromBeat(ball.toe.startBeat, ball.GetHighKickLength(true));
|
||||
StateCheck(normalizedBeat, !player);
|
||||
CheckIfFall(normalizedBeat);
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace RhythmHeavenMania.Editor
|
|||
|
||||
[Header("Property Prefabs")]
|
||||
[SerializeField] private GameObject IntegerP;
|
||||
[SerializeField] private GameObject FloatP;
|
||||
[SerializeField] private GameObject DropdownP;
|
||||
|
||||
public Beatmap.Entity entity;
|
||||
|
@ -85,11 +86,17 @@ namespace RhythmHeavenMania.Editor
|
|||
{
|
||||
GameObject prefab = IntegerP;
|
||||
|
||||
if (type.GetType() == typeof(EntityTypes.Integer))
|
||||
var objType = type.GetType();
|
||||
|
||||
if (objType == typeof(EntityTypes.Integer))
|
||||
{
|
||||
prefab = IntegerP;
|
||||
}
|
||||
else if (type.GetType() == typeof(RhythmHeavenMania.Util.EasingFunction.Ease))
|
||||
else if (objType == typeof(EntityTypes.Float))
|
||||
{
|
||||
prefab = FloatP;
|
||||
}
|
||||
else if (objType == typeof(RhythmHeavenMania.Util.EasingFunction.Ease))
|
||||
{
|
||||
prefab = DropdownP;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,9 @@ namespace RhythmHeavenMania.Editor
|
|||
this.propertyName = propertyName;
|
||||
this.caption.text = caption;
|
||||
|
||||
if (type.GetType() == typeof(EntityTypes.Integer))
|
||||
var objType = type.GetType();
|
||||
|
||||
if (objType == typeof(EntityTypes.Integer))
|
||||
{
|
||||
var integer = ((EntityTypes.Integer)type);
|
||||
|
||||
|
@ -47,7 +49,29 @@ namespace RhythmHeavenMania.Editor
|
|||
parameterManager.entity[propertyName] = (int)slider.value;
|
||||
});
|
||||
}
|
||||
else if (type.GetType() == typeof(EasingFunction.Ease))
|
||||
else if (objType == typeof(EntityTypes.Float))
|
||||
{
|
||||
var fl = ((EntityTypes.Float)type);
|
||||
|
||||
slider.minValue = fl.min;
|
||||
slider.maxValue = fl.max;
|
||||
|
||||
slider.value = System.Convert.ToSingle(parameterManager.entity[propertyName]);
|
||||
inputField.text = slider.value.ToString("G4"); // G4 = Display no more than 4 decimal places.
|
||||
|
||||
slider.onValueChanged.AddListener(delegate
|
||||
{
|
||||
inputField.text = slider.value.ToString("G4");
|
||||
parameterManager.entity[propertyName] = (float)System.Math.Round(slider.value, 4);
|
||||
});
|
||||
|
||||
inputField.onEndEdit.AddListener(delegate
|
||||
{
|
||||
slider.value = (float)System.Math.Round(System.Convert.ToSingle(inputField.text), 4);
|
||||
parameterManager.entity[propertyName] = slider.value;
|
||||
});
|
||||
}
|
||||
else if (objType == typeof(EasingFunction.Ease))
|
||||
{
|
||||
List<TMP_Dropdown.OptionData> dropDownData = new List<TMP_Dropdown.OptionData>();
|
||||
for (int i = 0; i < System.Enum.GetValues(typeof(EasingFunction.Ease)).Length; i++)
|
||||
|
|
|
@ -2,6 +2,7 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
using TMPro;
|
||||
using Starpelly;
|
||||
|
@ -79,6 +80,15 @@ namespace RhythmHeavenMania.Editor.Track
|
|||
|
||||
public static Timeline instance { get; private set; }
|
||||
|
||||
private bool userIsEditingInputField
|
||||
{
|
||||
get
|
||||
{
|
||||
var selectedGO = EventSystem.current.currentSelectedGameObject;
|
||||
return selectedGO != null && (selectedGO.GetComponent<InputField>() != null || selectedGO.GetComponent<TMP_InputField>() != null);
|
||||
}
|
||||
}
|
||||
|
||||
#region Initializers
|
||||
|
||||
public void LoadRemix()
|
||||
|
@ -273,15 +283,15 @@ namespace RhythmHeavenMania.Editor.Track
|
|||
|
||||
CurrentTempo.text = $" = {Conductor.instance.songBpm}";
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Alpha1))
|
||||
if (Input.GetKeyDown(KeyCode.Alpha1) && !userIsEditingInputField)
|
||||
{
|
||||
timelineState.SetState(true, false, false);
|
||||
}
|
||||
else if (Input.GetKeyDown(KeyCode.Alpha2))
|
||||
else if (Input.GetKeyDown(KeyCode.Alpha2) && !userIsEditingInputField)
|
||||
{
|
||||
timelineState.SetState(false, true, false);
|
||||
}
|
||||
else if (Input.GetKeyDown(KeyCode.Alpha3))
|
||||
else if (Input.GetKeyDown(KeyCode.Alpha3) && !userIsEditingInputField)
|
||||
{
|
||||
timelineState.SetState(false, false, true);
|
||||
}
|
||||
|
@ -512,10 +522,16 @@ namespace RhythmHeavenMania.Editor.Track
|
|||
for (int i = 0; i < ep.Count; i++)
|
||||
{
|
||||
object returnVal = ep[i].parameter;
|
||||
if (ep[i].parameter.GetType() == typeof(EntityTypes.Integer))
|
||||
|
||||
var propertyType = returnVal.GetType();
|
||||
if (propertyType == typeof(EntityTypes.Integer))
|
||||
{
|
||||
returnVal = ((EntityTypes.Integer)ep[i].parameter).val;
|
||||
}
|
||||
else if (propertyType == typeof(EntityTypes.Float))
|
||||
{
|
||||
returnVal = ((EntityTypes.Float)ep[i].parameter).val;
|
||||
}
|
||||
|
||||
tempEntity[ep[i].propertyName] = returnVal;
|
||||
}
|
||||
|
|
|
@ -150,7 +150,7 @@ namespace RhythmHeavenMania
|
|||
{
|
||||
new GameAction("ball dispense", delegate { SpaceSoccer.instance.Dispense(eventCaller.currentBeat); }, 2f),
|
||||
new GameAction("keep-up", delegate { }, 4f, true),
|
||||
new GameAction("high kick-toe!", delegate { }, 3f),
|
||||
new GameAction("high kick-toe!", delegate { }, 3f, false, new List<Param>() { new Param("valA", new EntityTypes.Float(0, 1), "swing") }),
|
||||
}),
|
||||
new Minigame("djSchool", "DJ School \n<color=#eb5454>[Non-Playable]</color>", "008c97", false, false, new List<GameAction>()
|
||||
{
|
||||
|
|
|
@ -19,5 +19,19 @@ namespace RhythmHeavenMania
|
|||
this.max = max;
|
||||
}
|
||||
}
|
||||
|
||||
public struct Float
|
||||
{
|
||||
public float min;
|
||||
public float val;
|
||||
public float max;
|
||||
|
||||
public Float(float min, float max, float val = 0f)
|
||||
{
|
||||
this.min = min;
|
||||
this.val = val;
|
||||
this.max = max;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue