Use glow effect to target

This commit is contained in:
henriquenakashima 2020-09-26 22:23:52 -04:00
parent bb8f1ab902
commit 6181a7d50c
5 changed files with 87 additions and 8 deletions

View file

@ -42,14 +42,12 @@ public class BattleParticipantSprite : MonoBehaviour
}
}
private Color savedColor;
private bool colorChanged;
void OnMouseEnter() {
if (!this.removedFromBattle && this.playerControls.CouldTarget(participant)) {
SpriteRenderer sprite = GetComponent<SpriteRenderer>();
this.savedColor = sprite.color;
sprite.color = Color.Lerp(this.savedColor, Color.white, .5f);
sprite.material.SetFloat("_Glow", 1f);
this.colorChanged = true;
}
}
@ -57,7 +55,7 @@ public class BattleParticipantSprite : MonoBehaviour
void OnMouseExit() {
if (this.colorChanged) {
SpriteRenderer sprite = GetComponent<SpriteRenderer>();
sprite.color = this.savedColor;
sprite.material.SetFloat("_Glow", 0f);
this.colorChanged = false;
}
}