Implemented small dirt sprites to randomly generate on the object
This commit is contained in:
+27
-3
@@ -4,7 +4,28 @@ using UnityEngine;
|
||||
|
||||
public class ObjectScript : MonoBehaviour
|
||||
{
|
||||
void OnCollisionEnter2D(Collision2D other){
|
||||
|
||||
/*public GameObject Dirt;
|
||||
public GameObject Spray;
|
||||
|
||||
void Start(){
|
||||
|
||||
this.gameObject.AddComponent<BoxCollider2D>();
|
||||
Vector3 boundary = this.GetComponent<BoxCollider2D>().size;
|
||||
|
||||
for(int i = 0; i < 20; i++)
|
||||
{
|
||||
float xBound = Random.Range(-boundary.x, boundary.x);
|
||||
float yBound = Random.Range(-boundary.y, boundary.y);
|
||||
|
||||
Instantiate(Dirt, new Vector2(xBound, yBound), Quaternion.identity);
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
void OnCollisionStay2D(Collision2D other){
|
||||
/*Texture2D dirt = this.transform.GetChild(0).GetComponent<SpriteRenderer>().sprite.texture;
|
||||
Texture2D spray = this.transform.GetChild(1).GetComponent<SpriteRenderer>().sprite.texture;
|
||||
|
||||
if(!this.transform.GetChild(1).gameObject.activeInHierarchy &&
|
||||
other.gameObject.name == "SprayBottle")
|
||||
@@ -17,9 +38,12 @@ public class ObjectScript : MonoBehaviour
|
||||
{
|
||||
this.transform.GetChild(0).gameObject.SetActive(false);
|
||||
this.transform.GetChild(1).gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
//Debug.Log((int)other.transform.position.x + ", " + (int)other.transform.position.y);
|
||||
|
||||
}*/
|
||||
|
||||
//Debug.Log("Collision");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user