mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 13:27:41 +02:00
Added "set background color" to Karate Man.
Seemingly stops working after a few background changes but works between game changes
This commit is contained in:
@ -16,13 +16,20 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
Custom = 3
|
||||
}
|
||||
|
||||
public Color[] LightBulbColors = new Color[]
|
||||
public Color[] LightBulbColors;
|
||||
|
||||
public enum BackgroundType
|
||||
{
|
||||
new Color(0, 0, 0, 0),
|
||||
new Color(2, 207, 255),
|
||||
new Color(233, 233, 0),
|
||||
new Color(0, 0, 0, 0)
|
||||
};
|
||||
Yellow = 0,
|
||||
Fushia = 1,
|
||||
Blue = 2,
|
||||
Red = 3,
|
||||
Orange = 4,
|
||||
Pink = 5,
|
||||
Custom = 6
|
||||
}
|
||||
|
||||
public Color[] BackgroundColors;
|
||||
|
||||
const float hitVoiceOffset = 0.042f;
|
||||
|
||||
@ -34,13 +41,14 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
public static KarateMan instance { get; set; }
|
||||
|
||||
public Sprite[] ObjectSprites;
|
||||
public Sprite[] ObjectBottomSprites;
|
||||
public Sprite[] BarrelSprites;
|
||||
|
||||
public List<BGSpriteC> BGSprites;
|
||||
public SpriteRenderer BGSprite;
|
||||
public SpriteRenderer BGFXSprite;
|
||||
|
||||
public Color BGColor;
|
||||
|
||||
private bool bgEnabled;
|
||||
private float newBeat;
|
||||
|
||||
public GameEvent bop = new GameEvent();
|
||||
@ -64,6 +72,13 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
private void Awake()
|
||||
{
|
||||
instance = this;
|
||||
BGColor = BackgroundColors[0];
|
||||
}
|
||||
|
||||
public override void OnGameSwitch()
|
||||
{
|
||||
base.OnGameSwitch();
|
||||
SetBackgroundColor(BGColor);
|
||||
}
|
||||
|
||||
public void Combo(float beat)
|
||||
@ -181,15 +196,15 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
{
|
||||
if (Conductor.instance.ReportBeat(ref newBeat))
|
||||
{
|
||||
if (bgEnabled)
|
||||
if (BGFXSprite.enabled)
|
||||
{
|
||||
if (bgBeat % 2 == 0)
|
||||
{
|
||||
BGSprite.sprite = BGSprites[0].Sprites[1];
|
||||
BGFXSprite.sprite = BGSprites[0].Sprites[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
BGSprite.sprite = BGSprites[0].Sprites[2];
|
||||
BGFXSprite.sprite = BGSprites[0].Sprites[1];
|
||||
}
|
||||
bgBeat++;
|
||||
}
|
||||
@ -234,13 +249,19 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
|
||||
public void BGFXOn()
|
||||
{
|
||||
bgEnabled = true;
|
||||
BGFXSprite.enabled = true;
|
||||
}
|
||||
|
||||
public void BGFXOff()
|
||||
{
|
||||
bgEnabled = false;
|
||||
BGSprite.sprite = BGSprites[0].Sprites[0];
|
||||
BGFXSprite.enabled = false;
|
||||
}
|
||||
|
||||
public void SetBackgroundColor(Color color)
|
||||
{
|
||||
Debug.Log("THE COLOR IS " + color.ToString());
|
||||
BGColor = color;
|
||||
BGSprite.color = color;
|
||||
}
|
||||
|
||||
public void Bop(float beat, float length)
|
||||
|
@ -249,6 +249,16 @@ namespace RhythmHeavenMania
|
||||
new GameAction("prepare", delegate { KarateMan.instance.Prepare(eventCaller.currentEntity.beat, eventCaller.currentEntity.length); }, 1f, true),
|
||||
new GameAction("bgfxon", delegate { KarateMan.instance.BGFXOn(); } ),
|
||||
new GameAction("bgfxoff", delegate { KarateMan.instance.BGFXOff(); }),
|
||||
new GameAction("set background color", delegate {
|
||||
var e = eventCaller.currentEntity;
|
||||
var c = KarateMan.instance.BackgroundColors[e.type];
|
||||
if(e.type == 6) c = e.colorA;
|
||||
KarateMan.instance.SetBackgroundColor(c);
|
||||
}, 1f, false, new List<Param>()
|
||||
{
|
||||
new Param("type", KarateMan.BackgroundType.Yellow, "Type"),
|
||||
new Param("colorA", new Color(), "Custom Color")
|
||||
}),
|
||||
new GameAction("tacobell", delegate { KarateMan.instance.Shoot(eventCaller.currentEntity.beat, 6); }, 2),
|
||||
}),
|
||||
new Minigame("spaceSoccer", "Space Soccer", "B888F8", false, false, new List<GameAction>()
|
||||
|
Reference in New Issue
Block a user