Ejemplo n.º 1
0
    void SpawnAsteroid()
    {
        Vector3    spawnPos = Random.insideUnitSphere * _spawnRadius;
        Quaternion spawnRot = Quaternion.identity;

        _asteroidFactory.CreateAsteroid(_asteroidFactory.AsteroidType((uint)Random.Range(1, _difficulty)), spawnPos, spawnRot);
    }
Ejemplo n.º 2
0
        public void CreateAsteroidTest()
        {
            var asteroidFactory = new AsteroidFactory();
            var asteroid        = asteroidFactory.CreateAsteroid(100, 100);

            string expectedName = "first";

            Assert.AreEqual(expectedName, asteroid.Name);
        }
Ejemplo n.º 3
0
    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);
    }