Exemplo n.º 1
0
        public void Draw(SpriteBatch spriteBatch, Camera.Camera camera)
        {
            var screenRectangle = camera.ViewportWorldBoundry();

            int startX = (int)Math.Max(0, screenRectangle.X / _mapData.TileWidth - 1);
            int startY = (int)Math.Max(0, screenRectangle.Y / _mapData.TileHeight - 1);

            int endX = Math.Min(_mapData.MapWidth, screenRectangle.Right / _mapData.TileWidth + 1);
            int endY = Math.Min(_mapData.MapHeight, screenRectangle.Bottom / _mapData.TileHeight + 1);


            for (int y = startY; y < endY; y++)
            {
                for (int x = startX; x < endX; x++)
                {
                    //set the position on screen
                    SetDestinationRectangle(y, x);

                    //set the position in the texture
                    SetSourceRectangle(_mapData.TileMap[y, x]);

                    spriteBatch.Draw(_mapData.Texture, _destinationRectangle, _sourceRectangle, Color.White);
                }
            }
        }
Exemplo n.º 2
0
        public async Task Start()
        {
            Active = true;
            await CitizenFX.Core.Game.Player.Spawn(PlayerPosition, PlayerHeading);

            await BaseScript.Delay(500);

            Game.Data.Character.ModelHash = (long)PedHash.FreemodeMale01;

            await CitizenFX.Core.Game.Player.SetModel(PedHash.FreemodeMale01);

            CitizenFX.Core.Game.Player.Character.Style.SetDefaultClothes();

            Function.Call(Hash.SET_PLAYER_CONTROL, CitizenFX.Core.Game.Player, false, 1280);
            Function.Call(Hash.SET_ENTITY_COLLISION, CitizenFX.Core.Game.Player.Character, true);
            Function.Call(Hash.FREEZE_ENTITY_POSITION, CitizenFX.Core.Game.Player, true);
            Function.Call(Hash.SET_PLAYER_INVINCIBLE, CitizenFX.Core.Game.Player, true);

            Screen.Hud.IsVisible      = false;
            Screen.Hud.IsRadarVisible = false;
            Screen.Effects.Stop();
            Screen.Effects.Start(ScreenEffect.SwitchHudOut);

            CitizenFX.Core.Game.Player.Character.Show();

            camera         = new Camera.Camera(CameraPosition, Vector3.Zero, CameraFieldOfView);
            camera.Enabled = true;

            menu = new Menu.Menu();

            menu.Open();
        }
        public void Initialize(int activeLevel)
        {
            headsUpDisplay.Initialize();

            Level = LevelFactory.LoadLevel("Content\\Levels\\Level " + activeLevel + ".xml");
            _camera = new Camera.Camera(Level.Player, _graphicsDeviceManager.GraphicsDevice.Viewport);
        }
Exemplo n.º 4
0
 private void CamaeraAgreeButton_Click(object sender, RoutedEventArgs e)
 {
     WarningGrid.Visibility           = Visibility.Hidden;
     CamaeraAgreeButton.Visibility    = Visibility.Hidden;
     CamaeraDisagreeButton.Visibility = Visibility.Hidden;
     OnionGrid.Visibility             = Visibility.Visible;
     camera = new Camera.Camera(Camera.Camera.CameraMode.Negative);
 }
Exemplo n.º 5
0
 public VScrollBar(Texture2D bulletTexture, Texture2D barTexture, Camera.Camera camera, Vector2 location, Vector2 size, float layer)
 {
     this.BarLocation    = location;
     this.size           = size;
     this.camera         = camera;
     this.bulletLocation = location;
     this.bulletTexture  = bulletTexture;
     this.barTexture     = barTexture;
     IsDragging          = IsLocked = false;
     this.layer          = layer;
 }
Exemplo n.º 6
0
        public GameData(List <Model> models, Camera.Camera camera, Cameras cameras, List <LightSource> lightSources,
                        ILightningModel lightningModel, Model player)
        {
            this.models         = models;
            this.camera         = camera;
            this.lightSources   = lightSources;
            this.lightningModel = lightningModel;
            this.cameras        = cameras;
            this.player         = player;

            models.Add(player);
        }
Exemplo n.º 7
0
 public StaticObject(Level.TileMap tileMap, Camera.Camera camera, Vector2 location, int frameWidth, int frameHeight)
 {
     this.tileMap      = tileMap;
     this.camera       = camera;
     this.location     = location;
     this.enabled      = true;
     this.frameWidth   = frameWidth;
     this.frameHeight  = frameHeight;
     this.Layer        = 0.0f;
     this.Transparency = 1.0f;
     this.Remove       = false;
 }
Exemplo n.º 8
0
        public MeshRender(String object_file, DeviceManager dev_manager, Camera.Camera cam)
        {
            _cam = cam;
            _dev_manager = dev_manager;
            _device = _dev_manager.Device;
            _object_file_path = object_file;
            _mesh_parser = new Lexer();

            Scaling = 1f;
            Position = Vector3.Zero;

            OnRestore();
        }
