Merge pull request #65 from Slaith12/main
Allowed lion count and mii faces to be set before game switches and f…
This commit is contained in:
commit
40dd6ed5ff
|
@ -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()
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||||
|
|
||||||
public GameObject shadow;
|
public GameObject shadow;
|
||||||
|
|
||||||
private void Awake()
|
public void Init()
|
||||||
{
|
{
|
||||||
SpriteRenderer = this.gameObject.GetComponent<SpriteRenderer>();
|
SpriteRenderer = this.gameObject.GetComponent<SpriteRenderer>();
|
||||||
SpriteRenderer.sprite = KarateMan.instance.BarrelSprites[spriteIndex];
|
SpriteRenderer.sprite = KarateMan.instance.BarrelSprites[spriteIndex];
|
||||||
|
|
|
@ -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);
|
||||||
|
@ -413,6 +410,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||||
bde.spriteIndex = 4;
|
bde.spriteIndex = 4;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
bde.Init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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