コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        if (counter <= ballNumber)
        {
            int size = balls.Count - 1;

            SwipeBall1 s = balls[size].GetComponent <SwipeBall1>();

            if (s.ballThrown == true)
            {
                nextBall++;

                if (nextBall >= timeOfRespawn)
                {
                    nextBall = 0;
                    CreateBall();
                }
            }
        }
    }
コード例 #2
0
    private void DestroyBall()
    {
        if (balls.Count > 0)
        {
            for (int i = 0; i < balls.Count; i++)
            {
                if (balls[i] == null)
                {
                    continue;
                }
                SwipeBall1 s = balls[i].GetComponent <SwipeBall1>();

                if (s.timeOfLife <= 0)
                {
                    GameObject tmp = balls[i];
                    balls.RemoveAt(i);
                    Destroy(tmp);
                }
            }
        }
    }