2020-06-01 20:59:48 -04:00
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
public class ObjectScript : MonoBehaviour
|
|
|
|
|
{
|
2020-06-02 19:41:24 -04:00
|
|
|
|
|
|
|
|
/*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;
|
2020-06-01 20:59:48 -04:00
|
|
|
|
|
|
|
|
if(!this.transform.GetChild(1).gameObject.activeInHierarchy &&
|
|
|
|
|
other.gameObject.name == "SprayBottle")
|
|
|
|
|
{
|
|
|
|
|
this.transform.GetChild(1).gameObject.SetActive(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(this.transform.GetChild(1).gameObject.activeInHierarchy &&
|
|
|
|
|
other.gameObject.name == "Rag")
|
|
|
|
|
{
|
|
|
|
|
this.transform.GetChild(0).gameObject.SetActive(false);
|
|
|
|
|
this.transform.GetChild(1).gameObject.SetActive(false);
|
2020-06-02 19:41:24 -04:00
|
|
|
|
|
|
|
|
//Debug.Log((int)other.transform.position.x + ", " + (int)other.transform.position.y);
|
|
|
|
|
|
|
|
|
|
}*/
|
2020-06-01 20:59:48 -04:00
|
|
|
|
|
|
|
|
//Debug.Log("Collision");
|
|
|
|
|
|
2020-06-02 19:41:24 -04:00
|
|
|
}
|
2020-06-01 20:59:48 -04:00
|
|
|
}
|