Exemplo n.º 9
0
        public virtual void InitializeGUI(ContentManager Content)
        {
            camera = new Camera.Camera(Vector2.Zero, new Vector2(this.Width, Resolution.ResolutionHandler.WindowHeight - 215), new Vector2(this.Width, this.Height));

            for (int i = 0; i < CountTiles; i++)
            {
                DrawProperties button = new DrawProperties(Content.Load <Texture2D>(@"Textures/PlatformTilesTemp"), Scene.DisplayLayer.Editor + 0.1f, 1.0f, 0.0f, Color.White);
                DrawProperties frame  = new DrawProperties(Content.Load <Texture2D>(@"Buttons/tileFrame"), Scene.DisplayLayer.Editor + 0.2f, 1.0f, 0.0f, Color.White);
                components.Add(new TileButton(button, frame, new Vector2((i % 2) * (TileWidth + TileOffset) + TileOffset, i / 2 * (TileHeight + TileOffset) + TileOffset) + SceneLocation, new Vector2(TileWidth, TileHeight), TileSourceRectangle(i), this.camera, this.SceneRectangle, i));
                components[i].StoreAndExecuteOnMouseRelease(new Actions.SetSelectedTileAction((TileButton)components[i]));
            }
            vScrollBar = new VScrollBar(Content.Load <Texture2D>(@"ScrollBars/bullet"), Content.Load <Texture2D>(@"ScrollBars/bar"), camera, new Vector2(this.scenerySize.X - ScrollBarWidth, 0) + SceneLocation, new Vector2(ScrollBarWidth, scenerySize.Y - 5), Scene.DisplayLayer.Editor + 0.1f);
        }
Exemplo n.º 10
0
 public MapObject(Level.TileMap tileMap, Camera.Camera camera, Vector2 location, int frameWidth, int frameHeight, int collideWidth, int collideHeight)
 {
     animations         = new Dictionary <string, AnimationStrip>();
     this.enabled       = true;
     this.location      = location;
     this.frameHeight   = frameHeight;
     this.frameWidth    = frameWidth;
     this.collideHeight = collideHeight;
     this.collideWidth  = collideWidth;
     this.tileMap       = tileMap;
     this.camera        = camera;
     this.Transparency  = 1.0f;
     this.Expired       = false;
     OnGround           = false;
 }
Exemplo n.º 11
0
 public Canvas(GraphicsDevice graphics, int width, int height, bool pixel)
 {
     this.Width  = width;
     this.Height = height;
     this.Pixel  = pixel;
     if (this.Pixel)
     {
         this.SamplerState = SamplerState.PointClamp;
     }
     else
     {
         this.SamplerState = SamplerState.LinearClamp;
     }
     this.RenderTarget = new RenderTarget2D(graphics, this.Width, this.Height, !pixel, SurfaceFormat.Color, DepthFormat.None);
     this.Camera       = new Camera.Camera(this);
 }
Exemplo n.º 12
0
        public override void Draw(GameTime gameTime)
        {
            EffectParameterCollection parameters = particleEffect.Parameters;

            parameters["StartSize"].SetValue(new Vector2((FlameSize - (FlameSize * sizeDiff)) * sizeMod, (FlameSize + (FlameSize * sizeDiff)) * sizeMod));
            parameters["EndSize"].SetValue(new Vector2((FlameSize - (FlameSize * sizeDiff)) * sizeMod, (FlameSize + (FlameSize * sizeDiff)) * sizeMod));

            for (int u = 0; u < FireSpread.FLAME_PARTICLES_PER_FRAME; u++)
            {
                this.AddParticle(this.Position, Vector3.Zero);
            }

            Camera.Camera cam = (Camera.Camera) this.Game.Services.GetService(typeof(Camera.Camera));
            this.SetCamera(cam.viewMatrix, cam.projectionMatrix);

            base.Draw(gameTime);
        }
Exemplo n.º 13
0
        private void RegisterLineNextButton_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            currentRegisterLine++;

            if (currentRegisterLine == 1)
            {
                RegisterTextBlock.Text = "What is your name?";
            }
            else if (currentRegisterLine == 2)
            {
                RegisterLineGrid.Visibility      = Visibility.Hidden;
                RegisterNameEnterGrid.Visibility = Visibility.Visible;
            }
            else if (currentRegisterLine == 3)
            {
                RegisterTextBlock.Text = "I'm always thirsty and need your help.";
            }
            else if (currentRegisterLine == 4)
            {
                RegisterTextBlock.Text = "Would you please drink water?\nI can drink when you drink.";
            }
            else if (currentRegisterLine == 5)
            {
                InstructionLineGrid.Visibility          = Visibility.Visible;
                RegisterLineNextButton.IsHitTestVisible = false;
                cameraCounterWorker.RunWorkerAsync();
            }
            else if (currentRegisterLine == 6)
            {
                RegistrationOnionImg.Source = new BitmapImage(new Uri(@"Image\OnionCharacter_Happy.png", UriKind.Relative));
                RegisterTextBlock.Text      = "Now I can count whenever you drink.\nIf you don't drink often, I will ask for it.";
                camera = new Camera.Camera(Camera.Camera.CameraMode.Prediction);
                predictionWorker.RunWorkerAsync();
            }
            else if (currentRegisterLine == 7)
            {
                RegisterTextBlock.Text = "Then let's start!";
            }
            else if (currentRegisterLine == 8)
            {
                RegisterTextBlock.Text            = "";
                RegisterLineNextButton.Visibility = Visibility.Hidden;
            }
        }
