mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-25 02:55:15 +00:00
Entity object parameters testing
This commit is contained in:
parent
b4483ef479
commit
be3c913c4e
27 changed files with 1413 additions and 264 deletions
File diff suppressed because it is too large
Load diff
|
@ -26,6 +26,25 @@ namespace RhythmHeavenMania
|
||||||
{
|
{
|
||||||
return this.MemberwiseClone();
|
return this.MemberwiseClone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public object this[string propertyName]
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return typeof(Entity).GetField(propertyName).GetValue(this);
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
typeof(Entity).GetField(propertyName).SetValue(this, value);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
UnityEngine.Debug.LogError($"You probably misspelled a paramater, or defined the object type wrong. Exception log: {ex}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
|
|
|
@ -153,7 +153,12 @@ namespace RhythmHeavenMania
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float GetLoopPositionFromBeat(float startBeat, float length)
|
public float GetLoopPositionFromBeat(float beatOffset, float length)
|
||||||
|
{
|
||||||
|
return Mathf.Repeat(songPositionInBeats + beatOffset, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float GetPositionFromBeat(float startBeat, float length)
|
||||||
{
|
{
|
||||||
float a = Mathp.Normalize(songPositionInBeats, startBeat, startBeat + length);
|
float a = Mathp.Normalize(songPositionInBeats, startBeat, startBeat + length);
|
||||||
return a;
|
return a;
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace RhythmHeavenMania.Games.ClappyTrio
|
||||||
public bool canHit;
|
public bool canHit;
|
||||||
|
|
||||||
private GameObject clapEffect;
|
private GameObject clapEffect;
|
||||||
int aceTimes = 0;
|
new int aceTimes = 0;
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
|
@ -45,7 +45,7 @@ namespace RhythmHeavenMania.Games.ClappyTrio
|
||||||
|
|
||||||
if (clapVacant == true)
|
if (clapVacant == true)
|
||||||
{
|
{
|
||||||
float normalizedBeat = (Conductor.instance.GetLoopPositionFromBeat(lastClapBeat, lastClapLength));
|
float normalizedBeat = (Conductor.instance.GetPositionFromBeat(lastClapBeat, lastClapLength));
|
||||||
|
|
||||||
/*if (normalizedBeat > Minigame.EarlyTime() && normalizedBeat < Minigame.PerfectTime() && lastIndex == 0)
|
/*if (normalizedBeat > Minigame.EarlyTime() && normalizedBeat < Minigame.PerfectTime() && lastIndex == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,8 +39,9 @@ namespace RhythmHeavenMania.Games.ForkLifter
|
||||||
handAnim.Play("Hand_Flick", 0, 0);
|
handAnim.Play("Hand_Flick", 0, 0);
|
||||||
GameObject fo = Instantiate(flickedObject);
|
GameObject fo = Instantiate(flickedObject);
|
||||||
fo.transform.parent = flickedObject.transform.parent;
|
fo.transform.parent = flickedObject.transform.parent;
|
||||||
fo.GetComponent<Pea>().startBeat = beat;
|
Pea pea = fo.GetComponent<Pea>();
|
||||||
fo.GetComponent<Pea>().type = type;
|
pea.startBeat = beat;
|
||||||
|
pea.type = type;
|
||||||
fo.SetActive(true);
|
fo.SetActive(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,139 +119,6 @@ namespace RhythmHeavenMania.Games.ForkLifter
|
||||||
public void Stab(Pea p)
|
public void Stab(Pea p)
|
||||||
{
|
{
|
||||||
if (isEating) return;
|
if (isEating) return;
|
||||||
/*var EligibleHits = ForkLifter.instance.EligibleHits;
|
|
||||||
bool canHit = (ForkLifter.instance.EligibleHits.Count > 0) && (currentHitInList < ForkLifter.instance.EligibleHits.Count);
|
|
||||||
|
|
||||||
int events = ForkLifter.instance.MultipleEventsAtOnce();
|
|
||||||
|
|
||||||
for (int pt = 0; pt < events; pt++)
|
|
||||||
{
|
|
||||||
if (canHit)
|
|
||||||
{
|
|
||||||
GameObject pea = new GameObject();
|
|
||||||
|
|
||||||
if (EligibleHits[currentHitInList].perfect)
|
|
||||||
{
|
|
||||||
pea.transform.parent = perfect.transform;
|
|
||||||
pea.transform.localScale = Vector2.one;
|
|
||||||
|
|
||||||
pea.transform.localPosition = Vector3.zero;
|
|
||||||
|
|
||||||
for (int i = 0; i < perfect.transform.childCount; i++)
|
|
||||||
{
|
|
||||||
perfect.transform.GetChild(i).transform.localPosition = new Vector3(0, (-1.67f - (0.15724f * i)) + 0.15724f * currentPerfectPeasOnFork);
|
|
||||||
}
|
|
||||||
|
|
||||||
SpriteRenderer psprite = pea.AddComponent<SpriteRenderer>();
|
|
||||||
psprite.sprite = ForkLifter.instance.peaHitSprites[EligibleHits[currentHitInList].gameObject.GetComponent<Pea>().type];
|
|
||||||
psprite.sortingOrder = 20;
|
|
||||||
switch (EligibleHits[currentHitInList].gameObject.GetComponent<Pea>().type)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
psprite.sortingOrder = 101;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
psprite.sortingOrder = 104;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
psprite.sortingOrder = 103;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
psprite.sortingOrder = 102;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
GameObject hitFXo = new GameObject();
|
|
||||||
hitFXo.transform.localPosition = new Vector3(1.9969f, -3.7026f);
|
|
||||||
hitFXo.transform.localScale = new Vector3(3.142196f, 3.142196f);
|
|
||||||
SpriteRenderer hfxs = hitFXo.AddComponent<SpriteRenderer>();
|
|
||||||
hfxs.sprite = hitFX;
|
|
||||||
hfxs.sortingOrder = 100;
|
|
||||||
hfxs.DOColor(new Color(1, 1, 1, 0), 0.05f).OnComplete(delegate { Destroy(hitFXo); });
|
|
||||||
|
|
||||||
FastEffectHit(ForkLifter.instance.EligibleHits[currentHitInList].gameObject.GetComponent<Pea>().type);
|
|
||||||
|
|
||||||
Jukebox.PlayOneShotGame("forkLifter/stab");
|
|
||||||
|
|
||||||
currentPerfectPeasOnFork++;
|
|
||||||
|
|
||||||
if (EligibleHits[currentHitInList].gameObject.GetComponent<Pea>().type == 1)
|
|
||||||
{
|
|
||||||
topbun = true;
|
|
||||||
}
|
|
||||||
else if (EligibleHits[currentHitInList].gameObject.GetComponent<Pea>().type == 2)
|
|
||||||
{
|
|
||||||
middleburger = true;
|
|
||||||
}
|
|
||||||
else if (EligibleHits[currentHitInList].gameObject.GetComponent<Pea>().type == 3)
|
|
||||||
{
|
|
||||||
bottombun = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
RemovePea();
|
|
||||||
|
|
||||||
GameProfiler.instance.IncreaseScore();
|
|
||||||
}
|
|
||||||
else if (EligibleHits[currentHitInList].early)
|
|
||||||
{
|
|
||||||
pea.transform.parent = early.transform;
|
|
||||||
pea.transform.localScale = Vector2.one;
|
|
||||||
|
|
||||||
pea.transform.localPosition = Vector3.zero;
|
|
||||||
pea.transform.localRotation = Quaternion.Euler(0, 0, 90);
|
|
||||||
|
|
||||||
for (int i = 0; i < early.transform.childCount; i++)
|
|
||||||
{
|
|
||||||
early.transform.GetChild(i).transform.localPosition = new Vector3(0, (-1.67f - (0.15724f * i)) + 0.15724f * currentEarlyPeasOnFork);
|
|
||||||
}
|
|
||||||
|
|
||||||
SpriteRenderer psprite = pea.AddComponent<SpriteRenderer>();
|
|
||||||
psprite.sprite = ForkLifter.instance.peaHitSprites[EligibleHits[currentHitInList].gameObject.GetComponent<Pea>().type];
|
|
||||||
psprite.sortingOrder = 20;
|
|
||||||
HitFXMiss(new Vector2(1.0424f, -4.032f), new Vector2(1.129612f, 1.129612f));
|
|
||||||
HitFXMiss(new Vector2(0.771f, -3.016f), new Vector2(1.71701f, 1.71701f));
|
|
||||||
HitFXMiss(new Vector2(2.598f, -2.956f), new Vector2(1.576043f, 1.576043f));
|
|
||||||
HitFXMiss(new Vector2(2.551f, -3.609f), new Vector2(1.200788f, 1.200788f));
|
|
||||||
|
|
||||||
FastEffectHit(ForkLifter.instance.EligibleHits[currentHitInList].gameObject.GetComponent<Pea>().type);
|
|
||||||
|
|
||||||
Jukebox.PlayOneShot("miss");
|
|
||||||
|
|
||||||
currentEarlyPeasOnFork++;
|
|
||||||
|
|
||||||
RemovePea();
|
|
||||||
}
|
|
||||||
else if (EligibleHits[currentHitInList].late)
|
|
||||||
{
|
|
||||||
pea.transform.parent = late.transform;
|
|
||||||
pea.transform.localScale = Vector2.one;
|
|
||||||
|
|
||||||
pea.transform.localPosition = Vector3.zero;
|
|
||||||
pea.transform.localRotation = Quaternion.Euler(0, 0, 90);
|
|
||||||
|
|
||||||
for (int i = 0; i < late.transform.childCount; i++)
|
|
||||||
{
|
|
||||||
late.transform.GetChild(i).transform.localPosition = new Vector3(0, (-1.67f - (0.15724f * i)) + 0.15724f * currentLatePeasOnFork);
|
|
||||||
}
|
|
||||||
|
|
||||||
SpriteRenderer psprite = pea.AddComponent<SpriteRenderer>();
|
|
||||||
psprite.sprite = ForkLifter.instance.peaHitSprites[EligibleHits[currentHitInList].gameObject.GetComponent<Pea>().type];
|
|
||||||
psprite.sortingOrder = 20;
|
|
||||||
HitFXMiss(new Vector2(1.0424f, -4.032f), new Vector2(1.129612f, 1.129612f));
|
|
||||||
HitFXMiss(new Vector2(0.771f, -3.016f), new Vector2(1.71701f, 1.71701f));
|
|
||||||
HitFXMiss(new Vector2(2.598f, -2.956f), new Vector2(1.576043f, 1.576043f));
|
|
||||||
HitFXMiss(new Vector2(2.551f, -3.609f), new Vector2(1.200788f, 1.200788f));
|
|
||||||
|
|
||||||
FastEffectHit(ForkLifter.instance.EligibleHits[currentHitInList].gameObject.GetComponent<Pea>().type);
|
|
||||||
|
|
||||||
Jukebox.PlayOneShot("miss");
|
|
||||||
|
|
||||||
currentLatePeasOnFork++;
|
|
||||||
|
|
||||||
RemovePea();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
if (p == null)
|
if (p == null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -166,11 +166,11 @@ namespace RhythmHeavenMania.Games.ForkLifter
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
float normalizedBeatAnim = Conductor.instance.GetLoopPositionFromBeat(startBeat, 2.45f);
|
float normalizedBeatAnim = Conductor.instance.GetPositionFromBeat(startBeat, 2.45f);
|
||||||
anim.Play("Flicked_Object", -1, normalizedBeatAnim);
|
anim.Play("Flicked_Object", -1, normalizedBeatAnim);
|
||||||
anim.speed = 0;
|
anim.speed = 0;
|
||||||
|
|
||||||
float normalizedBeat = Conductor.instance.GetLoopPositionFromBeat(startBeat, 2f);
|
float normalizedBeat = Conductor.instance.GetPositionFromBeat(startBeat, 2f);
|
||||||
|
|
||||||
StateCheck(normalizedBeat);
|
StateCheck(normalizedBeat);
|
||||||
|
|
||||||
|
|
|
@ -51,12 +51,12 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||||
{
|
{
|
||||||
if (!missed)
|
if (!missed)
|
||||||
{
|
{
|
||||||
float normalizedBeatAnim = Conductor.instance.GetLoopPositionFromBeat(startBeat, 1.25f);
|
float normalizedBeatAnim = Conductor.instance.GetPositionFromBeat(startBeat, 1.25f);
|
||||||
|
|
||||||
anim.Play("BombOut", 0, normalizedBeatAnim);
|
anim.Play("BombOut", 0, normalizedBeatAnim);
|
||||||
anim.speed = 0;
|
anim.speed = 0;
|
||||||
|
|
||||||
float normalizedBeat = Conductor.instance.GetLoopPositionFromBeat(startBeat, 0.75f);
|
float normalizedBeat = Conductor.instance.GetPositionFromBeat(startBeat, 0.75f);
|
||||||
|
|
||||||
StateCheckNoList(normalizedBeat);
|
StateCheckNoList(normalizedBeat);
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float normalizedBeatAnim = Conductor.instance.GetLoopPositionFromBeat(missBeat, 1f);
|
float normalizedBeatAnim = Conductor.instance.GetPositionFromBeat(missBeat, 1f);
|
||||||
anim.Play("BombMiss", 0, normalizedBeatAnim);
|
anim.Play("BombMiss", 0, normalizedBeatAnim);
|
||||||
anim.speed = 0;
|
anim.speed = 0;
|
||||||
RotHolder.transform.eulerAngles = new Vector3(0, 0, Mathf.Lerp(lastRot.z, lastRot.z - 180, normalizedBeatAnim));
|
RotHolder.transform.eulerAngles = new Vector3(0, 0, Mathf.Lerp(lastRot.z, lastRot.z - 180, normalizedBeatAnim));
|
||||||
|
@ -101,7 +101,7 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float normalizedBeatAnim = Conductor.instance.GetLoopPositionFromBeat(hitBeat, 3f);
|
float normalizedBeatAnim = Conductor.instance.GetPositionFromBeat(hitBeat, 3f);
|
||||||
anim.Play("BombHit", 0, normalizedBeatAnim);
|
anim.Play("BombHit", 0, normalizedBeatAnim);
|
||||||
anim.speed = 0;
|
anim.speed = 0;
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||||
{
|
{
|
||||||
if (inCombo)
|
if (inCombo)
|
||||||
{
|
{
|
||||||
comboNormalizedBeat = Conductor.instance.GetLoopPositionFromBeat(comboBeat, 1);
|
comboNormalizedBeat = Conductor.instance.GetPositionFromBeat(comboBeat, 1);
|
||||||
|
|
||||||
if (hitCombo)
|
if (hitCombo)
|
||||||
{
|
{
|
||||||
|
|
|
@ -117,7 +117,7 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||||
spriteComp.enabled = false;
|
spriteComp.enabled = false;
|
||||||
|
|
||||||
|
|
||||||
float time2Destroy = Conductor.instance.GetLoopPositionFromBeat(createBeat, 4);
|
float time2Destroy = Conductor.instance.GetPositionFromBeat(createBeat, 4);
|
||||||
|
|
||||||
if (time2Destroy >= 1)
|
if (time2Destroy >= 1)
|
||||||
Destroy(this.gameObject);
|
Destroy(this.gameObject);
|
||||||
|
@ -131,11 +131,11 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||||
animTime = 2.27777777777f;
|
animTime = 2.27777777777f;
|
||||||
}
|
}
|
||||||
|
|
||||||
float normalizedBeatAnim = Conductor.instance.GetLoopPositionFromBeat(startBeat, animTime);
|
float normalizedBeatAnim = Conductor.instance.GetPositionFromBeat(startBeat, animTime);
|
||||||
anim.Play(throwAnim, 0, normalizedBeatAnim);
|
anim.Play(throwAnim, 0, normalizedBeatAnim);
|
||||||
anim.speed = 0;
|
anim.speed = 0;
|
||||||
|
|
||||||
float normalizedBeat = Conductor.instance.GetLoopPositionFromBeat(startBeat, beatTime);
|
float normalizedBeat = Conductor.instance.GetPositionFromBeat(startBeat, beatTime);
|
||||||
|
|
||||||
Shadow.transform.localScale = Vector3.Lerp(new Vector3(4.12f, 4.12f), new Vector3(0.34f, 0.34f), shadowCurveScale.Evaluate(normalizedBeatAnim));
|
Shadow.transform.localScale = Vector3.Lerp(new Vector3(4.12f, 4.12f), new Vector3(0.34f, 0.34f), shadowCurveScale.Evaluate(normalizedBeatAnim));
|
||||||
Shadow.transform.localPosition = new Vector3(Mathf.Lerp(7.63f, endShadowThrowPos.x, shadowCurve.Evaluate(normalizedBeatAnim)), Mathf.Lerp(-12.26f, endShadowThrowPos.y, shadowCurve.Evaluate(normalizedBeatAnim)));
|
Shadow.transform.localPosition = new Vector3(Mathf.Lerp(7.63f, endShadowThrowPos.x, shadowCurve.Evaluate(normalizedBeatAnim)), Mathf.Lerp(-12.26f, endShadowThrowPos.y, shadowCurve.Evaluate(normalizedBeatAnim)));
|
||||||
|
@ -210,8 +210,8 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||||
|
|
||||||
if (!isHit && !isThrown)
|
if (!isHit && !isThrown)
|
||||||
{
|
{
|
||||||
float normalizedBeatAnim = Conductor.instance.GetLoopPositionFromBeat(hitBeat, 1.5f);
|
float normalizedBeatAnim = Conductor.instance.GetPositionFromBeat(hitBeat, 1.5f);
|
||||||
newHolder.transform.localPosition = new Vector3(transform.localPosition.x, Mathf.Lerp(0, 0.55f, Conductor.instance.GetLoopPositionFromBeat(hitBeat, 0.45f)));
|
newHolder.transform.localPosition = new Vector3(transform.localPosition.x, Mathf.Lerp(0, 0.55f, Conductor.instance.GetPositionFromBeat(hitBeat, 0.45f)));
|
||||||
Holder.transform.localPosition = new Vector3(Mathf.Lerp(lastPos.x, 0.9f, normalizedBeatAnim), Mathf.Lerp(lastPos.y, -3.43f, missCurve.Evaluate(normalizedBeatAnim)));
|
Holder.transform.localPosition = new Vector3(Mathf.Lerp(lastPos.x, 0.9f, normalizedBeatAnim), Mathf.Lerp(lastPos.y, -3.43f, missCurve.Evaluate(normalizedBeatAnim)));
|
||||||
Holder.transform.GetChild(0).transform.eulerAngles = new Vector3(0, 0, Mathf.Lerp(lastRot, lastRot - 523.203f, normalizedBeatAnim));
|
Holder.transform.GetChild(0).transform.eulerAngles = new Vector3(0, 0, Mathf.Lerp(lastRot, lastRot - 523.203f, normalizedBeatAnim));
|
||||||
Shadow.transform.localPosition = new Vector3(Mathf.Lerp(lastShadowX, 0.9f, normalizedBeatAnim), Shadow.transform.localPosition.y);
|
Shadow.transform.localPosition = new Vector3(Mathf.Lerp(lastShadowX, 0.9f, normalizedBeatAnim), Shadow.transform.localPosition.y);
|
||||||
|
@ -221,7 +221,7 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||||
{
|
{
|
||||||
if (isHit)
|
if (isHit)
|
||||||
{
|
{
|
||||||
float normalizedBeatAnim = Conductor.instance.GetLoopPositionFromBeat(hitBeat, 1.5f);
|
float normalizedBeatAnim = Conductor.instance.GetPositionFromBeat(hitBeat, 1.5f);
|
||||||
var y = Mathf.Lerp(lastPos.y, -3.27f, hitCurve.Evaluate(normalizedBeatAnim));
|
var y = Mathf.Lerp(lastPos.y, -3.27f, hitCurve.Evaluate(normalizedBeatAnim));
|
||||||
var x = Mathf.Lerp(lastPos.x, hitLength, hitCurveX.Evaluate(normalizedBeatAnim));
|
var x = Mathf.Lerp(lastPos.x, hitLength, hitCurveX.Evaluate(normalizedBeatAnim));
|
||||||
newHolder.transform.localPosition = new Vector3(transform.localPosition.x, Mathf.Lerp(0, 0.45f, hitCurveY.Evaluate(normalizedBeatAnim)));
|
newHolder.transform.localPosition = new Vector3(transform.localPosition.x, Mathf.Lerp(0, 0.45f, hitCurveY.Evaluate(normalizedBeatAnim)));
|
||||||
|
@ -236,8 +236,8 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||||
{
|
{
|
||||||
if (isHit)
|
if (isHit)
|
||||||
{
|
{
|
||||||
float normalizedBeatAnim = Conductor.instance.GetLoopPositionFromBeat(hitBeat, 1.5f);
|
float normalizedBeatAnim = Conductor.instance.GetPositionFromBeat(hitBeat, 1.5f);
|
||||||
newHolder.transform.localPosition = new Vector3(transform.localPosition.x, Mathf.Lerp(0, 0.55f, Conductor.instance.GetLoopPositionFromBeat(hitBeat, 0.45f)));
|
newHolder.transform.localPosition = new Vector3(transform.localPosition.x, Mathf.Lerp(0, 0.55f, Conductor.instance.GetPositionFromBeat(hitBeat, 0.45f)));
|
||||||
Holder.transform.localPosition = new Vector3(Mathf.Lerp(lastPos.x, 0.9f, normalizedBeatAnim), Mathf.Lerp(lastPos.y, -3.43f, missCurve.Evaluate(normalizedBeatAnim)));
|
Holder.transform.localPosition = new Vector3(Mathf.Lerp(lastPos.x, 0.9f, normalizedBeatAnim), Mathf.Lerp(lastPos.y, -3.43f, missCurve.Evaluate(normalizedBeatAnim)));
|
||||||
Holder.transform.GetChild(0).transform.eulerAngles = new Vector3(0, 0, Mathf.Lerp(lastRot, lastRot - 523.203f, normalizedBeatAnim));
|
Holder.transform.GetChild(0).transform.eulerAngles = new Vector3(0, 0, Mathf.Lerp(lastRot, lastRot - 523.203f, normalizedBeatAnim));
|
||||||
Shadow.transform.localPosition = new Vector3(Mathf.Lerp(lastShadowX, 0.9f, normalizedBeatAnim), Shadow.transform.localPosition.y);
|
Shadow.transform.localPosition = new Vector3(Mathf.Lerp(lastShadowX, 0.9f, normalizedBeatAnim), Shadow.transform.localPosition.y);
|
||||||
|
|
|
@ -111,7 +111,7 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
||||||
{
|
{
|
||||||
if (dispensing)
|
if (dispensing)
|
||||||
{
|
{
|
||||||
float normalizedBeatAnim = Conductor.instance.GetLoopPositionFromBeat(dispensedBeat, 2.35f);
|
float normalizedBeatAnim = Conductor.instance.GetPositionFromBeat(dispensedBeat, 2.35f);
|
||||||
|
|
||||||
dispenseCurve.KeyPoints[0].transform.position = new Vector3(kicker.transform.position.x - 6f, kicker.transform.position.y - 6f);
|
dispenseCurve.KeyPoints[0].transform.position = new Vector3(kicker.transform.position.x - 6f, kicker.transform.position.y - 6f);
|
||||||
dispenseCurve.KeyPoints[1].transform.position = new Vector3(kicker.transform.position.x - 1f, kicker.transform.position.y - 6f);
|
dispenseCurve.KeyPoints[1].transform.position = new Vector3(kicker.transform.position.x - 1f, kicker.transform.position.y - 6f);
|
||||||
|
@ -129,7 +129,7 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
||||||
}
|
}
|
||||||
else if (kicked.enabled)
|
else if (kicked.enabled)
|
||||||
{
|
{
|
||||||
float normalizedBeatAnim = Conductor.instance.GetLoopPositionFromBeat(kicked.startBeat, 1.5f);
|
float normalizedBeatAnim = Conductor.instance.GetPositionFromBeat(kicked.startBeat, 1.5f);
|
||||||
|
|
||||||
if (!lastKickLeft)
|
if (!lastKickLeft)
|
||||||
{
|
{
|
||||||
|
@ -162,7 +162,7 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
||||||
}
|
}
|
||||||
else if (highKicked.enabled)
|
else if (highKicked.enabled)
|
||||||
{
|
{
|
||||||
float normalizedBeatAnim = Conductor.instance.GetLoopPositionFromBeat(highKicked.startBeat, 1.8f);
|
float normalizedBeatAnim = Conductor.instance.GetPositionFromBeat(highKicked.startBeat, 1.8f);
|
||||||
|
|
||||||
highKickCurve.KeyPoints[1].transform.position = new Vector3(kicker.transform.position.x - 3.5f, kicker.transform.position.y - 6f);
|
highKickCurve.KeyPoints[1].transform.position = new Vector3(kicker.transform.position.x - 3.5f, kicker.transform.position.y - 6f);
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
||||||
}
|
}
|
||||||
else if (toe.enabled)
|
else if (toe.enabled)
|
||||||
{
|
{
|
||||||
float normalizedBeatAnim = Conductor.instance.GetLoopPositionFromBeat(toe.startBeat, 1.85f);
|
float normalizedBeatAnim = Conductor.instance.GetPositionFromBeat(toe.startBeat, 1.85f);
|
||||||
|
|
||||||
if (!lastKickLeft)
|
if (!lastKickLeft)
|
||||||
{
|
{
|
||||||
|
|
|
@ -213,7 +213,7 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
||||||
{
|
{
|
||||||
if (ball.dispensing)
|
if (ball.dispensing)
|
||||||
{
|
{
|
||||||
float normalizedBeat = Conductor.instance.GetLoopPositionFromBeat(ball.dispensedBeat, 2f);
|
float normalizedBeat = Conductor.instance.GetPositionFromBeat(ball.dispensedBeat, 2f);
|
||||||
StateCheck(normalizedBeat, !player);
|
StateCheck(normalizedBeat, !player);
|
||||||
CheckIfFall(normalizedBeat);
|
CheckIfFall(normalizedBeat);
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
||||||
}
|
}
|
||||||
else if (ball.kicked.enabled)
|
else if (ball.kicked.enabled)
|
||||||
{
|
{
|
||||||
float normalizedBeat = Conductor.instance.GetLoopPositionFromBeat(ball.kicked.startBeat, 1f);
|
float normalizedBeat = Conductor.instance.GetPositionFromBeat(ball.kicked.startBeat, 1f);
|
||||||
StateCheck(normalizedBeat, !player);
|
StateCheck(normalizedBeat, !player);
|
||||||
CheckIfFall(normalizedBeat);
|
CheckIfFall(normalizedBeat);
|
||||||
|
|
||||||
|
@ -255,10 +255,10 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
||||||
}
|
}
|
||||||
else if (ball.highKicked.enabled)
|
else if (ball.highKicked.enabled)
|
||||||
{
|
{
|
||||||
float normalizedBeat = Conductor.instance.GetLoopPositionFromBeat(ball.highKicked.startBeat, 1.5f);
|
float normalizedBeat = Conductor.instance.GetPositionFromBeat(ball.highKicked.startBeat, 1.5f);
|
||||||
if (!kickPrepare)
|
if (!kickPrepare)
|
||||||
{
|
{
|
||||||
float normalizedBeatPrepare = Conductor.instance.GetLoopPositionFromBeat(ball.highKicked.startBeat, 1f);
|
float normalizedBeatPrepare = Conductor.instance.GetPositionFromBeat(ball.highKicked.startBeat, 1f);
|
||||||
StateCheck(normalizedBeatPrepare, !player);
|
StateCheck(normalizedBeatPrepare, !player);
|
||||||
CheckIfFall(normalizedBeat);
|
CheckIfFall(normalizedBeat);
|
||||||
|
|
||||||
|
@ -293,7 +293,7 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
||||||
}
|
}
|
||||||
else if (ball.toe.enabled)
|
else if (ball.toe.enabled)
|
||||||
{
|
{
|
||||||
float normalizedBeat = Conductor.instance.GetLoopPositionFromBeat(ball.toe.startBeat, 1.5f);
|
float normalizedBeat = Conductor.instance.GetPositionFromBeat(ball.toe.startBeat, 1.5f);
|
||||||
StateCheck(normalizedBeat, !player);
|
StateCheck(normalizedBeat, !player);
|
||||||
CheckIfFall(normalizedBeat);
|
CheckIfFall(normalizedBeat);
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace RhythmHeavenMania.Games.Spaceball
|
||||||
{
|
{
|
||||||
if (Conductor.instance.isPlaying && !isShowing)
|
if (Conductor.instance.isPlaying && !isShowing)
|
||||||
{
|
{
|
||||||
// anim.Play("AlienSwing", 0, Conductor.instance.loopPositionInAnalog * 2);
|
anim.Play("AlienSwing", 0, Conductor.instance.GetLoopPositionFromBeat(0, 1f));
|
||||||
anim.speed = 0;
|
anim.speed = 0;
|
||||||
}
|
}
|
||||||
else if (!Conductor.instance.isPlaying)
|
else if (!Conductor.instance.isPlaying)
|
||||||
|
@ -31,7 +31,7 @@ namespace RhythmHeavenMania.Games.Spaceball
|
||||||
|
|
||||||
if (isShowing)
|
if (isShowing)
|
||||||
{
|
{
|
||||||
float normalizedBeat = Conductor.instance.GetLoopPositionFromBeat(showBeat, 1f);
|
float normalizedBeat = Conductor.instance.GetPositionFromBeat(showBeat, 1f);
|
||||||
anim.Play("AlienShow", 0, normalizedBeat);
|
anim.Play("AlienShow", 0, normalizedBeat);
|
||||||
anim.speed = 0;
|
anim.speed = 0;
|
||||||
|
|
||||||
|
|
|
@ -59,17 +59,6 @@ namespace RhythmHeavenMania.Games.Spaceball
|
||||||
{
|
{
|
||||||
/*try
|
/*try
|
||||||
{
|
{
|
||||||
var allPlayerActions = EventCaller.GetAllPlayerEntities("spaceball");
|
|
||||||
int currentPlayerEvent = GameManager.instance.currentPlayerEvent - EventCaller.GetAllPlayerEntitiesExceptBeforeBeat("spaceball", Conductor.instance.songPositionInBeats).Count;
|
|
||||||
|
|
||||||
if (currentPlayerEvent < allPlayerActions.Count)
|
|
||||||
{
|
|
||||||
if (Conductor.instance.songPositionInBeats > allPlayerActions[currentPlayerEvent].beat - 1)
|
|
||||||
{
|
|
||||||
Dispenser.GetComponent<Animator>().Play("DispenserPrepare", 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (currentZoomIndex < allCameraEvents.Count && currentZoomIndex >= 0)
|
if (currentZoomIndex < allCameraEvents.Count && currentZoomIndex >= 0)
|
||||||
{
|
{
|
||||||
if (Conductor.instance.songPositionInBeats >= allCameraEvents[currentZoomIndex].beat)
|
if (Conductor.instance.songPositionInBeats >= allCameraEvents[currentZoomIndex].beat)
|
||||||
|
@ -79,7 +68,7 @@ namespace RhythmHeavenMania.Games.Spaceball
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float normalizedBeat = Conductor.instance.GetLoopPositionFromBeat(currentZoomCamBeat, currentZoomCamLength);
|
float normalizedBeat = Conductor.instance.GetPositionFromBeat(currentZoomCamBeat, currentZoomCamLength);
|
||||||
|
|
||||||
if (normalizedBeat > Minigame.EndTime())
|
if (normalizedBeat > Minigame.EndTime())
|
||||||
{
|
{
|
||||||
|
@ -158,6 +147,11 @@ namespace RhythmHeavenMania.Games.Spaceball
|
||||||
Dispenser.GetComponent<Animator>().Play("DispenserShoot", 0, 0);
|
Dispenser.GetComponent<Animator>().Play("DispenserShoot", 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void PrepareDispenser()
|
||||||
|
{
|
||||||
|
Dispenser.GetComponent<Animator>().Play("DispenserPrepare", 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
public void Costume(int type)
|
public void Costume(int type)
|
||||||
{
|
{
|
||||||
SpaceballPlayer.instance.SetCostume(type);
|
SpaceballPlayer.instance.SetCostume(type);
|
||||||
|
|
|
@ -81,7 +81,7 @@ namespace RhythmHeavenMania.Games.Spaceball
|
||||||
{
|
{
|
||||||
if (hit)
|
if (hit)
|
||||||
{
|
{
|
||||||
float nba = Conductor.instance.GetLoopPositionFromBeat(hitBeat, 14);
|
float nba = Conductor.instance.GetPositionFromBeat(hitBeat, 14);
|
||||||
Holder.transform.localPosition = Vector3.Lerp(hitPos, new Vector3(randomEndPosX, 0f, -600f), nba);
|
Holder.transform.localPosition = Vector3.Lerp(hitPos, new Vector3(randomEndPosX, 0f, -600f), nba);
|
||||||
Holder.transform.eulerAngles = Vector3.Lerp(new Vector3(0, 0, hitRot), new Vector3(0, 0, -2260), nba);
|
Holder.transform.eulerAngles = Vector3.Lerp(new Vector3(0, 0, hitRot), new Vector3(0, 0, -2260), nba);
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ namespace RhythmHeavenMania.Games.Spaceball
|
||||||
float beatLength = 1f;
|
float beatLength = 1f;
|
||||||
if (high) beatLength = 2f;
|
if (high) beatLength = 2f;
|
||||||
|
|
||||||
float normalizedBeatAnim = Conductor.instance.GetLoopPositionFromBeat(startBeat, beatLength + 0.15f);
|
float normalizedBeatAnim = Conductor.instance.GetPositionFromBeat(startBeat, beatLength + 0.15f);
|
||||||
// print(normalizedBeatAnim + " " + Time.frameCount);
|
// print(normalizedBeatAnim + " " + Time.frameCount);
|
||||||
|
|
||||||
if (high)
|
if (high)
|
||||||
|
@ -104,7 +104,7 @@ namespace RhythmHeavenMania.Games.Spaceball
|
||||||
|
|
||||||
anim.speed = 0;
|
anim.speed = 0;
|
||||||
|
|
||||||
float normalizedBeat = Conductor.instance.GetLoopPositionFromBeat(startBeat, beatLength);
|
float normalizedBeat = Conductor.instance.GetPositionFromBeat(startBeat, beatLength);
|
||||||
|
|
||||||
StateCheck(normalizedBeat);
|
StateCheck(normalizedBeat);
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,8 @@ namespace RhythmHeavenMania.Editor
|
||||||
|
|
||||||
private bool clickedInTimeline = false;
|
private bool clickedInTimeline = false;
|
||||||
|
|
||||||
|
private TMPro.TMP_Text sizeText;
|
||||||
|
|
||||||
public static BoxSelection instance { get; private set; }
|
public static BoxSelection instance { get; private set; }
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
|
@ -36,6 +38,8 @@ namespace RhythmHeavenMania.Editor
|
||||||
Color boxCol = EditorTheme.theme.properties.BoxSelectionCol.Hex2RGB();
|
Color boxCol = EditorTheme.theme.properties.BoxSelectionCol.Hex2RGB();
|
||||||
boxVisual.GetComponent<Image>().color = new Color(boxCol.r, boxCol.g, boxCol.b, 0.3f);
|
boxVisual.GetComponent<Image>().color = new Color(boxCol.r, boxCol.g, boxCol.b, 0.3f);
|
||||||
boxVisual.transform.GetChild(0).GetComponent<Image>().color = EditorTheme.theme.properties.BoxSelectionOutlineCol.Hex2RGB();
|
boxVisual.transform.GetChild(0).GetComponent<Image>().color = EditorTheme.theme.properties.BoxSelectionOutlineCol.Hex2RGB();
|
||||||
|
|
||||||
|
sizeText = boxVisual.transform.GetChild(1).GetComponent<TMPro.TMP_Text>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
|
@ -57,9 +61,9 @@ namespace RhythmHeavenMania.Editor
|
||||||
}
|
}
|
||||||
|
|
||||||
if (boxVisual.rect.width * boxVisual.transform.localScale.x >= 0.5f)
|
if (boxVisual.rect.width * boxVisual.transform.localScale.x >= 0.5f)
|
||||||
boxVisual.transform.GetChild(1).GetComponent<TMPro.TMP_Text>().text = $"{string.Format("{0:0.000}", boxVisual.rect.width * boxVisual.transform.localScale.x)}";
|
sizeText.text = $"{string.Format("{0:0.000}", boxVisual.rect.width * boxVisual.transform.localScale.x)}";
|
||||||
else
|
else
|
||||||
boxVisual.transform.GetChild(1).GetComponent<TMPro.TMP_Text>().text = string.Empty; // i'm lazy
|
sizeText.text = string.Empty; // i'm lazy
|
||||||
|
|
||||||
|
|
||||||
// click
|
// click
|
||||||
|
@ -162,7 +166,7 @@ namespace RhythmHeavenMania.Editor
|
||||||
|
|
||||||
public Vector3 MousePosition()
|
public Vector3 MousePosition()
|
||||||
{
|
{
|
||||||
var mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
|
var mousePos = Editor.instance.EditorCamera.ScreenToWorldPoint(Input.mousePosition);
|
||||||
// var mousePos = new Vector2();
|
// var mousePos = new Vector2();
|
||||||
// RectTransformUtility.ScreenPointToLocalPointInRectangle(timelineContent, Input.mousePosition, Camera.main, out mousePos);
|
// RectTransformUtility.ScreenPointToLocalPointInRectangle(timelineContent, Input.mousePosition, Camera.main, out mousePos);
|
||||||
return new Vector3(mousePos.x, mousePos.y, 0);
|
return new Vector3(mousePos.x, mousePos.y, 0);
|
||||||
|
|
|
@ -50,6 +50,7 @@ namespace RhythmHeavenMania.Editor
|
||||||
|
|
||||||
[Header("Properties")]
|
[Header("Properties")]
|
||||||
private bool changedMusic = false;
|
private bool changedMusic = false;
|
||||||
|
private bool loadedMusic = false;
|
||||||
private string currentRemixPath = "";
|
private string currentRemixPath = "";
|
||||||
private int lastEditorObjectsCount = 0;
|
private int lastEditorObjectsCount = 0;
|
||||||
private bool fullscreen;
|
private bool fullscreen;
|
||||||
|
@ -95,20 +96,6 @@ namespace RhythmHeavenMania.Editor
|
||||||
|
|
||||||
public void LateUpdate()
|
public void LateUpdate()
|
||||||
{
|
{
|
||||||
// This is buggy
|
|
||||||
/*if (Conductor.instance.isPlaying || Conductor.instance.isPaused)
|
|
||||||
{
|
|
||||||
GetComponent<Selections>().enabled = false;
|
|
||||||
GetComponent<Selector>().enabled = false;
|
|
||||||
GetComponent<BoxSelection>().enabled = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
GetComponent<Selections>().enabled = true;
|
|
||||||
GetComponent<Selector>().enabled = true;
|
|
||||||
GetComponent<BoxSelection>().enabled = true;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
if (Input.GetKeyDown(KeyCode.Tab))
|
if (Input.GetKeyDown(KeyCode.Tab))
|
||||||
{
|
{
|
||||||
Fullscreen();
|
Fullscreen();
|
||||||
|
@ -147,23 +134,38 @@ namespace RhythmHeavenMania.Editor
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Timeline.instance.timelineState.selected == true)
|
if (Timeline.instance.timelineState.selected == true)
|
||||||
if (Input.GetMouseButtonUp(0))
|
|
||||||
{
|
{
|
||||||
List<TimelineEventObj> selectedEvents = Timeline.instance.eventObjs.FindAll(c => c.selected == true && c.eligibleToMove == true);
|
if (Input.GetMouseButtonUp(0))
|
||||||
|
{
|
||||||
|
List<TimelineEventObj> selectedEvents = Timeline.instance.eventObjs.FindAll(c => c.selected == true && c.eligibleToMove == true);
|
||||||
|
|
||||||
|
if (selectedEvents.Count > 0)
|
||||||
|
{
|
||||||
|
List<TimelineEventObj> result = new List<TimelineEventObj>();
|
||||||
|
|
||||||
|
for (int i = 0; i < selectedEvents.Count; i++)
|
||||||
|
{
|
||||||
|
if (selectedEvents[i].isCreating == false)
|
||||||
|
{
|
||||||
|
result.Add(selectedEvents[i]);
|
||||||
|
}
|
||||||
|
selectedEvents[i].OnUp();
|
||||||
|
}
|
||||||
|
CommandManager.instance.Execute(new Commands.Move(result));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Input.GetMouseButtonUp(1))
|
||||||
|
{
|
||||||
|
List<TimelineEventObj> selectedEvents = Timeline.instance.eventObjs.FindAll(c => c.selected == true);
|
||||||
|
|
||||||
if (selectedEvents.Count > 0)
|
if (selectedEvents.Count > 0)
|
||||||
{
|
{
|
||||||
List<TimelineEventObj> result = new List<TimelineEventObj>();
|
|
||||||
|
|
||||||
for (int i = 0; i < selectedEvents.Count; i++)
|
for (int i = 0; i < selectedEvents.Count; i++)
|
||||||
{
|
{
|
||||||
if (selectedEvents[i].isCreating == false)
|
// EventParameterManager.instance.StartParams(selectedEvents[i].entity);
|
||||||
{
|
|
||||||
result.Add(selectedEvents[i]);
|
|
||||||
}
|
|
||||||
selectedEvents[i].OnUp();
|
|
||||||
}
|
}
|
||||||
CommandManager.instance.Execute(new Commands.Move(result));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,6 +194,14 @@ namespace RhythmHeavenMania.Editor
|
||||||
}
|
}
|
||||||
|
|
||||||
lastEditorObjectsCount = GameManager.instance.BeatmapEntities();
|
lastEditorObjectsCount = GameManager.instance.BeatmapEntities();
|
||||||
|
|
||||||
|
if (Application.isEditor)
|
||||||
|
{
|
||||||
|
if (Input.GetKeyDown(KeyCode.S))
|
||||||
|
{
|
||||||
|
SaveRemix(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Sprite GameIcon(string name)
|
public static Sprite GameIcon(string name)
|
||||||
|
@ -217,11 +227,6 @@ namespace RhythmHeavenMania.Editor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// byte[] bytes = OggVorbis.VorbisPlugin.GetOggVorbis(Conductor.instance.musicSource.clip, 1);
|
|
||||||
// print(bytes.Length);
|
|
||||||
// OggVorbis.VorbisPlugin.Save(@"C:/Users/Braedon/Downloads/test.ogg", Conductor.instance.musicSource.clip, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<AudioClip> LoadClip(string path)
|
private async Task<AudioClip> LoadClip(string path)
|
||||||
|
@ -301,7 +306,7 @@ namespace RhythmHeavenMania.Editor
|
||||||
{
|
{
|
||||||
using (FileStream zipFile = File.Open(path, FileMode.Create))
|
using (FileStream zipFile = File.Open(path, FileMode.Create))
|
||||||
{
|
{
|
||||||
using (var archive = new ZipArchive(zipFile, ZipArchiveMode.Update, true))
|
using (var archive = new ZipArchive(zipFile, ZipArchiveMode.Update))
|
||||||
{
|
{
|
||||||
var levelFile = archive.CreateEntry("remix.json", System.IO.Compression.CompressionLevel.NoCompression);
|
var levelFile = archive.CreateEntry("remix.json", System.IO.Compression.CompressionLevel.NoCompression);
|
||||||
using (var zipStream = levelFile.Open())
|
using (var zipStream = levelFile.Open())
|
||||||
|
@ -362,6 +367,7 @@ namespace RhythmHeavenMania.Editor
|
||||||
stream.CopyTo(ms);
|
stream.CopyTo(ms);
|
||||||
bytes = ms.ToArray();
|
bytes = ms.ToArray();
|
||||||
Conductor.instance.musicSource.clip = OggVorbis.VorbisPlugin.ToAudioClip(bytes, "music");
|
Conductor.instance.musicSource.clip = OggVorbis.VorbisPlugin.ToAudioClip(bytes, "music");
|
||||||
|
loadedMusic = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -410,17 +416,6 @@ namespace RhythmHeavenMania.Editor
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DebugSave()
|
|
||||||
{
|
|
||||||
// temp
|
|
||||||
#if UNITY_EDITOR
|
|
||||||
string path = UnityEditor.AssetDatabase.GetAssetPath(GameManager.instance.txt);
|
|
||||||
path = Application.dataPath.Remove(Application.dataPath.Length - 6, 6) + path;
|
|
||||||
System.IO.File.WriteAllText(path, JsonConvert.SerializeObject(GameManager.instance.Beatmap));
|
|
||||||
Debug.Log("Saved to " + path);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetGameEventTitle(string txt)
|
public void SetGameEventTitle(string txt)
|
||||||
{
|
{
|
||||||
GameEventSelectorTitle.text = txt;
|
GameEventSelectorTitle.text = txt;
|
||||||
|
|
|
@ -0,0 +1,76 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace RhythmHeavenMania.Editor
|
||||||
|
{
|
||||||
|
public class EventParameterManager : MonoBehaviour
|
||||||
|
{
|
||||||
|
[Header("General References")]
|
||||||
|
[SerializeField] private GameObject eventSelector;
|
||||||
|
|
||||||
|
[Header("Property Prefabs")]
|
||||||
|
[SerializeField] private GameObject IntegerP;
|
||||||
|
|
||||||
|
public Beatmap.Entity entity;
|
||||||
|
|
||||||
|
public static EventParameterManager instance { get; set; }
|
||||||
|
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
instance = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StartParams(Beatmap.Entity entity)
|
||||||
|
{
|
||||||
|
AddParams(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddParams(Beatmap.Entity entity)
|
||||||
|
{
|
||||||
|
var minigame = EventCaller.instance.GetMinigame(entity.datamodel.Split(0));
|
||||||
|
int actionIndex = minigame.actions.IndexOf(minigame.actions.Find(c => c.actionName == entity.datamodel.Split(1)));
|
||||||
|
Minigames.GameAction action = minigame.actions[actionIndex];
|
||||||
|
|
||||||
|
if (action.parameters != null)
|
||||||
|
{
|
||||||
|
eventSelector.SetActive(false);
|
||||||
|
this.entity = entity;
|
||||||
|
|
||||||
|
Editor.instance.SetGameEventTitle($"Properties for {entity.datamodel}");
|
||||||
|
|
||||||
|
for (int i = 1; i < transform.childCount; i++)
|
||||||
|
{
|
||||||
|
Destroy(transform.GetChild(i).gameObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < action.parameters.Count; i++)
|
||||||
|
{
|
||||||
|
object param = action.parameters[i].parameter;
|
||||||
|
string caption = action.parameters[i].propertyCaption;
|
||||||
|
string propertyName = action.parameters[i].propertyName;
|
||||||
|
|
||||||
|
AddParam(propertyName, param, caption);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddParam(string propertyName, object type, string caption)
|
||||||
|
{
|
||||||
|
GameObject prefab = IntegerP;
|
||||||
|
|
||||||
|
if (type.GetType() == typeof(EntityTypes.Integer))
|
||||||
|
{
|
||||||
|
prefab = IntegerP;
|
||||||
|
}
|
||||||
|
|
||||||
|
GameObject input = Instantiate(prefab);
|
||||||
|
input.transform.SetParent(this.gameObject.transform);
|
||||||
|
input.SetActive(true);
|
||||||
|
input.transform.localScale = Vector2.one;
|
||||||
|
|
||||||
|
var property = input.GetComponent<EventPropertyPrefab>();
|
||||||
|
property.SetProperties(propertyName, type, caption);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c8ae907a3485c8a43b30312182de8b1b
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -0,0 +1,37 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
using TMPro;
|
||||||
|
|
||||||
|
namespace RhythmHeavenMania.Editor
|
||||||
|
{
|
||||||
|
public class EventPropertyPrefab : MonoBehaviour
|
||||||
|
{
|
||||||
|
public TMP_Text caption;
|
||||||
|
public Slider slider;
|
||||||
|
public TMP_InputField inputField;
|
||||||
|
|
||||||
|
private string propertyName;
|
||||||
|
|
||||||
|
[SerializeField] private EventParameterManager parameterManager;
|
||||||
|
|
||||||
|
public void SetProperties(string propertyName, object type, string caption)
|
||||||
|
{
|
||||||
|
this.propertyName = propertyName;
|
||||||
|
this.caption.text = caption;
|
||||||
|
|
||||||
|
var integer = ((EntityTypes.Integer)type);
|
||||||
|
|
||||||
|
slider.minValue = integer.min;
|
||||||
|
slider.maxValue = integer.max;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void TestChange()
|
||||||
|
{
|
||||||
|
inputField.text = slider.value.ToString();
|
||||||
|
parameterManager.entity[propertyName] = (int)slider.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3b7c76a246115c1459c963e93f7db056
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -541,7 +541,7 @@ namespace RhythmHeavenMania.Editor.Track
|
||||||
{
|
{
|
||||||
if (Input.GetMouseButton(1))
|
if (Input.GetMouseButton(1))
|
||||||
{
|
{
|
||||||
PlaybackSpeed.transform.GetChild(3).GetComponent<TMP_Text>().text = $"Playback Speed: 1.0x";
|
PlaybackSpeed.transform.GetChild(3).GetComponent<TMP_Text>().text = $"Playback Speed: 1x";
|
||||||
PlaybackSpeed.value = 1f;
|
PlaybackSpeed.value = 1f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,20 +146,20 @@ namespace RhythmHeavenMania.Editor.Track
|
||||||
{
|
{
|
||||||
Vector3 mousePos = Editor.instance.EditorCamera.ScreenToWorldPoint(Input.mousePosition);
|
Vector3 mousePos = Editor.instance.EditorCamera.ScreenToWorldPoint(Input.mousePosition);
|
||||||
|
|
||||||
// lastPos_ = transform.localPosition;
|
lastPos_ = transform.localPosition;
|
||||||
|
|
||||||
// this.transform.position = new Vector3(mousePos.x - startPosX, mousePos.y - startPosY - 0.40f, 0);
|
this.transform.position = new Vector3(mousePos.x - startPosX, mousePos.y - startPosY - 0.40f, 0);
|
||||||
// this.transform.localPosition = new Vector3(Mathf.Clamp(Mathp.Round2Nearest(this.transform.localPosition.x, 0.25f), 0, Mathf.Infinity), Timeline.instance.SnapToLayer(this.transform.localPosition.y));
|
this.transform.localPosition = new Vector3(Mathf.Clamp(Mathp.Round2Nearest(this.transform.localPosition.x, 0.25f), 0, Mathf.Infinity), Timeline.instance.SnapToLayer(this.transform.localPosition.y));
|
||||||
moveTemp.transform.position = new Vector3(mousePos.x - startPosX, mousePos.y - startPosY - 0.40f, 0);
|
// moveTemp.transform.position = new Vector3(mousePos.x - startPosX, mousePos.y - startPosY - 0.40f, 0);
|
||||||
moveTemp.transform.localPosition = new Vector3(Mathf.Clamp(Mathp.Round2Nearest(moveTemp.transform.localPosition.x, 0.25f), 0, Mathf.Infinity), Timeline.instance.SnapToLayer(moveTemp.transform.localPosition.y));
|
// moveTemp.transform.localPosition = new Vector3(Mathf.Clamp(Mathp.Round2Nearest(moveTemp.transform.localPosition.x, 0.25f), 0, Mathf.Infinity), Timeline.instance.SnapToLayer(moveTemp.transform.localPosition.y));
|
||||||
|
|
||||||
if (lastPos != moveTemp.transform.localPosition)
|
if (lastPos != transform.localPosition)
|
||||||
{
|
{
|
||||||
OnMove();
|
OnMove();
|
||||||
this.transform.DOLocalMove(new Vector3(Mathf.Clamp(Mathp.Round2Nearest(moveTemp.transform.localPosition.x, 0.25f), 0, Mathf.Infinity), Timeline.instance.SnapToLayer(moveTemp.transform.localPosition.y)), 0.15f).SetEase(Ease.OutExpo);
|
// this.transform.DOLocalMove(new Vector3(Mathf.Clamp(Mathp.Round2Nearest(moveTemp.transform.localPosition.x, 0.25f), 0, Mathf.Infinity), Timeline.instance.SnapToLayer(moveTemp.transform.localPosition.y)), 0.15f).SetEase(Ease.OutExpo);
|
||||||
}
|
}
|
||||||
|
|
||||||
lastPos = moveTemp.transform.localPosition;
|
lastPos = transform.localPosition;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (resizingLeft)
|
else if (resizingLeft)
|
||||||
|
@ -231,20 +231,23 @@ namespace RhythmHeavenMania.Editor.Track
|
||||||
|
|
||||||
public void OnDown()
|
public void OnDown()
|
||||||
{
|
{
|
||||||
if (selected && Timeline.instance.timelineState.selected)
|
if (Input.GetMouseButton(0))
|
||||||
{
|
{
|
||||||
lastPos_ = transform.localPosition;
|
if (selected && Timeline.instance.timelineState.selected)
|
||||||
|
|
||||||
for (int i = 0; i < Timeline.instance.eventObjs.Count; i++)
|
|
||||||
{
|
{
|
||||||
Vector3 mousePos = Editor.instance.EditorCamera.ScreenToWorldPoint(Input.mousePosition);
|
lastPos_ = transform.localPosition;
|
||||||
Timeline.instance.eventObjs[i].startPosX = mousePos.x - Timeline.instance.eventObjs[i].transform.position.x;
|
|
||||||
Timeline.instance.eventObjs[i].startPosY = mousePos.y - Timeline.instance.eventObjs[i].transform.position.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
moving = true;
|
for (int i = 0; i < Timeline.instance.eventObjs.Count; i++)
|
||||||
// lastMovePos = transform.localPosition;
|
{
|
||||||
// OnComplete();
|
Vector3 mousePos = Editor.instance.EditorCamera.ScreenToWorldPoint(Input.mousePosition);
|
||||||
|
Timeline.instance.eventObjs[i].startPosX = mousePos.x - Timeline.instance.eventObjs[i].transform.position.x;
|
||||||
|
Timeline.instance.eventObjs[i].startPosY = mousePos.y - Timeline.instance.eventObjs[i].transform.position.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
moving = true;
|
||||||
|
// lastMovePos = transform.localPosition;
|
||||||
|
// OnComplete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,13 +42,30 @@ namespace RhythmHeavenMania
|
||||||
public EventCallback function;
|
public EventCallback function;
|
||||||
public float defaultLength;
|
public float defaultLength;
|
||||||
public bool resizable;
|
public bool resizable;
|
||||||
|
public List<Param> parameters;
|
||||||
|
|
||||||
public GameAction(string actionName, EventCallback function, float defaultLength = 1, bool resizable = false)
|
public GameAction(string actionName, EventCallback function, float defaultLength = 1, bool resizable = false, List<Param> parameters = null)
|
||||||
{
|
{
|
||||||
this.actionName = actionName;
|
this.actionName = actionName;
|
||||||
this.function = function;
|
this.function = function;
|
||||||
this.defaultLength = defaultLength;
|
this.defaultLength = defaultLength;
|
||||||
this.resizable = resizable;
|
this.resizable = resizable;
|
||||||
|
this.parameters = parameters;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[System.Serializable]
|
||||||
|
public class Param
|
||||||
|
{
|
||||||
|
public string propertyName;
|
||||||
|
public object parameter;
|
||||||
|
public string propertyCaption;
|
||||||
|
|
||||||
|
public Param(string propertyName, object parameter, string propertyCaption)
|
||||||
|
{
|
||||||
|
this.propertyName = propertyName;
|
||||||
|
this.parameter = parameter;
|
||||||
|
this.propertyCaption = propertyCaption;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,11 +123,12 @@ namespace RhythmHeavenMania
|
||||||
}),
|
}),
|
||||||
new Minigame("spaceball", "Spaceball", "00A518", false, false, new List<GameAction>()
|
new Minigame("spaceball", "Spaceball", "00A518", false, false, new List<GameAction>()
|
||||||
{
|
{
|
||||||
new GameAction("shoot", delegate { Spaceball.instance.Shoot(eventCaller.currentBeat, false, eventCaller.currentType); }, 2),
|
new GameAction("shoot", delegate { Spaceball.instance.Shoot(eventCaller.currentBeat, false, eventCaller.currentType); }, 2, false),
|
||||||
new GameAction("shootHigh", delegate { Spaceball.instance.Shoot(eventCaller.currentBeat, true, eventCaller.currentType); }, 3),
|
new GameAction("shootHigh", delegate { Spaceball.instance.Shoot(eventCaller.currentBeat, true, eventCaller.currentType); }, 3),
|
||||||
new GameAction("costume", delegate { Spaceball.instance.Costume(eventCaller.currentType); } ),
|
new GameAction("costume", delegate { Spaceball.instance.Costume(eventCaller.currentType); }, 1f, false, new List<Param>() { new Param("type", new EntityTypes.Integer(0, 2), "type") } ),
|
||||||
new GameAction("alien", delegate { Spaceball.instance.alien.Show(eventCaller.currentBeat); } ),
|
new GameAction("alien", delegate { Spaceball.instance.alien.Show(eventCaller.currentBeat); } ),
|
||||||
new GameAction("cameraZoom", delegate { }, 4, true ),
|
new GameAction("camera", delegate { }, 4, true ),
|
||||||
|
new GameAction("prepare dispenser", delegate { Spaceball.instance.PrepareDispenser(); }, 1 ),
|
||||||
}),
|
}),
|
||||||
new Minigame("karateman", "Karate Man", "70A8D8", false, false, new List<GameAction>()
|
new Minigame("karateman", "Karate Man", "70A8D8", false, false, new List<GameAction>()
|
||||||
{
|
{
|
||||||
|
@ -139,7 +157,7 @@ namespace RhythmHeavenMania
|
||||||
new GameAction("break c'mon ooh", delegate { DJSchool.instance.BreakCmon(eventCaller.currentBeat); }, 3f),
|
new GameAction("break c'mon ooh", delegate { DJSchool.instance.BreakCmon(eventCaller.currentBeat); }, 3f),
|
||||||
new GameAction("scratch-o hey", delegate { DJSchool.instance.ScratchoHey(eventCaller.currentBeat); }, 3f),
|
new GameAction("scratch-o hey", delegate { DJSchool.instance.ScratchoHey(eventCaller.currentBeat); }, 3f),
|
||||||
}),
|
}),
|
||||||
/*new Minigame("rhythmRally", "Rhythm Rally", "B888F8", true, new List<GameAction>()
|
/*new Minigame("rhythmRally", "Rhythm Rally", "B888F8", true, false, new List<GameAction>()
|
||||||
{
|
{
|
||||||
|
|
||||||
}),
|
}),
|
||||||
|
|
23
Assets/Scripts/Util/EntityTypes.cs
Normal file
23
Assets/Scripts/Util/EntityTypes.cs
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace RhythmHeavenMania
|
||||||
|
{
|
||||||
|
public class EntityTypes
|
||||||
|
{
|
||||||
|
public struct Integer
|
||||||
|
{
|
||||||
|
public int min;
|
||||||
|
public int val;
|
||||||
|
public int max;
|
||||||
|
|
||||||
|
public Integer(int min, int max, int val = 0)
|
||||||
|
{
|
||||||
|
this.min = min;
|
||||||
|
this.val = val;
|
||||||
|
this.max = max;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Scripts/Util/EntityTypes.cs.meta
Normal file
11
Assets/Scripts/Util/EntityTypes.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e1956b6aa51cd2a46869d3e2289fbf4e
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -1,11 +1,9 @@
|
||||||
using UnityEngine;
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
|
using UnityEngine;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEditor.ShortcutManagement;
|
using UnityEditor.ShortcutManagement;
|
||||||
#endif
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
|
||||||
[InitializeOnLoad]
|
[InitializeOnLoad]
|
||||||
public class SwitchShortcutsProfileOnPlay
|
public class SwitchShortcutsProfileOnPlay
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue