Proper spraying and wiping of polish objects implemented

This commit is contained in:
Gregory Campbell
2020-06-02 20:11:26 -04:00
parent 6ce00f5f25
commit e339c334a3
13 changed files with 136 additions and 65 deletions
+26
View File
@@ -0,0 +1,26 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DirtScript : MonoBehaviour
{
public GameObject Spray;
private bool sprayed = false;
void OnCollisionEnter2D(Collision2D other){
if(other.gameObject.name == "SprayBottle" && !sprayed)
{
sprayed = true;
Instantiate(Spray, new Vector2(this.transform.position.x, this.transform.position.y), Quaternion.identity);
}
if(other.gameObject.name == "Rag" && sprayed)
{
Destroy(this.gameObject);
}
}
}