Exemplo n.º 14
0
        public void Draw(GameTime gameTime, Camera.Camera camera, States.Level level)
        {
            //Set the technique we will use
            effect.CurrentTechnique = effect.Techniques["Waves"];

            //Set the parameters of the effects
            effect.Parameters["waveTexture"].SetValue(texture);
            effect.Parameters["World"].SetValue(level.World);
            effect.Parameters["View"].SetValue(camera.viewMatrix);
            effect.Parameters["Projection"].SetValue(camera.projectionMatrix);
            effect.Parameters["time"].SetValue(time);
            effect.Parameters["alpha"].SetValue((float)alpha);

            //Apply the technique
            effect.CurrentTechnique.Passes[0].Apply();

            //Draw the vertices
            game.GraphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleStrip, vertices, 0, 2);
        }
Exemplo n.º 15
0
        public MenuHandler(ContentManager Content, GraphicsDevice graphicsDevice, MapHandlerScene mapHandler, Level.TileMap tileMap, SceneDirector sceneDirector)
        {
            this.graphicsDevice = graphicsDevice;
            menuWindows         = new Dictionary <string, IScene>();
            menuWindows.Add("mainMenu", new MainMenu(Content, this, sceneDirector));
            menuWindows.Add("newMap", new NewMapMenu(Content, this, tileMap));
            menuWindows.Add("loadMap", new LoadMapMenu(graphicsDevice, Content, this, mapHandler, tileMap));
            menuWindows.Add("saveMap", new SaveMapMenu(Content, this, mapHandler));

            activeWindow = menuWindows["mainMenu"];
            IsActive     = false;
            currentState = new MenuStateEnum();
            currentState = MenuStateEnum.Hidden;
            transition   = new Animations.SmoothTransition(0.0f, 0.011f, 0.0f, 1.0f);

            this.camera = new Camera.Camera(Vector2.Zero, new Vector2(Resolution.ResolutionHandler.WindowWidth, Resolution.ResolutionHandler.WindowHeight), new Vector2(Resolution.ResolutionHandler.WindowWidth, Resolution.ResolutionHandler.WindowHeight));
            camera.Zoom = transition.Value;
            Resolution.ResolutionHandler.Changed += ResetSizes;
        }
Exemplo n.º 16
0
        private void switchCamera()
        {
            Vector3 _position = cam.CamPos;

            if (devCamOn && camSwitchDelay == 0)
            {
                devCamOn = false;
                Game.Services.RemoveService(typeof(Camera.Camera));
                cam = new Camera.LFCamera(_position, camSpeed, Game.GraphicsDevice);
                Game.Services.AddService(typeof(Camera.Camera), cam);
                if (!Game.Components.Contains(player))
                {
                    player          = new LittleFlame(Game, startPosition, devCamOn, this);
                    player.DevCamOn = false;
                    if (Game.Services.GetService(typeof(LittleFlame)) == null)
                    {
                        Game.Services.AddService(typeof(LittleFlame), player);
                    }
                    else
                    {
                        Game.Services.RemoveService(typeof(LittleFlame));
                        Game.Services.AddService(typeof(LittleFlame), player);
                    }
                    Game.Components.Add(player);
                }
                camSwitchDelay = 1;
            }
            else if (camSwitchDelay == 0)
            {
                devCamOn = player.DevCamOn = true;
                Game.Services.RemoveService(typeof(Camera.Camera));
                cam = new Camera.DevelopCamera(_position, camSpeed, Game.GraphicsDevice);
                Game.Services.AddService(typeof(Camera.Camera), cam);
                if (Game.Components.Contains(player))
                {
                    Game.Components.Remove(player);
                    Game.Services.RemoveService(typeof(LittleFlame));
                }
                camSwitchDelay = 1;
            }
        }
