Exemple #1
0
        public GameLevel(int id, string name, GameWindow gameWindow)
        {
            ID   = id;
            Name = name;

            Shapes2Remove = new Stack <Shape3D>();

            CurrentState = Level.State.Loading;

            IsFinishedWithSuccess = false;

            GameWindow = gameWindow;

            TextRender = new TextRender(300, 300, new Vector2(10, 10),
                                        FontFamily.Families[125], 9, false);

            TextRender.Load(GameWindow.Width, GameWindow.Height);
        }
Exemple #2
0
        public MyGameLevel(int id, string name, GameWindow gameWindow,
                           Vector2 targetPosition,
                           MyPlayer player)
            : base(id, name, gameWindow)
        {
            aspectRatio = (float)GameWindow.Width / GameWindow.Height;

            oldMouseState = OpenTK.Input.Mouse.GetCursorState();

            TargetPosition = targetPosition;

            Camera = new Camera();

            Camera.Position = new Vector3(0, -150, 0);
            Camera.Rotate(new Vector3(Camera.CameraUVW.Row0),
                          MathHelper.PiOver2);

            Camera.Update();

            TextRenderClock =
                new TextRender(150, 100,
                               new Vector2(GameWindow.Width - 160 - 100, 10),
                               FontFamily.Families[19], 52);

            TextRenderClock.BackgroundColor = Color.FromArgb(0, 0, 0, 0);

            TextRenderClock.FontStyle = FontStyle.Bold;

            TextRenderClock.Load(GameWindow.Width, GameWindow.Height);

            DateTimeClock = DateTime.Now;

            PointLight = new PointLight
            {
                Position = new Vector3(-30f, 5f, -30f),
                Color    = new Vector3(0.9f, 0.9f, 0.9f),
                //Intensity = 0.2f
                Intensity = 1
            };

            SpotLight = new SpotLight
            {
                Position = new Vector3(30f, 6f, -30f),
                Color    = new Vector3(0.9f, 0.9f, 0.8f),
                //Intensity = 0.2f,
                Intensity     = 1,
                ConeAngle     = 0.5f,
                ConeDirection = new Vector3(0f, -1f, 0f)
            };

            CubesHaveNormalMap = true;

            Load();

            ballUpdateOldPosition = Shapes3D["sphereEnvCubeMap"].Position;

            SunLightPosition = new Vector3(68, 200, -18);
            //SunLightPosition = -ShadowMap.LightView.Position;

            CurrentState = State.Running;

            FinishCamera = new Camera();
        }