Ejemplo n.º 1
0
        /// <summary>
        /// Starts the program.
        /// </summary>
        private static void Main()
        {
            IInterprocessSerializer interprocessSerializer = new InterprocessSerializer();
            INetworkSerializer      networkSerializer      = new NetworkSerializer();

            IInterprocessStream interprocessStream =
                new InterprocessStream(DefaultInterprocessStreamName, interprocessSerializer);

            INetworkStream networkStream =
                new NetworkStream(DefaultNetworkStreamName, networkSerializer);

            IMediaSystem mediaSystem =
                new MediaSystem(DefaultMediaSystemName, interprocessStream, networkStream);

            interprocessStream.Start();
            networkStream.Start();

            mediaSystem.Start();
            mediaSystem.WaitForFinished();

            interprocessStream.Stop();
            networkStream.Stop();

            interprocessStream.WaitForFinished();
            networkStream.WaitForFinished();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            if (!beenDrawn)
            {
                MediaSystem.LoadSoundEffects(Content);
                beenDrawn = true;
            }

            GraphicsDevice.Clear(Color.Black);

            if (Loading)
            {
                RenderingDevice.SpriteBatch.Begin();
                RenderingDevice.SpriteBatch.Draw(loadingSplash, new Vector2(RenderingDevice.Width * 0.5f, RenderingDevice.Height * 0.5f), Color.White);
                RenderingDevice.SpriteBatch.End();
                loadingScreen.Draw();
            }
            else
            {
                MenuHandler.Draw(gameTime);
            }

            if (GameManager.State == GameState.Running)
            {
                DrawScene(gameTime);
            }

            base.Draw(gameTime);
        }
Ejemplo n.º 3
0
 public override void Update(GameTime gameTime)
 {
     if (Vector3.Distance(Program.Game.Player.PhysicsObject.Position, originalPosition) < doorRadius)
     {
         if (lineJoint.Motor.Settings.Servo.Goal == lineJoint.Limit.Minimum)
         {
             MediaSystem.PlaySoundEffect(SFXOptions.Win);
         }
         lineJoint.Motor.Settings.Servo.Goal = lineJoint.Limit.Maximum;
     }
     else
     {
         if (lineJoint.Motor.Settings.Servo.Goal == lineJoint.Limit.Maximum)
         {
             MediaSystem.PlaySoundEffect(SFXOptions.Fail);
         }
         lineJoint.Motor.Settings.Servo.Goal = lineJoint.Limit.Minimum;
     }
 }
Ejemplo n.º 4
0
        public virtual void Damage(float amount, Actor attacker)
        {
            if (this is Player)
            {
                MediaSystem.PlaySoundEffect(SFXOptions.Explosion);
            }
            else
            {
                MediaSystem.PlaySoundEffect(SFXOptions.Achievement);
            }

            Health -= amount;
            if (Health < 0)
            {
                Health = 0;
            }

            if (Health == 0)
            {
                OnDeath(attacker);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            if ((!IsActive && Loader != null) || locked)
            {
                base.Update(gameTime);
                return;
            }

            Input.Update(gameTime, false);
            MediaSystem.Update(gameTime, Program.Game.IsActive);

            if (Loading)
            {
                IsFixedTimeStep = true;
                Loader l = loadingScreen.Update(gameTime);
                if (l != null)
                {
                    IsFixedTimeStep = false;
                    Loader          = l;
                    loadingScreen   = null;
                    Loading         = false;
                    MenuHandler.Create(Loader);
                    createActors();
                }
            }
            else
            {
                GameState statePrior = GameManager.State;
                MenuHandler.Update(gameTime);
                bool stateChanged = GameManager.State != statePrior;

                if (GameManager.State == GameState.Running)
                {
                    IsMouseVisible = false;
                    if ((Input.CheckKeyboardJustPressed(Keys.Escape) ||
                         Input.CheckXboxJustPressed(Buttons.Start)) && !stateChanged)
                    {
                        //MediaSystem.PlaySoundEffect(SFXOptions.Pause);
                        GameManager.State = GameState.Paused;
                    }
                    else
                    {
                        GameManager.Space.Update((float)(gameTime.ElapsedGameTime.TotalSeconds));
                        RenderingDevice.Update(gameTime);

                        Player.Update(gameTime);
                        SubtitleBox.Update();
                        august.Update(gameTime);
                        foreach (Actor a in actorList)
                        {
                            a.Update(gameTime);
                        }

                        if (IsActive)
                        {
                            Mouse.SetPosition(GraphicsDevice.Viewport.Width / 2, GraphicsDevice.Viewport.Height / 2);
                        }
                    }
                }
                else if (GameManager.State != GameState.Ending && GameManager.State != GameState.GameOver && GameManager.State != GameState.Menuing_Lev)
                {
                    IsMouseVisible = true;
                }
            }

            base.Update(gameTime);
        }