Exemplo n.º 17
0
        public override void Draw(GameTime gameTime)
        {
            if (IsTouched == true)
            {
                const int fireParticlesPerFrame = 3;
                for (int i = 0; i < fireParticlesPerFrame; i++)
                {
                    // Calculate the position for the particles. The particles will spawn in a radius of 4 around the meteor.
                    float   randomNr = (float)rnd.NextDouble() * 4 * (float)Math.PI;
                    Vector3 pos      = this.position + new Vector3((float)Math.Cos(randomNr) * 2f, 0, (float)Math.Sin(randomNr) * 2f);
                    particles.AddParticle(pos, Vector3.Zero);
                }
            }

            this.GraphicsDevice.BlendState = BlendState.Opaque;

            Camera.Camera cam = (Camera.Camera) this.Game.Services.GetService(typeof(Camera.Camera));
            particles.SetCamera(cam.viewMatrix, cam.projectionMatrix);

            base.Draw(gameTime);
        }
Exemplo n.º 18
0
        public VerticalBillBoard(Vector3 origin, float height, Vector2 size, Texture2D texture, int xRowTextures, int yRowTextures, GraphicsDevice graphicsDevice, ContentManager content, Game1 game)
            : base(game)
        {
            this.origin = origin;
            this.size = size;
            this.texture = texture;
            this.xRowTextures = xRowTextures;
            this.yRowTextures = yRowTextures;
            this.graphicsDevice = graphicsDevice;
            this.content = content;
            this.game = game;

            camera = (Camera.Camera)game.Services.GetService(typeof(Camera.Camera));
            level = (States.Level)game.Services.GetService(typeof(States.Level));

            bbEffect = game.Assets.Load<Effect>("bbeffect");

            //Calculates were the corner vectors of the quad are qoing to be
            CalcVertices();

            FillVertices();
        }
Exemplo n.º 19
0
        public SkyDomeSystem(Game game, Camera.Camera camera, GameTime gameTime, GraphicsDevice graphicsDevice)
        {
            this.game = game;
            this.camera = camera;
            this.graphicsDevice = graphicsDevice;
            this.gameTime = gameTime;
            realTime = false;

            parameters = new SkyDomeParameters();

            quad = new QuadRenderComponent(game);
            game.Components.Add(quad);

            fTheta = 0.0f;
            fPhi = 0.0f;

            DomeN = 32;

            GeneratePermTex();
            Initialize();
            LoadContent();
        }
Exemplo n.º 20
0
        public VerticalBillBoard(Vector3 origin, float height, Vector2 size, Texture2D texture, int xRowTextures, int yRowTextures, GraphicsDevice graphicsDevice, ContentManager content, Game1 game)
            : base(game)
        {
            this.origin         = origin;
            this.size           = size;
            this.texture        = texture;
            this.xRowTextures   = xRowTextures;
            this.yRowTextures   = yRowTextures;
            this.graphicsDevice = graphicsDevice;
            this.content        = content;
            this.game           = game;

            camera = (Camera.Camera)game.Services.GetService(typeof(Camera.Camera));
            level  = (States.Level)game.Services.GetService(typeof(States.Level));

            bbEffect = game.Assets.Load <Effect>("bbeffect");

            //Calculates were the corner vectors of the quad are qoing to be
            CalcVertices();

            FillVertices();
        }
Exemplo n.º 21
0
        public MapScene(EditorTileMap tileMap, GraphicsDevice graphicsDevice, ContentManager Content, int TileWidth, int TileHeight, Vector2 sceneLocation, Vector2 scenerySize)
        {
            this.tileMap    = tileMap;
            this.TileWidth  = TileWidth;
            this.TileHeight = TileHeight;

            //TODO: remove after debugging
            tileMap.Randomize(50, 50);
            camera        = new Camera.Camera(Vector2.Zero, scenerySize, new Vector2(this.Width, this.Height));
            cameraManager = new Camera.Managers.CameraManager();
            cameraManager.SetCameraScript(new Camera.Scripts.MouseCamera(camera));
            cameraManager.AddCameraHandler(new Camera.Handlers.Zoomer(1.0f, 1.8f, 0.5f, 0.01f));
            tileMap.Camera = camera;

            this.SceneLocation  = sceneLocation;
            this.graphicsDevice = graphicsDevice;
            this.scenerySize    = scenerySize;
            UpdateRenderTarget();
            tileMap.InitializeButtons(this.SceneRectangle);
            isActive = true;
            Resolution.ResolutionHandler.Changed += ResetSizes;
        }
Exemplo n.º 22
0
        public HorizontalBillboarding(Vector3 origin, float height, Vector2 size, Texture2D texture, int xRowTextures, int yRowTextures, GraphicsDevice graphicsDevice, ContentManager content, Game game)
            : base(game)
        {
            this.origin         = origin;
            this.size           = size;
            this.texture        = texture;
            this.xRowTextures   = xRowTextures;
            this.yRowTextures   = yRowTextures;
            this.graphicsDevice = graphicsDevice;
            this.content        = content;
            this.game           = game;

            vertices = new VertexPositionNormalTexture[4];

            camera = (Camera.Camera)game.Services.GetService(typeof(Camera.Camera));
            level  = (States.Level)game.Services.GetService(typeof(States.Level));

            effect = new AlphaTestEffect(graphicsDevice);

            //Calculates were the corner vectors of the quad are qoing to be
            CalcVertices();

            FillVertices();
        }
