Example #1
0
        /// <summary>Load resources here.</summary>
        /// <param name="e">Not used.</param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            UserInterface.UserInterface.Initialize();
            World.Billboards.Initialize();
            Enemy.Init();
            Asteroid.Init();

            world = new World.World();
            player = new Player();
            camera = new Camera();

            Mouse.ButtonDown += Mouse_ButtonDown;
            Mouse.ButtonUp += Mouse_ButtonUp;
            GL.ClearColor(0.1f, 0.2f, 0.5f, 0.0f);
            GL.Enable(EnableCap.DepthTest);
            GL.Enable(EnableCap.Texture2D);
            GL.TexEnv(TextureEnvTarget.TextureEnv, TextureEnvParameter.TextureEnvMode, (float)TextureEnvMode.Modulate);

            InitLightning();

            Explosion.Init();
        }
Example #2
0
        public void Crash(Player o)
        {
            float mass1 = 1f;
            float mass2 = 1f;
            Vector3 n = (this.bb.center + this.position) - (o.bb.center + o.position);
            n.NormalizeFast();

            float a1 = Vector3.Dot(this.movement, n);
            float a2 = Vector3.Dot(o.velocity, n);

            float iz = (2f * (a1 - a2)) / (mass1 + mass2);

            this.movement -= iz * mass2 * n;
            //o.velocity += iz * mass1 * n;
        }