mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-14 13:45:10 +00:00
Allowed lion count and mii faces to be set before game switches and fixed some bugs from last pr
I went through every single game script to look for bugs in intialization, there shouldn't be anything else that was caused by the pr (there is a bug in Spaceball where a ball cue won't trigger correctly if it's on the same beat as the switch, but i'm not sure how to fix it)
This commit is contained in:
parent
d72aa964b2
commit
030837d3c9
6 changed files with 23 additions and 24 deletions
|
@ -345,8 +345,6 @@ namespace HeavenStudio
|
||||||
|
|
||||||
SetGame(game);
|
SetGame(game);
|
||||||
|
|
||||||
yield return new WaitForEndOfFrame(); //this is needed so that the minigame can have Start() called before OnGameSwitch()
|
|
||||||
|
|
||||||
Minigame miniGame = currentGameO.GetComponent<Minigame>();
|
Minigame miniGame = currentGameO.GetComponent<Minigame>();
|
||||||
if (miniGame != null)
|
if (miniGame != null)
|
||||||
miniGame.OnGameSwitch(beat);
|
miniGame.OnGameSwitch(beat);
|
||||||
|
@ -356,7 +354,7 @@ namespace HeavenStudio
|
||||||
this.GetComponent<SpriteRenderer>().enabled = false;
|
this.GetComponent<SpriteRenderer>().enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetGame(string game, bool onGameSwitch = true)
|
private void SetGame(string game)
|
||||||
{
|
{
|
||||||
Destroy(currentGameO);
|
Destroy(currentGameO);
|
||||||
|
|
||||||
|
@ -385,11 +383,6 @@ namespace HeavenStudio
|
||||||
currentGameO.transform.parent = eventCaller.GamesHolder.transform;
|
currentGameO.transform.parent = eventCaller.GamesHolder.transform;
|
||||||
currentGameO.name = game;
|
currentGameO.name = game;
|
||||||
}
|
}
|
||||||
/*if (onGameSwitch)
|
|
||||||
{
|
|
||||||
if (GetGame(currentGame).GetComponent<Minigame>() != null)
|
|
||||||
GetGame(game).GetComponent<Minigame>().OnGameSwitch();
|
|
||||||
}*/
|
|
||||||
|
|
||||||
SetCurrentGame(game);
|
SetCurrentGame(game);
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,14 @@ namespace HeavenStudio.Games
|
||||||
instance = this;
|
instance = this;
|
||||||
InitLions();
|
InitLions();
|
||||||
}
|
}
|
||||||
|
public override void OnGameSwitch(float beat)
|
||||||
|
{
|
||||||
|
Beatmap.Entity changeLion = GameManager.instance.Beatmap.entities.FindLast(c => c.datamodel == "clappyTrio/change lion count" && c.beat <= beat);
|
||||||
|
if(changeLion != null)
|
||||||
|
{
|
||||||
|
EventCaller.instance.CallEvent(changeLion, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void InitLions()
|
private void InitLions()
|
||||||
{
|
{
|
||||||
|
|
|
@ -46,9 +46,13 @@ namespace HeavenStudio.Games
|
||||||
SetMiis();
|
SetMiis();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnGameSwitch()
|
public override void OnGameSwitch(float beat)
|
||||||
{
|
{
|
||||||
SetMiis();
|
Beatmap.Entity changeMii = GameManager.instance.Beatmap.entities.FindLast(c => c.datamodel == "drummingPractice/set mii" && c.beat <= beat);
|
||||||
|
if(changeMii != null)
|
||||||
|
{
|
||||||
|
EventCaller.instance.CallEvent(changeMii, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
|
|
|
@ -256,6 +256,7 @@ namespace HeavenStudio.Games
|
||||||
|
|
||||||
Jukebox.PlayOneShotGame(outSnd);
|
Jukebox.PlayOneShotGame(outSnd);
|
||||||
}
|
}
|
||||||
|
p.Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Beatmap.Entity> cuedVoices = new List<Beatmap.Entity>(); // "Hit" voices cued in advance are stored here so they aren't called multiple times in Update().
|
List<Beatmap.Entity> cuedVoices = new List<Beatmap.Entity>(); // "Hit" voices cued in advance are stored here so they aren't called multiple times in Update().
|
||||||
|
|
|
@ -56,7 +56,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||||
|
|
||||||
private int missTimes = 0;
|
private int missTimes = 0;
|
||||||
|
|
||||||
private void Awake()
|
public void Init()
|
||||||
{
|
{
|
||||||
anim = GetComponent<Animator>();
|
anim = GetComponent<Animator>();
|
||||||
spriteComp = Sprite.GetComponent<SpriteRenderer>();
|
spriteComp = Sprite.GetComponent<SpriteRenderer>();
|
||||||
|
@ -66,10 +66,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||||
Sprite.transform.eulerAngles = new Vector3(0, 0, Random.Range(0, 360));
|
Sprite.transform.eulerAngles = new Vector3(0, 0, Random.Range(0, 360));
|
||||||
BulbLightSprite.transform.eulerAngles = Sprite.transform.eulerAngles;
|
BulbLightSprite.transform.eulerAngles = Sprite.transform.eulerAngles;
|
||||||
|
|
||||||
if (type == 2)
|
hitLength = 14f;
|
||||||
hitLength = 14f;
|
|
||||||
else
|
|
||||||
hitLength = 14f;
|
|
||||||
|
|
||||||
if (type == 6)
|
if (type == 6)
|
||||||
CookingPotLid.SetActive(true);
|
CookingPotLid.SetActive(true);
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace HeavenStudio.Games
|
||||||
bool intervalStarted;
|
bool intervalStarted;
|
||||||
public float wizardBeatOffset = 0f;
|
public float wizardBeatOffset = 0f;
|
||||||
|
|
||||||
[NonSerialized] public int plantsLeft = 0;
|
[NonSerialized] public int plantsLeft = 0; //this variable is unused
|
||||||
|
|
||||||
public static WizardsWaltz instance;
|
public static WizardsWaltz instance;
|
||||||
|
|
||||||
|
@ -35,16 +35,12 @@ namespace HeavenStudio.Games
|
||||||
{
|
{
|
||||||
instance = this;
|
instance = this;
|
||||||
wizard.Init();
|
wizard.Init();
|
||||||
}
|
|
||||||
|
|
||||||
private void Start()
|
Beatmap.Entity nextStart = GameManager.instance.Beatmap.entities.Find(c => c.datamodel == "wizardsWaltz/start interval" && c.beat + c.length >= Conductor.instance.songPositionInBeats);
|
||||||
{
|
|
||||||
List<float> starts = GameManager.instance.Beatmap.entities.FindAll(c => c.datamodel == "wizardsWaltz/start interval").Select(c => c.beat).ToList();
|
|
||||||
|
|
||||||
if (starts.Count > 0)
|
if (nextStart != null)
|
||||||
{
|
{
|
||||||
var nextInterval = starts.IndexOf(Mathp.GetClosestInList(starts, Conductor.instance.songPositionInBeats));
|
EventCaller.instance.CallEvent(nextStart, true);
|
||||||
wizardBeatOffset = starts[nextInterval];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +60,7 @@ namespace HeavenStudio.Games
|
||||||
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) * 0.5f + 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>();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue