mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 11:27:39 +02:00
Coin Toss Done. Needs HD Textures and more customization
This commit is contained in:
@ -10,6 +10,8 @@ namespace HeavenStudio.Games.Scripts_CoinToss
|
||||
{
|
||||
public float startBeat;
|
||||
|
||||
public bool audienceReacting;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
PlayerActionInit(this.gameObject, startBeat);
|
||||
@ -33,18 +35,25 @@ namespace HeavenStudio.Games.Scripts_CoinToss
|
||||
if (state.perfect)
|
||||
{
|
||||
Hit();
|
||||
} else
|
||||
{
|
||||
CoinToss.instance.Catch_Empty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Hit()
|
||||
{
|
||||
CoinToss.instance.Catch_Success();
|
||||
Destroy(this.gameObject);
|
||||
if(CoinToss.instance.isThrowing)
|
||||
{
|
||||
CoinToss.instance.Catch_Success(audienceReacting);
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
public void MissCoin()
|
||||
{
|
||||
CoinToss.instance.Catch_Miss();
|
||||
CoinToss.instance.Catch_Miss(audienceReacting);
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
}
|
||||
|
@ -12,9 +12,12 @@ namespace HeavenStudio.Games.Loaders
|
||||
{
|
||||
public static Minigame AddGame(EventCaller eventCaller)
|
||||
{
|
||||
return new Minigame("coinToss", "Coin Toss", "B4E6F6", false, false, new List<GameAction>()
|
||||
return new Minigame("coinToss", "Coin Toss \n [One coin at a time!]", "B4E6F6", false, false, new List<GameAction>()
|
||||
{
|
||||
new GameAction("toss", delegate { CoinToss.instance.TossCoin(eventCaller.currentEntity.beat); }, 7, false),
|
||||
new GameAction("toss", delegate { CoinToss.instance.TossCoin(eventCaller.currentEntity.beat, eventCaller.currentEntity.toggle); }, 7, false, parameters: new List<Param>()
|
||||
{
|
||||
new Param("toggle", false, "Audience Reaction", "Enable Audience Reaction"),
|
||||
}),
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -31,12 +34,15 @@ namespace HeavenStudio.Games
|
||||
|
||||
public GameObject coin_cue;
|
||||
|
||||
private int nbCoinThrown; //Variable used if multiple coins are thrown. But it's pretty buggy at the moment and should not be used at the moment
|
||||
|
||||
[Header("Animators")]
|
||||
public Animator handAnimator;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
instance = this;
|
||||
nbCoinThrown = 0;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
@ -49,7 +55,7 @@ namespace HeavenStudio.Games
|
||||
//pass
|
||||
}
|
||||
|
||||
public void TossCoin(float beat)
|
||||
public void TossCoin(float beat, bool audienceReacting)
|
||||
{
|
||||
Jukebox.PlayOneShotGame("coinToss/throw");
|
||||
handAnimator.Play("Throw", 0, 0);
|
||||
@ -60,19 +66,35 @@ namespace HeavenStudio.Games
|
||||
coin.SetActive(true);
|
||||
Coin c = coin.GetComponent<Coin>();
|
||||
c.startBeat = beat;
|
||||
c.audienceReacting = audienceReacting;
|
||||
|
||||
nbCoinThrown++;
|
||||
}
|
||||
|
||||
public void Catch_Success()
|
||||
public void Catch_Success(bool audienceReacting)
|
||||
{
|
||||
Jukebox.PlayOneShotGame("coinToss/catch");
|
||||
if(audienceReacting) Jukebox.PlayOneShotGame("coinToss/applause");
|
||||
handAnimator.Play("Catch_success", 0, 0);
|
||||
|
||||
isThrowing = false;
|
||||
if(nbCoinThrown > 0) nbCoinThrown--;
|
||||
if(nbCoinThrown == 0) isThrowing = false;
|
||||
}
|
||||
|
||||
public void Catch_Miss()
|
||||
public void Catch_Miss(bool audienceReacting)
|
||||
{
|
||||
Jukebox.PlayOneShotGame("coinToss/miss");
|
||||
if(audienceReacting) Jukebox.PlayOneShotGame("coinToss/disappointed");
|
||||
handAnimator.Play("Pickup", 0, 0);
|
||||
|
||||
if (nbCoinThrown > 0) nbCoinThrown--;
|
||||
if (nbCoinThrown == 0) isThrowing = false;
|
||||
}
|
||||
|
||||
public void Catch_Empty()
|
||||
{
|
||||
handAnimator.Play("Catch_empty", 0, 0);
|
||||
isThrowing = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user