Add CrashingPunch and making it work
This commit is contained in:
parent
1c3056778e
commit
d7c19e2572
15 changed files with 204 additions and 27 deletions
36
Assets/Battle/BattleParticipantSprite.cs
Normal file
36
Assets/Battle/BattleParticipantSprite.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class BattleParticipantSprite : MonoBehaviour
|
||||
{
|
||||
public delegate void SpriteClickedAction();
|
||||
public event SpriteClickedAction OnSpriteClicked;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start() {
|
||||
gameObject.AddComponent<BoxCollider2D>();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update() {
|
||||
}
|
||||
|
||||
void OnMouseDown() {
|
||||
Debug.Log("Clicked " + this.name);
|
||||
OnSpriteClicked();
|
||||
}
|
||||
|
||||
private Color savedColor;
|
||||
|
||||
void OnMouseEnter() {
|
||||
SpriteRenderer sprite = GetComponent<SpriteRenderer>();
|
||||
this.savedColor = sprite.color;
|
||||
sprite.color = Color.Lerp(this.savedColor, Color.white, .5f);
|
||||
}
|
||||
|
||||
void OnMouseExit() {
|
||||
SpriteRenderer sprite = GetComponent<SpriteRenderer>();
|
||||
sprite.color = this.savedColor;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue