Added Light to the Light Bulb if colour is changed with right click

You can now right click on bulb in the editor to change the colour of the light emitted. If the colour is set to black then no light is drawn.
This commit is contained in:
Carson Kompon
2022-02-25 23:57:18 -05:00
parent 37a2ed24c7
commit c557c62b32
6 changed files with 202 additions and 3 deletions

View File

@ -18,6 +18,7 @@ namespace RhythmHeavenMania.Games.KarateMan
public static KarateMan instance { get; set; }
public Sprite[] ObjectSprites;
public Sprite[] ObjectBottomSprites;
public Sprite[] BarrelSprites;
public List<BGSpriteC> BGSprites;
@ -73,7 +74,7 @@ namespace RhythmHeavenMania.Games.KarateMan
});
}
public void Shoot(float beat, int type, bool combo = false, string throwAnim = "", int comboIndex = 0, Vector2 endShadowPos = new Vector2())
public void Shoot(float beat, int type, bool combo = false, string throwAnim = "", int comboIndex = 0, Vector2 endShadowPos = new Vector2(), UnityEngine.Color tint = default)
{
GameObject pot = Instantiate(Pot);
pot.transform.parent = Pot.transform.parent;
@ -115,6 +116,11 @@ namespace RhythmHeavenMania.Games.KarateMan
case 1:
outSnd = "karateman/lightbulbOut";
p.hitSnd = "karateman/lightbulbHit";
SpriteRenderer sr = p.BottomSprite.GetComponent<SpriteRenderer>();
if (tint != default && tint != Color.black) {
sr.sprite = ObjectBottomSprites[type];
sr.color = tint;
}
break;
case 2:
if (Starpelly.Mathp.GetDecimalFromFloat(beat) == 0f)

View File

@ -15,6 +15,7 @@ namespace RhythmHeavenMania.Games.KarateMan
public GameObject Holder;
private GameObject newHolder;
public GameObject Sprite;
public GameObject BottomSprite;
private SpriteRenderer spriteComp;
public GameObject Shadow;
private SpriteRenderer shadowSpriteComp;
@ -60,6 +61,7 @@ namespace RhythmHeavenMania.Games.KarateMan
shadowSpriteComp = Shadow.GetComponent<SpriteRenderer>();
Sprite.transform.eulerAngles = new Vector3(0, 0, Random.Range(0, 360));
BottomSprite.transform.eulerAngles = Sprite.transform.eulerAngles;
if (type == 2)
hitLength = 14f;

View File

@ -230,7 +230,10 @@ namespace RhythmHeavenMania
{
new GameAction("bop", delegate { KarateMan.instance.Bop(eventCaller.currentEntity.beat, eventCaller.currentEntity.length); }, 0.5f, true),
new GameAction("pot", delegate { KarateMan.instance.Shoot(eventCaller.currentEntity.beat, 0); }, 2),
new GameAction("bulb", delegate { KarateMan.instance.Shoot(eventCaller.currentEntity.beat, 1); }, 2),
new GameAction("bulb", delegate { var e = eventCaller.currentEntity; KarateMan.instance.Shoot(eventCaller.currentEntity.beat, 1, tint: e.colorA); }, 2, false, new List<Param>()
{
new Param("colorA", Color.white, "Light Bulb Color")
}),
new GameAction("rock", delegate { KarateMan.instance.Shoot(eventCaller.currentEntity.beat, 2); }, 2),
new GameAction("ball", delegate { KarateMan.instance.Shoot(eventCaller.currentEntity.beat, 3); }, 2),
new GameAction("kick", delegate { KarateMan.instance.Shoot(eventCaller.currentEntity.beat, 4); }, 4.5f),