コード例 #1
0
        public override void Update(GameTime time)
        {
            entityManager.Update(time);
            if (state == LevelState.PlayerAlive)
            {
                if (enemyGenerator != null)
                {
                    enemyGenerator.Update(time);
                }
            }

            if (state == LevelState.PlayerDead)
            {
                counter += (float)time.ElapsedGameTime.Milliseconds;
                if (counter > 1500)
                {
                    ChangeState(LevelState.PlayerAlive);
                    counter = 0;
                }
            }

            float scale          = 1.5f;
            float movementFactor = 0.6f;

            Matrix tmp = Matrix.CreateScale(scale) * Matrix.CreateTranslation(
                movementFactor * new Vector3(GraphicsDevice.Viewport.Width / 2 - player.Position.X * GraphicsDevice.Viewport.Width * scale,
                                             GraphicsDevice.Viewport.Height / 2 - player.Position.Y * GraphicsDevice.Viewport.Height * scale, 0));
            Vector2 vTmp = Vector2.Transform(player.Position, tmp);


            TransformMatrix = tmp;

            base.Update(time);
        }