void SpawnAsteroid() { Vector3 spawnPos = Random.insideUnitSphere * _spawnRadius; Quaternion spawnRot = Quaternion.identity; _asteroidFactory.CreateAsteroid(_asteroidFactory.AsteroidType((uint)Random.Range(1, _difficulty)), spawnPos, spawnRot); }
public void CreateAsteroidTest() { var asteroidFactory = new AsteroidFactory(); var asteroid = asteroidFactory.CreateAsteroid(100, 100); string expectedName = "first"; Assert.AreEqual(expectedName, asteroid.Name); }
public void SpawnAsteroid(Vector2 position, Asteroid.Size size) { Asteroid asteroid = asteroidFactory.CreateAsteroid(size, OnAsteroidDied); asteroid.transform.position = position; asteroid.MoveInDirection(Random.insideUnitCircle, Random.Range(minimumAsteroidSpawnVelocity, maxAsteroidSpawnVelocity)); float randomRotation = Random.Range(-1, 1); randomRotation += Mathf.Sign(randomRotation); asteroid.RotateInDirection(randomRotation); }