示例#1
0
    // Update is called once per frame
    private void Update()
    {
        timer += Time.deltaTime;
        if (timer > spawnRate)
        {
            timer -= spawnRate;

            // Spawn object with random 2D rotation.
            PooledObject instance =
                Pool.Instance.Spawn(projectile, transform.position, Quaternion.Euler(0f, 0f, Random.Range(0f, 360f)));
            instance.As <Projectile>().speed = Random.Range(.5f, 1f);
        }
    }