Ejemplo n.º 1
0
        int round; //Round counter

        #endregion Fields

        #region Constructors

        // Constructor.
        public EnemyController(LabGame game)
        {
            this.game = game;
            this.round = 0;
            this.RNGesus = new Random();
            this.type = GameObjectType.None;
        }
Ejemplo n.º 2
0
        public Sphere(Model sphere,LabGame game)
        {
            this.game = game;
            model = sphere;
            basicEffect = new BasicEffect(game.GraphicsDevice)
            {
                View = game.camera.View,
                Projection = game.camera.Projection,
                World = Matrix.Identity,
                //Texture = myModel.Texture,
                TextureEnabled = true,
                VertexColorEnabled = false
            };
            BasicEffect.EnableDefaultLighting(model,true);
            const float MaxModelSize = 10.0f;
            //var scaling = MaxModelSize / modelBounds.Radius;
            //var scaling = MaxModelSize / model.Meshes[0].BoundingSphere.Radius;
            modelBounds = model.CalculateBounds();
            view = Matrix.LookAtRH(new Vector3(0, 0, MaxModelSize * 2.5f), new Vector3(0, 0, 0), Vector3.UnitY);
            projection = Matrix.PerspectiveFovRH(0.9f, (float)game.GraphicsDevice.BackBuffer.Width / game.GraphicsDevice.BackBuffer.Height, 0.1f, MaxModelSize * 10.0f);
            world = Matrix.Translation(-modelBounds.Center.X, -modelBounds.Center.Y, -modelBounds.Center.Z)*Matrix.Scaling(1);
            basicEffect.View = game.camera.View;
            basicEffect.Projection = game.camera.Projection;
            //modelBounds = model.CalculateBounds();
            //pos = model.BoundingSphere.Center;
              //  pos = new Vector3(-model.BoundingSphere.Center.X,-model.BoundingSphere.Center.Y,-model.BoundingSphere.Center.Z);
            pos = new Vector3(0, 0, 0);
            //basicEffect.World = Matrix.Translation(pos);// * Matrix.Scaling(1f);
            //effect = game.Content.Load<Effect>("Phong");

            radius = model.Meshes[0].BoundingSphere.Radius;
            frictionConstant = 0.4f;
        }
Ejemplo n.º 3
0
        public Matrix View; //Camera view

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Ensures that all objects are being rendered from a consistent viewpoint
        /// </summary>
        /// <param name="game"></param>
        public Camera(LabGame game)
        {
            pos = new Vector3(0, 0, -10);
            View = Matrix.LookAtLH(pos, new Vector3(0, 0, 0), Vector3.UnitY);
            Projection = Matrix.PerspectiveFovLH((float)Math.PI / 4.0f, (float)game.GraphicsDevice.BackBuffer.Width / game.GraphicsDevice.BackBuffer.Height, 0.01f, 1000.0f);
            this.game = game;
        }
Ejemplo n.º 4
0
        public Enemy(LabGame game, Vector3 pos)
        {
            this.game = game;
            type = GameObjectType.Enemy;

            model = game.assets.GetModel("ship", CreateEnemyModel);
            collisionRadius = size/2;

            BoundingSphere modelBounds = model.CalculateBounds();
            scaling = size / modelBounds.Radius;
            originalWorld = Matrix.Translation(-modelBounds.Center.X, -modelBounds.Center.Y, -modelBounds.Center.Z) * Matrix.Scaling(scaling);

            this.pos = pos;
            //setFireTimer();
            //GetParamsFromModel();

            basicEffect = new BasicEffect(game.GraphicsDevice)
            {
                View = game.camera.View,
                Projection = game.camera.Projection,
                //World = Matrix.Identity
                World = originalWorld

            };
        }
Ejemplo n.º 5
0
        public Player(LabGame game, Vector3 pos, PlayerNumber pnum)
            : base(game)
        {
            this.game = game;
            type      = GameObjectType.Player;

            model = game.Content.Load <Model>("paddle");

            this.pos  = pos;
            this.pnum = pnum;
            holding   = false;
            velocity  = new Vector3(0, 0, 0);
            radius    = 1;

            if (pnum == PlayerNumber.P1)
            {
                boundaryLeft  = game.boundaryLeft;
                boundaryRight = 0;
            }
            else
            {
                boundaryRight = game.boundaryRight;
                boundaryLeft  = 0;
                idlePos       = pos - new Vector3(2, 0, 0);
            }

            //Value of mass is arbitrary, need to do some tuning to make it realistic.
            mass = 5;
        }
Ejemplo n.º 6
0
 public MyModel(LabGame game, VertexPositionColor[] shapeArray, String textureName, float collisionRadius)
 {
     this.vertices = Buffer.Vertex.New(game.GraphicsDevice, shapeArray);
     this.inputLayout = VertexInputLayout.New<VertexPositionColor>(0);
     vertexStride = Utilities.SizeOf<VertexPositionColor>();
     modelType = ModelType.Colored;
     this.collisionRadius = collisionRadius;
 }
Ejemplo n.º 7
0
 public Land(LabGame game, int degree)
 {
     this.game = game;
     this.pos = new Vector3(0, 0, 0);        //The world is centred at 0,0,0
     type = GameObjectType.Terrain;          //Terrain is terrain
     myModel = game.assets.CreateWorldBase(degree);  //Generate a terrain model
     GetParamsFromModel();
 }
Ejemplo n.º 8
0
 public MainPage()
 {
     InitializeComponent();
     game = new LabGame(this);
     game.Run(this);
     mainMenu = new MainMenu(this);
     this.Children.Add(mainMenu);
 }
 public CompleteScreen(MainPage parent,LabGame game,Double gameTimeSeconds)
 {
     this.InitializeComponent();
     this.game = game;
     this.parent = parent;
     timeUsedTextBlock.Text = timeUsedTextBlock.Text + " " + ((int)(gameTimeSeconds/60))+
         "m "+((int)(gameTimeSeconds%60))+"s";
 }
Ejemplo n.º 10
0
 public Player(LabGame game)
 {
     this.game = game;
     type = GameObjectType.Player;
     myModel = game.assets.GetModel("player", CreatePlayerModel);
     pos = new SharpDX.Vector3(0, game.boundaryBottom + 0.5f, 0);
     GetParamsFromModel();
 }
Ejemplo n.º 11
0
 public Enemy(LabGame game, Vector3 pos)
 {
     this.game = game;
     type = GameObjectType.Enemy;
     myModel = game.assets.GetModel("ship", CreateEnemyModel);
     this.pos = pos;
     setFireTimer();
     GetParamsFromModel();
 }
