mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 08:27:40 +02:00
recolourable shadows
- rework now has parity with the old version
This commit is contained in:
@ -176,11 +176,17 @@ namespace HeavenStudio.Games
|
||||
//backgrounds
|
||||
public SpriteRenderer BGPlane;
|
||||
public GameObject BGEffect;
|
||||
int bgType = (int) BackgroundType.Yellow;
|
||||
Color bgColour;
|
||||
|
||||
public BackgroundFXType currentBgEffect = BackgroundFXType.None;
|
||||
Animator bgEffectAnimator;
|
||||
SpriteRenderer bgEffectSpriteRenderer;
|
||||
|
||||
//shadows
|
||||
ShadowType currentShadowType = ShadowType.Tinted;
|
||||
Color customShadowColour = Color.white;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
instance = this;
|
||||
@ -193,6 +199,8 @@ namespace HeavenStudio.Games
|
||||
GameCamera.additionalPosition = cameraPosition - GameCamera.defaultPosition;
|
||||
bgEffectAnimator = BGEffect.GetComponent<Animator>();
|
||||
bgEffectSpriteRenderer = BGEffect.GetComponent<SpriteRenderer>();
|
||||
|
||||
SetBgAndShadowCol(0f, bgType, (int) currentShadowType, BackgroundColors[bgType], customShadowColour, (int)currentBgEffect);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
@ -381,11 +389,14 @@ namespace HeavenStudio.Games
|
||||
|
||||
public void SetBgAndShadowCol(float beat, int bgType, int shadowType, Color a, Color b, int fx)
|
||||
{
|
||||
if (bgType == (int) BackgroundType.Custom)
|
||||
BGPlane.color = a;
|
||||
this.bgType = bgType;
|
||||
if (this.bgType == (int) BackgroundType.Custom)
|
||||
bgColour = a;
|
||||
else
|
||||
BGPlane.color = BackgroundColors[bgType];
|
||||
bgColour = BackgroundColors[this.bgType];
|
||||
BGPlane.color = bgColour;
|
||||
|
||||
UpdateShadowColour(shadowType, b);
|
||||
SetBgFx(fx);
|
||||
}
|
||||
|
||||
@ -449,5 +460,28 @@ namespace HeavenStudio.Games
|
||||
|
||||
return mobj;
|
||||
}
|
||||
|
||||
public static Color ShadowBlendColor = new Color(195 / 255f, 48 / 255f, 2 / 255f);
|
||||
public Color GetShadowColor()
|
||||
{
|
||||
if(currentShadowType == ShadowType.Custom)
|
||||
{
|
||||
return customShadowColour;
|
||||
}
|
||||
else if(bgType < (int) BackgroundType.Custom)
|
||||
{
|
||||
return ShadowColors[bgType];
|
||||
}
|
||||
|
||||
return Color.LerpUnclamped(bgColour, ShadowBlendColor, 0.45f);
|
||||
}
|
||||
|
||||
public void UpdateShadowColour(int type, Color colour)
|
||||
{
|
||||
currentShadowType = (ShadowType) type;
|
||||
customShadowColour = colour;
|
||||
|
||||
Joe.UpdateShadowColour();
|
||||
}
|
||||
}
|
||||
}
|
@ -12,6 +12,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
{
|
||||
public Animator anim;
|
||||
public GameEvent bop = new GameEvent();
|
||||
public SpriteRenderer[] Shadows;
|
||||
|
||||
float lastPunchTime = Single.MinValue;
|
||||
float lastComboMissTime = Single.MinValue;
|
||||
@ -41,6 +42,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
var cond = Conductor.instance;
|
||||
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1, false) && cond.songPositionInBeats > bop.startBeat && !inCombo)
|
||||
{
|
||||
anim.speed = 1f;
|
||||
anim.Play("Beat", -1, 0);
|
||||
}
|
||||
|
||||
@ -244,5 +246,13 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
|
||||
anim.DoScaledAnimationAsync("ManKick", 0.5f);
|
||||
}
|
||||
|
||||
public void UpdateShadowColour()
|
||||
{
|
||||
foreach (var shadow in Shadows)
|
||||
{
|
||||
shadow.color = KarateMan.instance.GetShadowColor();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -16,6 +16,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
|
||||
public GameObject Shadow;
|
||||
public GameObject ShadowInstance;
|
||||
SpriteRenderer shadowRenderer;
|
||||
|
||||
//hit effects
|
||||
public GameObject HitMark;
|
||||
@ -171,6 +172,8 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z + (-360f * Time.deltaTime) + UnityEngine.Random.Range(0f, 360f));
|
||||
|
||||
ShadowInstance = GameObject.Instantiate(Shadow, KarateMan.instance.ItemHolder);
|
||||
shadowRenderer = ShadowInstance.GetComponent<SpriteRenderer>();
|
||||
shadowRenderer.color = KarateMan.instance.GetShadowColor();
|
||||
ShadowInstance.SetActive(true);
|
||||
ShadowInstance.transform.position = new Vector3(transform.position.x, floorHeight - 0.5f, transform.position.z);
|
||||
}
|
||||
@ -263,6 +266,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
break;
|
||||
}
|
||||
ShadowInstance.transform.position = new Vector3(transform.position.x, floorHeight - 0.5f, transform.position.z);
|
||||
shadowRenderer.color = KarateMan.instance.GetShadowColor();
|
||||
}
|
||||
|
||||
void CreateHitMark(bool useLocalPos = false)
|
||||
|
Reference in New Issue
Block a user