Skip to content

Commit

Permalink
Lerp color fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rudderbucky committed Jun 21, 2020
1 parent efff4ad commit 537ca96
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Assets/Scripts/Abilities/Stealth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ protected override void Execute()
isActive = true; // set to active
isOnCD = true; // set to on cooldown
ToggleIndicator(true);

SpriteRenderer[] renderers = craft.GetComponentsInChildren<SpriteRenderer>(true);
for (int i = 0; i < renderers.Length; i++)
{
Expand Down
7 changes: 5 additions & 2 deletions Assets/Scripts/Game Object Definitions/ShellPart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,8 @@ private IEnumerator InitColorLerp(float lerpVal)
lerpVal += 0.05F;
lerpVal = Mathf.Min(lerpVal, 1);
var lerpedColor = Color.Lerp(Color.gray, info.shiny ? ShinyFactionColors.colors[faction] : FactionColors.colors[faction], lerpVal);

lerpedColor.a = (craft.invisible ? (craft.faction == 0 ? 0.2f: 0f) : 1f);

spriteRenderer.color = lerpedColor;
if(shooter) shooter.GetComponent<SpriteRenderer>().color = lerpedColor;

Expand All @@ -298,8 +299,10 @@ public void TakeDamage(float damage) {

if(partHealth != 0 && colorLerped)
{
spriteRenderer.color = Color.Lerp(Color.gray, info.shiny ? ShinyFactionColors.colors[faction] :
var color = Color.Lerp(Color.gray, info.shiny ? ShinyFactionColors.colors[faction] :
FactionColors.colors[faction], currentHealth / partHealth);
color.a = (craft.invisible ? (craft.faction == 0 ? 0.2f: 0f) : 1f);
spriteRenderer.color = color;
if(shooter) shooter.GetComponent<SpriteRenderer>().color = spriteRenderer.color;
}
}
Expand Down

0 comments on commit 537ca96

Please sign in to comment.