Exemplo n.º 23
0
        public HorizontalBillboarding(Vector3 origin, float height, Vector2 size, Texture2D texture, int xRowTextures, int yRowTextures, GraphicsDevice graphicsDevice, ContentManager content, Game game)
            : base(game)
        {
            this.origin = origin;
            this.size = size;
            this.texture = texture;
            this.xRowTextures = xRowTextures;
            this.yRowTextures = yRowTextures;
            this.graphicsDevice = graphicsDevice;
            this.content = content;
            this.game = game;

            vertices = new VertexPositionNormalTexture[4];

            camera = (Camera.Camera)game.Services.GetService(typeof(Camera.Camera));
            level = (States.Level)game.Services.GetService(typeof(States.Level));

            effect = new AlphaTestEffect(graphicsDevice);

            //Calculates were the corner vectors of the quad are qoing to be
            CalcVertices();

            FillVertices();
        }
Exemplo n.º 24
0
 public EditorMapSquare(DrawTextProperties passableText, DrawTextProperties codeValueText, Texture2D background, DrawProperties buttonDrawProperties, DrawProperties buttonActorDrawProperties, DrawProperties frameDrawProperties, Vector2 position, Vector2 size, Rectangle sourceRectangle, Camera.Camera camera, Rectangle generalArea, int layerTile)
     : base(buttonDrawProperties, frameDrawProperties, position, size, sourceRectangle, camera, generalArea, layerTile)
 {
     this.passableText  = passableText;
     this.codeValueText = codeValueText;
     this.background    = background;
     this.buttonActor   = buttonActorDrawProperties;
 }
Exemplo n.º 25
0
 public Billboard(ContentManager content, Camera.Camera camera, GraphicsDevice graphicsDevice)
 {
     this.content = content;
     this.camera = camera;
     this.graphicsDevice = graphicsDevice;
 }
Exemplo n.º 26
0
 void ResetSizes(object sender, EventArgs e)
 {
     this.camera = new Camera.Camera(Vector2.Zero, new Vector2(Resolution.ResolutionHandler.WindowWidth, Resolution.ResolutionHandler.WindowHeight), new Vector2(Resolution.ResolutionHandler.WindowWidth, Resolution.ResolutionHandler.WindowHeight));
     camera.Zoom = transition.Value;
 }
Exemplo n.º 27
0
        public override void Initialize()
        {
            heightmapKey  = "HM" + levelAsset;
            texturemapKey = "TM" + levelAsset;
            modelmapKey   = "MM" + levelAsset;
            scoremapKey   = "SM" + levelAsset;

            // Camera
            camStartPos = new Vector3(0.0f, 40.0f, 0.0f);
            camSpeed    = 50.0f;
            devCamOn    = true;
            cam         = new Camera.DevelopCamera(camStartPos, camSpeed, Game.GraphicsDevice);
            if (Game.Services.GetService(typeof(Camera.Camera)) == null)
            {
                Game.Services.AddService(typeof(Camera.Camera), cam);
            }

            //Add the level service
            if (Game.Services.GetService(typeof(States.Level)) == null)
            {
                Game.Services.AddService(typeof(States.Level), this);
            }
            else
            {
                Game.Services.RemoveService(typeof(States.Level));
                Game.Services.AddService(typeof(States.Level), this);
            }

            // Models
            models = new List <Models.LFModel>();

            //Set water
            waveKey       = "wave";
            baseWaterKey  = "water";
            baseWaterRowX = 10;
            baseWaterRowY = 10;
            amountWaves   = 400;

            skyTextureKey = "sky";

            if (this.timeScore == 0)
            {
                throw new NotImplementedException("Initialise the timeScore variable in Level's subclass.");
            }
            this.collectablesFound = 0;

            // Water
            waterLevel   = 4.5f;
            waterSizeMod = -3;

            worldMatrix = Matrix.CreateTranslation(0, 0, 0);
            //Create the terrain
            terrain = new Terrain(Game, heightmapKey, texturemapKey, this);
            Game.Components.Add(terrain);

            //Make a terrain service
            if (Game.Services.GetService(typeof(Terrain)) != null)
            {
                Game.Services.RemoveService(typeof(Terrain));
            }
            Game.Services.AddService(typeof(Terrain), terrain);

            score = new Score.Score(Game.Assets.Load <Texture2D>(scoremapKey), terrain);

            base.Initialize();
        }
