Пример #1
0
        public void SpawnNewMeteor(Point2 playerPosition)
        {
            var rotationSpeed = _random.Next(-10, 10) * 0.1f;
            var spawnCircle   = new CircleF(playerPosition, 630);
            var spawnAngle    = MathHelper.ToRadians(_random.Next(0, 360));
            var spawnPosition = spawnCircle.GetPointAlongEdge(spawnAngle);
            var velocity      = (playerPosition - spawnPosition).Rotate(MathHelper.ToRadians(_random.Next(-15, 15))) * _random.Next(3, 10) * 0.01f;
            var textureRegion = GetMeteorRegion(4);
            var meteor        = new Meteor(textureRegion, spawnPosition, velocity, rotationSpeed, 3);

            _entityManager.AddEntity(meteor);
        }
Пример #2
0
        public void SpawnNewMeteor(Vector2 playerPosition)
        {
            var rotationSpeed = _random.Next(-10, 10) * 0.1f;
            var spawnCircle = new CircleF(playerPosition, 630);
            var spawnAngle = MathHelper.ToRadians(_random.Next(0, 360));
            var spawnPosition = spawnCircle.GetPointAlongEdge(spawnAngle);
            var velocity = (playerPosition - spawnPosition).Rotate(MathHelper.ToRadians(_random.Next(-15, 15))) * _random.Next(3, 10) * 0.01f;
            var textureRegion = GetMeteorRegion(4);
            var meteor = new Meteor(textureRegion, spawnPosition, velocity, rotationSpeed, 3);

            _entityManager.AddEntity(meteor);
        }