Added the need for multiple wipes to rid dirt and spray while also fading the dirt and spray texture with each wipe
This commit is contained in:
@@ -5,11 +5,23 @@ using UnityEngine;
|
||||
public class SprayScript : MonoBehaviour
|
||||
{
|
||||
|
||||
void OnCollisionEnter2D(Collision2D other){
|
||||
private int wiped = 0;
|
||||
Color tmp;
|
||||
|
||||
void OnCollisionExit2D(Collision2D other){
|
||||
|
||||
tmp = this.GetComponent<SpriteRenderer>().color;
|
||||
|
||||
if(other.gameObject.name == "Rag")
|
||||
{
|
||||
Destroy(this.gameObject);
|
||||
|
||||
wiped++;
|
||||
|
||||
tmp.a -= 0.15f;
|
||||
this.GetComponent<SpriteRenderer>().color = tmp;
|
||||
|
||||
if(wiped >= 3) Destroy(this.gameObject);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user