using UnityEngine;
using System.Collections;
public class FoodSnake : MonoBehaviour {
public int yLimit = 30;
public int xLimit = 22;
public GameObject SSFood;
// Use this for initialization
void Start ()
{
InvokeRepeating("Food", 1, 4);
}
// Update is called once per frame
void Food()
{
int x = Random.Range(-xLimit,xLimit);
int y = Random.Range(-yLimit,yLimit);
//Quaternion.identity=旋转的角度0.0.0.0 SSFood是这个cube new Vector2(x, y) 物体出现的位置
Instantiate(SSFood, new Vector2(x, y), Quaternion.identity);
}
void Update ()
{
}
}