GameObject rty;
GameObject qwe;
bool flag = true;
private void OnTriggerEnter2D(Collider2D collision)
{
switch (collision.gameObject.tag)
{
case “123”:
if (hy)
{
hy = false;
Destroy(rty);
refreshSpecificFoodItem(qwe);
}
else
{
startFlag = false;
GetComponent().SetPositionAndRotation(new Vector3(-1f, -7f, 0), new Quaternion());
}
break;
case “Fm”:
if (hy) break;
rty= Instantiate(collision.gameObject, GetComponent().position + new Vector3(0.6f, 0.6f, 0), new Quaternion());
Destroy(rty.GetComponent());
collision.gameObject.SetActive(false);
rty.name = “1111”;
hy = true;
qwe= collision.gameObject;
break;
case "pe":
if (hy)
{
honeyCount++;
hy = false;
Vector3 homePos = new Vector3(
Random.Range(-0.1f, 0.1f),
Random.Range(-0.1f, 0.1f),
);
Destroy(rty);
refreshSpecificFoodItem(qwe);
}
break;
}
}
private void es()
{
foreach (GameObject foodItem in fs)
{
bool flag = true;
while (flag)
{
// assign position
foodItem.transform.position = new Vector3(UnityEngine.Random.Range(-1f, 1f), UnityEngine.Random.Range(-1f, 0f), 0);
Collider2D[] ci = Physics2D.OverlapCircleAll(new Vector2(foodItem.transform.position.x,foodItem.transform.position.y), 4);
if (ci.Length == 0)
{
flag = false;
}
}
foodItem.SetActive(true);
}
}
private void recm(GameObject Im)
{
while (flag)
{
fm.transform.position = new Vector3(UnityEngine.Random.Range(-1f, 1f), UnityEngine.Random.Range(-1f, 1f), 0);
Collider2D[] ci = Physics2D.OverlapCircleAll(new Vector2(foodItem.transform.position.x, foodItem.transform.position.y), 6);
if (ci.Length == 0)
{
flag = false;
}
}
}