Ejemplo n.º 12
0
 // Ensures that all objects are being rendered from a consistent viewpoint
 public Camera(LabGame game)
 {
     pos          = new Vector3(0, 0, 30);
     cameraTarget = new Vector3(0, 0, 0);
     View         = Matrix.LookAtRH(pos, cameraTarget, Vector3.UnitY);
     Projection   = Matrix.PerspectiveFovRH((float)Math.PI / 4.0f, (float)game.GraphicsDevice.BackBuffer.Width / game.GraphicsDevice.BackBuffer.Height, 0.01f, 1000.0f);
     this.game    = game;
     cameraTilt   = 5;
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Create a new ocean.
 /// </summary>
 /// <param name="game"></param>
 /// <param name="degree"></param>
 public Ocean(LabGame game, int degree)
 {
     this.game = game;
     this.pos = new Vector3(0, 0, 0);
     type = GameObjectType.Ocean;
     this.sealevel = 1;
     myModel = game.assets.CreateOcean(degree,this.sealevel);
     GetParamsFromModel();
 }
Ejemplo n.º 14
0
 public InGameUI(MainPage parent,LabGame game)
 {
     InitializeComponent();
     this.parent = parent;
     this.game = game;
     seedTextBox.Text = ""+game.mazeSeed;
     sldDimension.Value = game.mazeDimension;
     sldGravityFactor.Value = game.gravityFactor;
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Create a new model.
 /// </summary>
 /// <param name="game"></param>
 /// <param name="shapeArray"></param>
 /// <param name="textureName"></param>
 /// <param name="collisionRadius"></param>
 /// 
 //Create a textured model with normals
 public MyModel(LabGame game, VertexPositionNormalTexture[] shapeArray, String textureName, float collisionRadius)
 {
     this.vertices = Buffer.Vertex.New(game.GraphicsDevice, shapeArray);
     this.inputLayout = VertexInputLayout.New<VertexPositionNormalTexture>(0);
     vertexStride = Utilities.SizeOf<VertexPositionNormalTexture>();
     modelType = ModelType.Textured;
     Texture = game.Content.Load<Texture2D>(textureName);
     this.collisionRadius = collisionRadius;
     wasLoaded = false;
 }
Ejemplo n.º 16
0
 public MainPage()
 {
     InitializeComponent();
     game = new LabGame(this);
     game.Run(this);
     mainMenu = new MainMenu(this);
     options  = new Options(this);
     pause    = new PauseMenu(this);
     this.Children.Add(mainMenu);
 }
Ejemplo n.º 17
0
 // Ensures that all objects are being rendered from a consistent viewpoint
 public Camera(LabGame game)
 {
     pos_relative_to_player = new Vector3(0, 15, -10);
     //pos = new Vector3(game.mazeLandscape.maze.startPoint.x, 0, game.mazeLandscape.maze.startPoint.y) + pos_relative_to_player;
        // pos = new Vector3(5000,5000,12000);
     //View = Matrix.LookAtLH(pos, new Vector3(0, 0, 0), Vector3.UnitY);
     //View = Matrix.LookAtLH(pos, new Vector3(5000, 5000, 0), Vector3.UnitY);
     Projection = Matrix.PerspectiveFovLH((float)Math.PI / 4.0f, (float)game.GraphicsDevice.BackBuffer.Width / game.GraphicsDevice.BackBuffer.Height, 0.01f, 15000.0f);
     this.game = game;
 }
Ejemplo n.º 18
0
        public Arena(LabGame game)
            : base(game)
        {
            this.game = game;
            type      = GameObjectType.Arena;
            pos       = new SharpDX.Vector3(0, 0, 0);
            radius    = 0;

            model = game.Content.Load <Model>("arena");
        }
Ejemplo n.º 19
0
 // Constructor.
 public Projectile(LabGame game, MyModel myModel, Vector3 pos, Vector3 vel, GameObjectType targetType)
 {
     this.game = game;
     this.myModel = myModel;
     this.pos = pos;
     this.vel = vel;
     this.targetType = targetType;
     squareHitRadius = hitRadius * hitRadius;
     GetParamsFromModel();
 }
Ejemplo n.º 20
0
 public Player(LabGame game)
 {
     this.game = game;
     type = GameObjectType.Player;
     myModel = game.assets.GetModel("player", CreatePlayerModel);
     radius = 0.5f;
     frictionConstant = 0.4f;
     pos = new SharpDX.Vector3(0, 0, 0);
     GetParamsFromModel();
     effect = game.Content.Load<Effect>("Phong");
 }
Ejemplo n.º 21
0
        public Puck(LabGame game)
            : base(game)
        {
            this.game = game;
            type      = GameObjectType.Puck;
            model     = game.Content.Load <Model>("puck");
            pos       = new SharpDX.Vector3(0, 0, 0);

            mass   = 1;
            radius = 1;
        }
Ejemplo n.º 22
0
 // Ensures that all objects are being rendered from a consistent viewpoint
 public Camera(LabGame game)
 {
     //pos = new Vector3(0, 0, -10);
     angleX = 0;
     angleY = 0;
     pos = originalPos;
     target = originalTarget;
     up = originalUp;
     View = Matrix.LookAtLH(pos, target, up);
     Projection = Matrix.PerspectiveFovLH((float)Math.PI / 4.0f, (float)game.GraphicsDevice.BackBuffer.Width / game.GraphicsDevice.BackBuffer.Height, 0.01f, 1000.0f);
     //Projection = Matrix.PerspectiveFovRH(0.9f, (float)game.GraphicsDevice.BackBuffer.Width / game.GraphicsDevice.BackBuffer.Height, 0.1f, MaxModelSize * 10.0f);
     this.game = game;
 }
Ejemplo n.º 23
0
        private Vector3 vel; //Local class velocity for projectile only behaviours

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Create a new projectile.
        /// </summary>
        /// <param name="game"></param>
        /// <param name="myModel"></param>
        /// <param name="pos"></param>
        /// <param name="vel"></param>
        /// <param name="targetType"></param>
        public Projectile(LabGame game, MyModel myModel, Vector3 pos, Vector3 vel, PhysicalObject shooter)
        {
            this.game = game;
            this.myModel = myModel;
            this.pos = pos;
            this.vel = vel;
            this.shooter = shooter;
            this.locallight.lightPos = new Vector4(this.pos.X, this.pos.Y, this.pos.Z - 2, 1f);
            this.locallight.lightCol = new Vector4(0.15f, 0.15f, 0.15f, 1f);
            squareHitRadius = hitRadius * hitRadius;
            GetParamsFromModel();
            initPos = pos;
        }
Ejemplo n.º 24
0
        public Crosshair(LabGame game)
        {
            this.game = game;
            type = GameObjectType.None; //change later
            int screen_width =  2160;
            int screen_height = 1440;

            texture = game.Content.Load<Texture2D>("crosshair.png");

            int texture_width = texture.Width;
            int texture_height = texture.Height;

            pos = new Vector3((screen_width - texture_width) / 2, (screen_height - texture_height) / 2, 0);
        }
Ejemplo n.º 25
0
 public Player(LabGame game)
 {
     this.game = game;
     type = GameObjectType.Player;
     myModel = game.assets.GetModel("boat.png", CreatePlayerModel);
     pos = new SharpDX.Vector3(0, 0, -1);
     this.locallight.lightCol = new Vector4(0f,0.15f,0.5f,1f);
     this.locallight.lightPos = new Vector4(this.pos.X, this.pos.Y,this.pos.Z-2,1f);
     game.addLight(this.locallight);
     velocity = new Vector3(0, 0, 0);
     acceleration = new Vector3(0, 0, 0);
     hitpoints = (int)(100 / game.difficulty);
     armour = 1;
     maxspeed = 0.5f;
     maxaccel = 1.4f;
     GetParamsFromModel();
 }
Ejemplo n.º 26
0
        public Light(LabGame game)
        {
            this.game = game;

            pointPos    = game.camera.pos;
            pointPos.Y -= 15;
            pointColor  = new Vector4(0.1f, 0.1f, 0.1f, 1.0f);
            // ambient
            ambientColor     = new Vector4(1.0f, 1.0f, 1.0f, 1.0f);
            ambientIntensity = 0.5f;
            // diffuse
            diffuseDirection = new Vector3(0.0f, 0.0f, -15.0f);
            diffuseColor     = new Vector4(1.0f, 1.0f, 1.0f, 1.0f);
            diffuseIntensity = 1.0f;
            // specular
            specularColor     = new Vector4(1.0f, 1.0f, 1.0f, 1.0f);
            specularIntensity = 1.0f;
        }
Ejemplo n.º 27
0
        public MazeLandscape(LabGame game,int dimension,int seed )
        {
            this.seed = seed;
            this.dimension = dimension;
            this.game = game;
            maze = new RandomMaze(dimension, seed);
            cube = new Cube();
            maze.GenerateMaze();
            maze.setStartPointAndDestPoint();

            while (maze.destPoint == null)
            {
                game.mazeSeed=game.random.Next();
                this.seed = game.mazeSeed;
                maze = new RandomMaze(dimension, this.seed);
                //cube = new Cube();
                maze.GenerateMaze();
                maze.setStartPointAndDestPoint();
            }

            //display path.

            /*
                            List<Node> pathFromSrcToDest = maze.astar.FindPath(maze.astar.Float2DtoInt(maze.maze)
                , RandomMaze.WALL, maze.startPoint.x, maze.startPoint.y, maze.destPoint.x, maze.destPoint.y);
            */
            //maze.updateMazeRoad(pathFromSrcToDest, Project.Cube.goal);

            type = GameObjectType.MazeLandscape;
            //if maze existed before just remove it from model
            game.assets.modelDict.Remove(mazeModelName);
            myModel = game.assets.GetModel(mazeModelName, CreateMazeLandscapeModel);
            //radius = 0.5f;
            //frictionConstant = 0.4f;
            pos = new SharpDX.Vector3(0, 0, 0);
            GetParamsFromModel();
            effect = game.Content.Load<Effect>("Phong");
            Debug.WriteLine("maze created");
            entranceX = maze.startPoint.x * CUBESCALE * 2;
            entranceZ = maze.startPoint.y * CUBESCALE * 2;
            normalMaze = myModel.shapeArray;
        }
Ejemplo n.º 28
0
        //Create a new controller
        public LightingController(LabGame game)
        {
            lights = new List<LightSource>();
            ambientCol = new Vector4(0.2f, 0.2f, 0.2f, 1f);

            //Initialise all lights to the "off" state, ie giving off no light.
            l1.lightPos = new Vector4(0f, 0f, 0f, 1f);
            l1.lightCol = new Vector4(0f, 0f, 0f, 1f);
            l2.lightPos = new Vector4(0f, 0f, 0f, 1f);
            l2.lightCol = new Vector4(0f, 0f, 0f, 1f);
            l3.lightPos = new Vector4(0f, 0f, 0f, 1f);
            l3.lightCol = new Vector4(0f, 0f, 0f, 1f);
            l4.lightPos = new Vector4(0f, 0f, 0f, 1f);
            l4.lightCol = new Vector4(0f, 0f, 0f, 1f);
            l5.lightPos = new Vector4(0f, 0f, 0f, 1f);
            l5.lightCol = new Vector4(0f, 0f, 0f, 1f);
            l6.lightPos = new Vector4(0f, 0f, 0f, 1f);
            l6.lightCol = new Vector4(0f, 0f, 0f, 1f);
            l7.lightPos = new Vector4(0f, 0f, 0f, 1f);
            l7.lightCol = new Vector4(0f, 0f, 0f, 1f);
            l8.lightPos = new Vector4(0f, 0f, 0f, 1f);
            l8.lightCol = new Vector4(0f, 0f, 0f, 1f);
            l9.lightPos = new Vector4(0f, 0f, 0f, 1f);
            l9.lightCol = new Vector4(0f, 0f, 0f, 1f);
            l10.lightPos = new Vector4(0f, 0f, 0f, 1f);
            l10.lightCol = new Vector4(0f, 0f, 0f, 1f);
            l11.lightPos = new Vector4(0f, 0f, 0f, 1f);
            l11.lightCol = new Vector4(0f, 0f, 0f, 1f);
            l12.lightPos = new Vector4(0f, 0f, 0f, 1f);
            l12.lightCol = new Vector4(0f, 0f, 0f, 1f);
            l13.lightPos = new Vector4(0f, 0f, 0f, 1f);
            l13.lightCol = new Vector4(0f, 0f, 0f, 1f);
            l14.lightPos = new Vector4(0f, 0f, 0f, 1f);
            l14.lightCol = new Vector4(0f, 0f, 0f, 1f);
            l15.lightPos = new Vector4(0f, 0f, 0f, 1f);
            l15.lightCol = new Vector4(0f, 0f, 0f, 1f);

            //Ambient light colour is constant
            ambientCol = new Vector4(0.5f, 0.5f, 0.5f, 1.0f);

            this.game = game;
        }
Ejemplo n.º 29
0
        public Sphere(Model sphere,LabGame game)
        {
            this.game = game;
            model = sphere;
            basicEffect = new BasicEffect(game.GraphicsDevice)
            {
                View = game.camera.View,

                //View = Matrix.LookAtRH(game.camera.pos, game.camera.pos+game.camera.pos_relative_to_player, Vector3.UnitY),
                Projection = game.camera.Projection,
                //Projection = Matrix.PerspectiveFovRH((float)Math.PI / 4.0f, (float)game.GraphicsDevice.BackBuffer.Width / game.GraphicsDevice.BackBuffer.Height, 0.01f, 15000.0f),
                World = Matrix.Identity,
                //Texture = myModel.Texture,
                TextureEnabled = true,
                VertexColorEnabled = false
            };
            BasicEffect.EnableDefaultLighting(model,true);
            //const float MaxModelSize = 10.0f;
            //var scaling = MaxModelSize / modelBounds.Radius;
            //var scaling = MaxModelSize / model.Meshes[0].BoundingSphere.Radius;
            //modelBounds = model.CalculateBounds();
            //view = Matrix.LookAtRH(new Vector3(0, 0, MaxModelSize * 2.5f), new Vector3(0, 0, 0), Vector3.UnitY);
            //projection = Matrix.PerspectiveFovRH(0.9f, (float)game.GraphicsDevice.BackBuffer.Width / game.GraphicsDevice.BackBuffer.Height, 0.1f, MaxModelSize * 10.0f);
            //world = Matrix.Translation(-modelBounds.Center.X, -modelBounds.Center.Y, -modelBounds.Center.Z) * Matrix.Scaling(0.5f);
            //basicEffect.View = game.camera.View;
            //basicEffect.Projection = game.camera.Projection;
            //modelBounds = model.CalculateBounds();
            //pos = model.BoundingSphere.Center;
              //  pos = new Vector3(-model.BoundingSphere.Center.X,-model.BoundingSphere.Center.Y,-model.BoundingSphere.Center.Z);
            //pos = new Vector3(game.mazeLandscape.maze.startPoint.x, 3, game.mazeLandscape.maze.startPoint.y);
            pos = new Vector3(game.mazeLandscape.entranceX, 0, game.mazeLandscape.entranceZ);
            radius = model.CalculateBounds().Radius * scallingFactor + 0.6f;
            basicEffect.World = Matrix.Translation(new Vector3(model.CalculateBounds().Center.X,
                model.CalculateBounds().Center.Y, model.CalculateBounds().Center.Z)) * Matrix.Translation(pos);// * Matrix.Scaling(1f);
            effect = game.Content.Load<Effect>("modelShader");
            texture = game.Content.Load<Texture2D>("wood");

            //radius = model.Meshes[0].BoundingSphere.Radius * scallingFactor;

            frictionConstant = 0.03f;
        }
Ejemplo n.º 30
0
        Vector3 searchloc; //Location that an enemy will approach to search for a player

        #endregion Fields

        #region Constructors

        public Enemy(LabGame game, EnemyController controller, EnemyType etype, Vector3 pos)
            : base()
        {
            this.game = game;
            type = GameObjectType.Enemy;
            myModel = game.assets.GetModel("player", CreateEnemyModel);
            this.pos = pos;
            this.maxspeed = 0.15f;
            this.range = 4;
            this.detected = false;
            this.controller = controller;
            this.detectrange = 3.5f;
            this.escaperange = detectrange * 2;
            this.etype = etype;
            searchloc = controller.newSearch(this, pos);
            this.locallight.lightCol = new Vector4(0.15f, 0f, 0f, 1f);
            this.locallight.lightPos = new Vector4(this.pos.X, this.pos.Y, this.pos.Z - 2, 1f);
            GetParamsFromModel();
            fireTimer = 0;
            fireDistance = 4;
        }
Ejemplo n.º 31
0
        // Constructor.
        public Projectile(LabGame game, Model model, Vector3 pos, Vector3 vel, GameObjectType targetType)
        {
            this.game = game;
            this.model = model;
            this.pos = pos;
            this.vel = vel;
            this.type = GameObjectType.Projectile;
            this.targetType = targetType;
            squareHitRadius = hitRadius * hitRadius;

            BoundingSphere modelBounds = model.CalculateBounds();
            scaling = size / modelBounds.Radius;
            originalWorld = Matrix.Translation(-modelBounds.Center.X, -modelBounds.Center.Y, -modelBounds.Center.Z) * Matrix.Scaling(scaling);
            //GetParamsFromModel();

            basicEffect = new BasicEffect(game.GraphicsDevice)
            {
                View = game.camera.View,
                Projection = game.camera.Projection,
                //World = Matrix.Identity
                World = originalWorld
            };
        }
Ejemplo n.º 32
0
        public Player(LabGame game)
        {
            this.game = game;
            type = GameObjectType.Player;
            model = game.assets.GetModel("player", CreatePlayerModel);
            collisionRadius = 10;

            //pos = new SharpDX.Vector3(0, game.boundaryBottom + 1f, 0);
            pos = new Vector3(0, -1, 0);
            //pos = new SharpDX.Vector3(0, 10, 0);

            BoundingSphere modelBounds = model.CalculateBounds();
            scaling = size / modelBounds.Radius;
            originalWorld = Matrix.Translation(-modelBounds.Center.X, -modelBounds.Center.Y, -modelBounds.Center.Z)
                            * Matrix.Scaling(scaling);
            basicEffect = new BasicEffect(game.GraphicsDevice)
            {
                View = game.camera.View,
                Projection = game.camera.Projection,
                //World = Matrix.Identity
                World = originalWorld
            };
        }
Ejemplo n.º 33
0
        public Asteroid(LabGame game, Vector3 pos, Vector3 vel, float size)
        {
            this.game = game;
            type = GameObjectType.Enemy; // for now
            this.vel = vel;
            this.size = size;

            model = game.assets.GetModel("asteroid", createAsteroidModel);
            collisionRadius = size / 2;

            BoundingSphere modelBounds = model.CalculateBounds();
            scaling = size / modelBounds.Radius;
            originalWorld = Matrix.Translation(-modelBounds.Center.X, -modelBounds.Center.Y, -modelBounds.Center.Z) * Matrix.Scaling(scaling);
            this.pos = pos;

            basicEffect = new BasicEffect(game.GraphicsDevice)
            {
                View = game.camera.View,
                Projection = game.camera.Projection,
                //World = Matrix.Identity
                World = originalWorld

            };
        }
Ejemplo n.º 34
0
 public GameObject(LabGame game)
 {
     this.game = game;
     effect    = game.Content.Load <Effect>("myShader");
 }
 // Constructor.
 public EnemyController(LabGame game)
 {
     this.game = game;
     nextWave();
     createEnemies();
 }
Ejemplo n.º 36
0
 public Assets(LabGame game)
 {
     this.game = game;
 }
 public AsteroidController(LabGame game)
 {
     this.game = game;
     random = new Random();
     createAsteroids();
 }
Ejemplo n.º 38
0
 public Assets(LabGame game)
 {
     this.game = game;
 }