mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-10 03:35:10 +00:00
Wizard's Waltz height fix + position based on start interval
Based on megaminerjenny's suggestions :)
This commit is contained in:
parent
a5164ddcbe
commit
2eda6c0d45
2 changed files with 19 additions and 8 deletions
|
@ -23,14 +23,14 @@ namespace RhythmHeavenMania.Games.WizardsWaltz
|
||||||
|
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
songPos = Conductor.instance.songPositionInBeats;
|
songPos = Conductor.instance.songPositionInBeats - game.wizardBeatOffset;
|
||||||
var am = game.beatInterval / 2f;
|
var am = game.beatInterval / 2f;
|
||||||
var x = Mathf.Sin(Mathf.PI * songPos / am) * 6;
|
var x = Mathf.Sin(Mathf.PI * songPos / am) * 6;
|
||||||
var y = Mathf.Cos(Mathf.PI * songPos / am) * 1.5f;
|
var y = Mathf.Cos(Mathf.PI * songPos / am);
|
||||||
var scale = 1 - Mathf.Cos(Mathf.PI * songPos / am) * 0.35f;
|
var scale = 1 - Mathf.Cos(Mathf.PI * songPos / am) * 0.35f;
|
||||||
|
|
||||||
transform.position = new Vector3(x, 1.5f + y, 0);
|
transform.position = new Vector3(x, 3f - y * 0.5f, 0);
|
||||||
shadow.transform.position = new Vector3(x, -3f + y, 0);
|
shadow.transform.position = new Vector3(x, -3f + y * 1.5f, 0);
|
||||||
|
|
||||||
var xscale = scale;
|
var xscale = scale;
|
||||||
if (y > 0) xscale *= -1;
|
if (y > 0) xscale *= -1;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System;
|
using System;
|
||||||
using Starpelly;
|
using Starpelly;
|
||||||
|
@ -33,6 +34,15 @@ namespace RhythmHeavenMania.Games.WizardsWaltz
|
||||||
instance = this;
|
instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
List<float> starts = GameManager.instance.Beatmap.entities.FindAll(c => c.datamodel == "wizardsWaltz/start interval").Select(c => c.beat).ToList();
|
||||||
|
|
||||||
|
var nextInterval = starts.IndexOf(Mathp.GetClosestInList(starts, Conductor.instance.songPositionInBeats));
|
||||||
|
wizardBeatOffset = starts[nextInterval];
|
||||||
|
Debug.Log(wizardBeatOffset);
|
||||||
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
if (!Conductor.instance.isPlaying && !Conductor.instance.isPaused && intervalStarted)
|
if (!Conductor.instance.isPlaying && !Conductor.instance.isPaused && intervalStarted)
|
||||||
|
@ -45,15 +55,15 @@ namespace RhythmHeavenMania.Games.WizardsWaltz
|
||||||
{
|
{
|
||||||
if (timer % 8 == 0 || UnityEngine.Random.Range(0,8) == 0)
|
if (timer % 8 == 0 || UnityEngine.Random.Range(0,8) == 0)
|
||||||
{
|
{
|
||||||
var songPos = Conductor.instance.songPositionInBeats;
|
var songPos = Conductor.instance.songPositionInBeats - wizardBeatOffset;
|
||||||
var am = beatInterval / 2f;
|
var am = beatInterval / 2f;
|
||||||
var x = Mathf.Sin(Mathf.PI * songPos / am) * 6 + UnityEngine.Random.Range(-0.5f, 0.5f);
|
var x = Mathf.Sin(Mathf.PI * songPos / am) * 6 + UnityEngine.Random.Range(-0.5f, 0.5f);
|
||||||
var y = Mathf.Cos(Mathf.PI * songPos / am) * 2f + UnityEngine.Random.Range(-0.5f, 0.5f); ;
|
var y = Mathf.Cos(Mathf.PI * songPos / am) * 0.5f + UnityEngine.Random.Range(-0.5f, 0.5f);
|
||||||
var scale = 1 - Mathf.Cos(Mathf.PI * songPos / am) * 0.35f + UnityEngine.Random.Range(-0.2f, 0.2f); ;
|
var scale = 1 - Mathf.Cos(Mathf.PI * songPos / am) * 0.35f + UnityEngine.Random.Range(-0.2f, 0.2f); ;
|
||||||
|
|
||||||
MagicFX magic = Instantiate(fxBase, fxHolder.transform).GetComponent<MagicFX>();
|
MagicFX magic = Instantiate(fxBase, fxHolder.transform).GetComponent<MagicFX>();
|
||||||
|
|
||||||
magic.transform.position = new Vector3(x, 0.5f + y, 0);
|
magic.transform.position = new Vector3(x, 2f + y, 0);
|
||||||
magic.transform.localScale = wizard.gameObject.transform.localScale;
|
magic.transform.localScale = wizard.gameObject.transform.localScale;
|
||||||
magic.gameObject.SetActive(true);
|
magic.gameObject.SetActive(true);
|
||||||
}
|
}
|
||||||
|
@ -70,6 +80,7 @@ namespace RhythmHeavenMania.Games.WizardsWaltz
|
||||||
intervalStarted = true;
|
intervalStarted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wizardBeatOffset = beat;
|
||||||
intervalStartBeat = beat;
|
intervalStartBeat = beat;
|
||||||
beatInterval = interval;
|
beatInterval = interval;
|
||||||
}
|
}
|
||||||
|
@ -83,7 +94,7 @@ namespace RhythmHeavenMania.Games.WizardsWaltz
|
||||||
Jukebox.PlayOneShotGame("wizardsWaltz/plant", beat);
|
Jukebox.PlayOneShotGame("wizardsWaltz/plant", beat);
|
||||||
Plant plant = Instantiate(plantBase, plantHolder.transform).GetComponent<Plant>();
|
Plant plant = Instantiate(plantBase, plantHolder.transform).GetComponent<Plant>();
|
||||||
|
|
||||||
var songPos = Conductor.instance.songPositionInBeats;
|
var songPos = Conductor.instance.songPositionInBeats - wizardBeatOffset;
|
||||||
var am = (beatInterval / 2f);
|
var am = (beatInterval / 2f);
|
||||||
var x = Mathf.Sin(Mathf.PI * songPos / am) * 6;
|
var x = Mathf.Sin(Mathf.PI * songPos / am) * 6;
|
||||||
var y = -3f + Mathf.Cos(Mathf.PI * songPos / am) * 1.5f;
|
var y = -3f + Mathf.Cos(Mathf.PI * songPos / am) * 1.5f;
|
||||||
|
|
Loading…
Reference in a new issue