Esempio n. 1
0
    IEnumerator spawnCircle(float radius = 8.0f)
    {
        if (player.activeInHierarchy)
        {
            Vector3 pos;

            for (int i = 0; i < 360; i += 45)
            {
                pos.x = player.transform.position.x + radius * Mathf.Sin(i * Mathf.Deg2Rad);
                pos.y = 0f;
                pos.z = player.transform.position.z + radius * Mathf.Cos(i * Mathf.Deg2Rad);

                if (SpawnHelpers.InsideTheWall(pos, walls))
                {
                    Instantiate(enemy, pos, Quaternion.Euler(Vector3.zero));
                }
                yield return(new WaitForSeconds(0.1f));
            }
        }
    }