Exemplo n.º 28
0
        public void Build()
        {
            lights          = new List <PointLight>();
            objects         = new List <Primitive>();
            backgroundColor = RGBColor.BLACK;
            //camera = new OrthogonalCamera(600, 480);
            int sceneWidth  = 240;
            int sceneHeight = 240;

            camera   = new PerspectiveCamera(new Vector3(0, 0, 80), new Vector3(0, 0, -1), 50, sceneWidth, sceneHeight); //50
            jittered = new Jittered(9);
            //tracer = new MultipleObjectsTracer(this);

            tracer = new Whitted(this, 10);

            Material.Material orangeMaterial  = new Phong(Color.Orange, 0.8, 1, 30);
            Material.Material redMaterial     = new Lambertian(Color.PowderBlue);
            Material.Material blueMaterial    = new Lambertian(RGBColor.NAVY_BLUE);
            Material.Material grayMaterial    = new Phong(Color.LightGray, 0.8, 1, 30);
            Material.Material yellowMaterial  = new Phong(Color.Yellow, 0.8, 1, 30);
            Material.Material skyBlueMaterial = new Phong(Color.SkyBlue, 0.8, 1, 30);
            Material.Material refMat          = new Reflective(RGBColor.WHITE, 0, 1, 350, 1);
            Material.Material refMat1         = new Reflective(RGBColor.WHITE, 0.5, 1, 350, 0.5);
            Material.Material lamb            = new Lambertian(RGBColor.SKY_BLUE);
            Material.Material refractiveMat   = new Refractive(RGBColor.WHITE, 0, 1, 350, 1);


            Quad wall1 = new Quad(new Vector3(-30, 30, 30), new Vector3(-30, -30, 30), new Vector3(-15, 15, -15), new Vector3(-15, -15, -15));
            //wall1.AddQuadToScene(this, skyBlueMaterial);


            Triangle t1 = new Triangle(new Vector3(-30, 30, 30), new Vector3(-30, -30, 30), new Vector3(-20, 20, -15), new Vector3(1, 0, 0));

            t1.Material = redMaterial;
            AddObject(t1);
            Triangle t2 = new Triangle(new Vector3(-30, -30, 30), new Vector3(-20, 20, -15), new Vector3(-20, -20, -15), new Vector3(1, 0, 0));

            t2.Material = redMaterial;
            AddObject(t2);

            Triangle t3 = new Triangle(new Vector3(30, 30, 30), new Vector3(30, -30, 30), new Vector3(20, 20, -15), new Vector3(-1, 0, 0));

            t3.Material = blueMaterial;
            AddObject(t3);
            Triangle t4 = new Triangle(new Vector3(30, -30, 30), new Vector3(20, 20, -15), new Vector3(20, -20, -15), new Vector3(-1, 0, 0));

            t4.Material = blueMaterial;
            AddObject(t4);

            Triangle t5 = new Triangle(new Vector3(-30, -30, 30), new Vector3(-20, -20, -15), new Vector3(30, -30, 30), new Vector3(0, 1, 0));

            t5.Material = grayMaterial;
            AddObject(t5);
            Triangle t6 = new Triangle(new Vector3(30, -30, 30), new Vector3(-20, -20, -15), new Vector3(20, -20, -15), new Vector3(0, 1, 0));

            t6.Material = grayMaterial;
            AddObject(t6);

            Triangle t7 = new Triangle(new Vector3(-20, 20, -15), new Vector3(-20, -20, -15), new Vector3(20, 20, -15), new Vector3(0, 0, 1));

            t7.Material = grayMaterial;
            AddObject(t7);
            Triangle t8 = new Triangle(new Vector3(20, 20, -15), new Vector3(20, -20, -15), new Vector3(-20, -20, -15), new Vector3(0, 0, 1));

            t8.Material = grayMaterial;
            AddObject(t8);

            Triangle t9 = new Triangle(new Vector3(-30, 30, 30), new Vector3(30, 30, 30), new Vector3(-20, 20, -15), new Vector3(0, -1, 0));

            t9.Material = grayMaterial;
            AddObject(t9);
            Triangle t10 = new Triangle(new Vector3(30, 30, 30), new Vector3(-20, 20, -15), new Vector3(20, 20, -15), new Vector3(0, -1, 0));

            t10.Material = grayMaterial;
            AddObject(t10);

            Sphere sphere = new Sphere(new Vector3(-5, 10, 10), 8);

            sphere.Material = refractiveMat;
            AddObject(sphere);

            Sphere sphere1 = new Sphere(new Vector3(10, 0, 12), 5);

            sphere1.Material = orangeMaterial;
            AddObject(sphere1);

            sphere1          = new Sphere(new Vector3(-4, -6, 15), 6);
            sphere1.Material = refMat;
            AddObject(sphere1);

            Plane plane = new Plane(new Vector3(0, -5, 0), new Vector3(0, 1, 0));

            plane.Material = orangeMaterial;
            //AddObject(plane);

            Mesh mesh = new Mesh("ico.obj");
            // mesh.AddModelToScene(this, yellowMaterial);

            PointLight light = new PointLight(new Vector3(0, 17, 50), RGBColor.WHITE);

            AddLight(light);

            /*sphere = new Sphere(new Vector3(0, -10, 0), 5);
             * sphere.Material = yellowMaterial;
             * //AddObject(sphere);
             *
             * Triangle triangle = new Triangle(new Vector3(0, 0, 10), new Vector3(10, 0, 10), new Vector3(10, 10, 10), new Vector3(0, 0, 1));
             * triangle.Material = orangeMaterial;
             * //AddObject(triangle);
             *
             * Mesh mesh = new Mesh("ico.obj");
             * mesh.AddModelToScene(this, yellowMaterial);
             *
             * Plane plane = new Plane(new Vector3(0,0,-40), new Vector3(0,0,1));
             * Material.Material lamb2 = new Lambertian(RGBColor.DARK_SALMON);
             * Material.Material refMat = new Reflective(RGBColor.GREEN, 0.8, 1, 30, 0.1);
             * plane.Material = lamb2;
             * AddObject(plane);*/

            // PointLight light = new PointLight(new Vector3(-25, 0, 20), Color.White);
            // AddLight(light);

            // PointLight light1 = new PointLight(new Vector3(25, 0, 20), Color.White);
            // AddLight(light1);



            // Sphere sphere = new Sphere(new Vector3(0, 0, 0), 10);

            /* Triangle t7 = new Triangle(new Vector3(0, 0, 0), new Vector3(10, 0, 0), new Vector3(10, 10, 0), new Vector3(0, 0, 1));
             * t7.Material = grayMaterial;
             *
             *
             * Bitmap textureBitmap = new Bitmap("test.png");
             * RectangularMapping sphericalMapping = new RectangularMapping();
             * ImageTexture imageTexture = new ImageTexture(textureBitmap, sphericalMapping);
             *
             * LambertianTexture textureMaterial = new LambertianTexture(imageTexture);
             *
             *
             * t7.Material = textureMaterial;
             * AddObject(t7);
             * PointLight light = new PointLight(new Vector3(20, 0, 40), Color.White);
             * AddLight(light);*/
        }
