Proper spraying and wiping of polish objects implemented
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0b84f6fbb4b238041ba94cb90e15c1ce
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -7,7 +7,6 @@ public class GameScript : MonoBehaviour
|
||||
|
||||
public GameObject Object;
|
||||
public GameObject Dirt;
|
||||
public GameObject Spray;
|
||||
public Sprite[] ObjectSprites;
|
||||
|
||||
private bool clicked = false;
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class SprayScript : MonoBehaviour
|
||||
{
|
||||
|
||||
void OnCollisionEnter2D(Collision2D other){
|
||||
|
||||
if(other.gameObject.name == "Rag")
|
||||
{
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fc560be65171acc4ead47d084bd7a4d6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user