Пример #1
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="e">Provides a snapshot of timing values.</param>
        public override void Render(FrameEventArgs e)
        {
            GL.Viewport(0, 0, sceneManager.Width, sceneManager.Height);
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            float width = sceneManager.Width, height = sceneManager.Height, fontSize = Math.Min(width, height) / 10f;

            GUI.clearColour = Color.Transparent;
            GUI.Label(new Rectangle(0, 40, (int)width, (int)(fontSize * 2f)), "Pellets: " + pelletsCollected.ToString() + "/" + pelletIndex.ToString(), 20, StringAlignment.Near, Color.White);
            GUI.Label(new Rectangle(0, 0, (int)width, (int)(fontSize * 2f)), "Score: " + score.ToString(), 18, StringAlignment.Near, Color.White);
            GUI.Label(new Rectangle(0, -40, (int)width, (int)(fontSize * 2f)), "Lives: " + lifeTotal.ToString(), 20, StringAlignment.Far, Color.White);
            if (ghostKill)
            {
                GUI.Label(new Rectangle(0, -20, (int)width, (int)(fontSize * 2f)), "Power-up:", 18, StringAlignment.Center, Color.White);
                GUI.Label(new Rectangle(0, 0, (int)width, (int)(fontSize * 2f)), timer.ToString("0.00"), 18, StringAlignment.Center, Color.White);
            }
            if (!collisionOn)
            {
                GUI.Label(new Rectangle(0, 0, (int)width, (int)(fontSize * 2f)), "Collision off ", 25, StringAlignment.Far, Color.White);
            }
            if (!ghostsOn)
            {
                GUI.Label(new Rectangle(0, 40, (int)width, (int)(fontSize * 2f)), "Ghosts off ", 25, StringAlignment.Far, Color.White);
            }
            systemManager.ActionSystems(entityManager);

            GUI.Render();
        }
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="e">Provides a snapshot of timing values.</param>
        public override void Update(FrameEventArgs e)
        {
            AIManager.Instance.AIRandom = new Random();

            //if (GamePad.GetState(1).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Key.Escape))
            //    sceneManager.Exit();

            TimeManager.dt = (float)e.Time;

            if (!started && startTime > currentStart)
            {
                currentStart += (float)e.Time;
            }

            if (!started && startTime <= currentStart)
            {
                StartGame();
            }

            systemManager.ActionSystems(entityManager);

            var state = Mouse.GetState();

            SystemManager.Instance.GetSystem <SystemPlayerController>().PreviousMousePosition = new Vector2(state.X, state.Y);
        }
Пример #3
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="e">Provides a snapshot of timing values.</param>
        protected override void OnRenderFrame(FrameEventArgs e)
        {
            base.OnRenderFrame(e);
            GL.Viewport(0, 0, Width, Height);

            systemManager.ActionSystems(entityManager);

            GL.Flush();
            SwapBuffers();
        }
Пример #4
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="e">Provides a snapshot of timing values.</param>
        protected override void OnUpdateFrame(FrameEventArgs e)
        {
            base.OnUpdateFrame(e);

            // ------------------------ TIMING ------------------------
            dt = (float)(e.Time);
            // TODO: Add your update logic here

            OldCameraPosition = new Vector2(playerCamera.Position.X, playerCamera.Position.Z);
            systemManager.ActionSystems(entityManager);
        }
Пример #5
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="e">Provides a snapshot of timing values.</param>
        public override void Render(FrameEventArgs e)
        {
            GL.Viewport(0, 0, sceneManager.Width, sceneManager.Height);
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            //float width = sceneManager.Width, height = sceneManager.Height, fontSize = Math.Min(width, height) / 10f;
            //GUI.Label(new Rectangle(0, (int)(fontSize / 2f), (int)width, (int)(fontSize * 2f)), "Lives = ", (int)fontSize, StringAlignment.Center);



            systemManager.ActionSystems(entityManager);
        }
Пример #6
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="e">Provides a snapshot of timing values.</param>
        public override void Render(FrameEventArgs e)
        {
            GL.Viewport(0, 0, sceneManager.Width, sceneManager.Height);
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            // Action ALL systems
            systemManager.ActionSystems(entityManager, canDroneMove, canPlayerCollide);

            // Render score
            float width = sceneManager.Width, height = sceneManager.Height, fontSize = Math.Min(width, height) / 10f;

            GUI.clearColour = Color.Transparent;
            GUI.Label(new Rectangle(0, 0, (int)width, (int)(fontSize * 2f)), "Keys Left: " + keysLeft.ToString(), 18, StringAlignment.Near, Color.White);
            GUI.Label(new Rectangle(0, 20, (int)width, (int)(fontSize * 2f)), "Lives: " + lives.ToString(), 18, StringAlignment.Near, Color.White);

            GUI.Render();
        }