您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
21 行
467 B
21 行
467 B
using UnityEngine;
|
|
|
|
public class FoodLogic : MonoBehaviour
|
|
{
|
|
public bool respawn;
|
|
public FoodCollectorArea myArea;
|
|
|
|
public void OnEaten()
|
|
{
|
|
if (respawn)
|
|
{
|
|
transform.position = new Vector3(Random.Range(-myArea.range, myArea.range),
|
|
3f,
|
|
Random.Range(-myArea.range, myArea.range)) + myArea.transform.position;
|
|
}
|
|
else
|
|
{
|
|
Destroy(gameObject);
|
|
}
|
|
}
|
|
}
|