Implemented small dirt sprites to randomly generate on the object

This commit is contained in:
Gregory Campbell
2020-06-02 19:41:24 -04:00
parent 82434fa6c2
commit 6ce00f5f25
12 changed files with 326 additions and 170 deletions
+27 -3
View File
@@ -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");
}
}
}