public class cube : MonoBehaviour
{
public GameObject Box;
private void OnMouseDown()
{
if (BoxDestroy.Active == false)
{
Instantiate(Box, this.transform.position, Quaternion.identity);
BoxDestroy.Active = true;
Debug.Log("OK");
}
}
}
public class BoxDestroy : MonoBehaviour
{
public static bool Active = false;
public float StartSeedsUP = 0;
public float EndSeedsUP = 2;
void FixedUpdate()
{
StartSeedsUP += 0.1f * Time.deltaTime;
if (StartSeedsUP >= EndSeedsUP)
{
Destroy(gameObject);
Active = false;
}
}
}
public class cube : MonoBehaviour
{
public static bool Active = false;
public GameObject Box;
private void OnMouseDown()
{
if (Active == false)
{
Active = true;
Instantiate(Box, this.transform.position, Quaternion.identity);
Debug.Log("OK");
}
}
public class BoxDestroy : MonoBehaviour
{
public float StartSeedsUP = 0;
public float EndSeedsUP = 2;
void FixedUpdate()
{
StartSeedsUP += 0.1f * Time.deltaTime;
if (StartSeedsUP >= EndSeedsUP)
{
Destroy(gameObject);
cube.Active = false;
}
}
}