Exemplo n.º 29
0
        public override void Update(GameTime gameTime)
        {
            cam = Game.Services.GetService(typeof(Camera.Camera)) as Camera.Camera;

            base.Update(gameTime);
        }
Exemplo n.º 30
0
        public override void InitializeContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            var tileMapTexture   = Content.Load <Texture2D>("Sprites/candy_sheet");
            var collisionTexture = Content.Load <Texture2D>("Sprites/collisions");

            _coinTexture = Content.Load <Texture2D>("Sprites/coinGold");

            _font = Content.Load <SpriteFont>("Font/Arial");

            LoadHudTextures();

            Map.TileMapData tileMapData = new Map.TileMapData()
            {
                MapHeight  = 15,
                MapWidth   = 15,
                Texture    = tileMapTexture,
                TileHeight = 70,
                TileWidth  = 70,
                TileMap    = map
            };

            for (int y = 0; y < 15; y++)
            {
                for (int x = 0; x < 15; x++)
                {
                    if (x == 0 || x == 14 || y == 0)
                    {
                        collisionMap[y, x] = 1;
                    }
                    if (map[y, x] != -1)
                    {
                        collisionMap[y, x] = 1;
                    }
                }
            }

            Map.TileMapData collisionMapData = new Map.TileMapData()
            {
                MapHeight  = 15,
                MapWidth   = 15,
                Texture    = collisionTexture,
                TileHeight = 70,
                TileWidth  = 70,
                TileMap    = collisionMap
            };



            _camera = new Camera.Camera();
            _camera.ViewportWidth  = GraphicsDevice.Viewport.Width;
            _camera.ViewportHeight = GraphicsDevice.Viewport.Height;

            _myMap = new Map.Map(_camera);
            _myMap.AddLayer(new Map.TileMap(tileMapData));
            _myMap.SetCollisionMap(new Map.CollisionMap(collisionMapData));



            _player = new Player.Player(new Vector2(500, 10));
            _player.Initialize(Content);
            Reset();
        }
Exemplo n.º 31
0
        public async Task Show()
        {
            // do cleanup =p
            foreach (var k in peds)
            {
                k.Key.Delete();
                k.Key.Model.MarkAsNoLongerNeeded();
            }
            peds.Clear();

            await CitizenFX.Core.Game.Player.SetModel(PedHash.Michael);

            await CitizenFX.Core.Game.Player.Spawn(pos, 23, false);

            Screen.Hud.IsRadarVisible = false;

            Screen.Fading.FadeIn(1);
            while (Screen.Fading.IsFadingIn)
            {
                await Delay(0);
            }

            if (Game.Data.Player.Characters.Count == 0)
            {
                await characterCreator.Start();

                Screen.Fading.FadeIn(2500);
                while (Screen.Fading.IsFadingIn)
                {
                    await BaseScript.Delay(0);
                }

                return;
            }

            _instructionalButtons.Add(new InstructionalButton(Control.Context, "Select"));
            _instructionalButtons.Add(new InstructionalButton(Control.InteractionMenu, "New Character"));

            _instructionalButtons.Add(new InstructionalButton(Control.MoveRightOnly, "Next"));
            _instructionalButtons.Add(new InstructionalButton(Control.MoveLeftOnly, "Previous"));

            UpdateScaleform();
            IsCharacterSelectionActive = true;

            cam          = new Camera.Camera();
            cam.Position = new Vector3(412.3085f, -2109.825f, 201.6868f);
            cam.Enabled  = true;

            foreach (var character in Game.Data.Player.Characters)
            {
                var model = new Model((PedHash)character.ModelHash);
                model.Request();
                while (!model.IsLoaded)
                {
                    await Delay(0);
                }
                var ped = await World.CreatePed(model, pedPos, 0);

                await ped.Apply(character);

                peds.Add(ped, character);
            }
        }
