<commit_before>﻿/*
** Project ShiftDrive
** (C) <NAME>, 2016.
*/

using Microsoft.Xna.Framework;

namespace ShiftDrive {

    /// <summary>
    /// A <seealso cref="GameObject"/> representing a single asteroid.
    /// </summary>
    internal sealed class Asteroid : GameObject {

        public Asteroid() {
            type = ObjectType.Asteroid;
            facing = Utils.RNG.Next(0, 360);
            spritename = "map/asteroid";
            color = Color.White;
            bounding = 7f;
        }

        public override void Update(GameState world, float deltaTime) {
            base.Update(world, deltaTime);
        }

        protected override void OnCollision(GameObject other, Vector2 normal, float penetration) {
            base.OnCollision(other, normal, penetration);


            // asteroids shouldn't move so much if ships bump into them, because
            // they should look heavy and sluggish
            if (other.type == ObjectType.AIShip || other.type == ObjectType.PlayerShip)
                this.velocity *= 0.8f;
        }

        public override bool IsTerrain() {
            return true;
        }

    }

}<commit_msg>Apply angular velocity to asteroids<commit_after>﻿/*
** Project ShiftDrive
** (C) <NAME>, 2016.
*/

using System;
using Microsoft.Xna.Framework;

namespace ShiftDrive {

    /// <summary>
    /// A <seealso cref="GameObject"/> representing a single asteroid.
    /// </summary>
    internal sealed class Asteroid : GameObject {

        private float angularVelocity;

        public Asteroid() {
            type = ObjectType.Asteroid;
            facing = Utils.RNG.Next(0, 360);
            spritename = "map/asteroid";
            color = Color.White;
            bounding = 7f;
        }

        public override void Update(GameState world, float deltaTime) {
            base.Update(world, deltaTime);

            facing += angularVelocity * deltaTime;
            angularVelocity *= (float)Math.Pow(0.8f, deltaTime);
        }

        protected override void OnCollision(GameObject other, Vector2 normal, float penetration) {
            base.OnCollision(other, normal, penetration);

            // spin around!
            angularVelocity += (1f + penetration * 4f) * (float)(Utils.RNG.NextDouble() * 2.0 - 1.0);

            // asteroids shouldn't move so much if ships bump into them, because
            // they should look heavy and sluggish
            if (other.type == ObjectType.AIShip || other.type == ObjectType.PlayerShip)
                this.velocity *= 0.8f;
        }

        public override bool IsTerrain() {
            return true;
        }

    }

}
{'fraction_non_alphanumeric': 0.10631857737419599, 'fraction_numerical': 0.012107453651153992, 'mean_word_length': 1.9707865168539327, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3260005', 'n_tokens_mistral': 767, 'n_tokens_neox': 700, 'n_words': 200}