Use glow effect to target
This commit is contained in:
parent
bb8f1ab902
commit
6181a7d50c
5 changed files with 87 additions and 8 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue