// Use this for initialization void Start() { Point = new List <GameObject>(); nowPoint = 0; LineUp = GameObject.Find("LineUp").GetComponent <LineUp>(); Point = LineUp.GetPointList(); GetComponent <NavMeshAgent>().SetDestination(Point[nowPoint].transform.position); startPos = transform.position; }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Space) && !state) { point = LineUp.GetPointList(); ballMax = point.Count; state = true; } if (state && Time.frameCount % FrameInterval == 0 && ballCount < ballMax) { ballCount++; GameObject obj = Instantiate(Ball, StartObject.transform.position, Quaternion.identity); } }