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:
Gregory Campbell
2020-06-03 18:27:09 -04:00
parent eea7c91968
commit b51a31b643
6 changed files with 30 additions and 3 deletions
+14 -2
View File
@@ -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);
}
}