Exemplo n.º 32
0
 public Map(Camera.Camera camera)
 {
     _camera = camera;
 }
Exemplo n.º 33
0
 /// <summary>
 /// Create this new scene.
 /// </summary>
 public Scene() : base()
 {
     ActiveCamera = new Camera.Camera(Overseer.Instance.GD.Viewport);
 }
Exemplo n.º 34
0
        public override void Initialize()
        {
            heightmapKey = "HM" + levelAsset;
            texturemapKey = "TM" + levelAsset;
            modelmapKey = "MM" + levelAsset;
            scoremapKey = "SM" + levelAsset;

            // Camera
            camStartPos = new Vector3(0.0f, 40.0f, 0.0f);
            camSpeed = 50.0f;
            devCamOn = true;
            cam = new Camera.DevelopCamera(camStartPos, camSpeed, Game.GraphicsDevice);
            if (Game.Services.GetService(typeof(Camera.Camera)) == null)
                Game.Services.AddService(typeof(Camera.Camera), cam);

            //Add the level service
            if (Game.Services.GetService(typeof(States.Level)) == null) {
                Game.Services.AddService(typeof(States.Level), this);
            } else {
                Game.Services.RemoveService(typeof(States.Level));
                Game.Services.AddService(typeof(States.Level), this);
            }

            // Models
            models = new List<Models.LFModel>();

            //Set water
            waveKey = "wave";
            baseWaterKey = "water";
            baseWaterRowX = 10;
            baseWaterRowY = 10;
            amountWaves = 400;

            skyTextureKey = "sky";

            if (this.timeScore == 0) {
                throw new NotImplementedException("Initialise the timeScore variable in Level's subclass.");
            }
            this.collectablesFound = 0;

            // Water
            waterLevel = 4.5f;
            waterSizeMod = -3;

            worldMatrix = Matrix.CreateTranslation(0, 0, 0);
            //Create the terrain
            terrain = new Terrain(Game, heightmapKey, texturemapKey, this);
            Game.Components.Add(terrain);

            //Make a terrain service
            if (Game.Services.GetService(typeof(Terrain)) != null)
                Game.Services.RemoveService(typeof(Terrain));
            Game.Services.AddService(typeof(Terrain), terrain);

            score = new Score.Score(Game.Assets.Load<Texture2D>(scoremapKey), terrain);

            base.Initialize();
        }
Exemplo n.º 35
0
 private void switchCamera()
 {
     Vector3 _position = cam.CamPos;
     if (devCamOn && camSwitchDelay == 0) {
         devCamOn = false;
         Game.Services.RemoveService(typeof(Camera.Camera));
         cam = new Camera.LFCamera(_position, camSpeed, Game.GraphicsDevice);
         Game.Services.AddService(typeof(Camera.Camera), cam);
         if (!Game.Components.Contains(player)) {
             player = new LittleFlame(Game, startPosition, devCamOn, this);
             player.DevCamOn = false;
             if (Game.Services.GetService(typeof(LittleFlame)) == null) {
                 Game.Services.AddService(typeof(LittleFlame), player);
             } else {
                 Game.Services.RemoveService(typeof(LittleFlame));
                 Game.Services.AddService(typeof(LittleFlame), player);
             }
             Game.Components.Add(player);
         }
         camSwitchDelay = 1;
     } else if (camSwitchDelay == 0) {
         devCamOn = player.DevCamOn = true;
         Game.Services.RemoveService(typeof(Camera.Camera));
         cam = new Camera.DevelopCamera(_position, camSpeed, Game.GraphicsDevice);
         Game.Services.AddService(typeof(Camera.Camera), cam);
         if (Game.Components.Contains(player)) {
             Game.Components.Remove(player);
             Game.Services.RemoveService(typeof(LittleFlame));
         }
         camSwitchDelay = 1;
     }
 }
Exemplo n.º 36
0
 public void Setup()
 {
     camera = new Camera.Camera();
 }
Exemplo n.º 37
0
        public override void Update(GameTime gameTime)
        {
            cam = Game.Services.GetService(typeof(Camera.Camera)) as Camera.Camera;

            base.Update(gameTime);
        }