示例#1
0
        public World(Game game)
            : base(game)
        {
            groundPlane = new Ground(game);
            playerModel = new Player(game);

            world = Matrix.Identity;

            game.Components.Add(groundPlane);
            game.Components.Add(playerModel);
        }
示例#2
0
        public Enemy(Game game, Player player, Level level, GameObject body, GameObject fist, Vector3 pos)
            : base(game)
        {
            this.body = body;
            this.fist = fist;

            this.player = player;
            this.level = level;

            damage = 2;
            health = 10;

            fistX = 0;
            fistY = 0;
            fistZ = radius;

            //Attack parameters

            attackCooldown = 1f;  //Time till enemy can attack again

            isAttacking = false;
            canAttack = true;
            enemyYaw = 0;
            fistDefaultAngle = 0.5f;
            angle = fistDefaultAngle;
            speed = (2 * MathHelper.Pi) * 2;

            //Set body GameObject parameters
            setPosition(pos);
            body.setPosition(position);
            body.physobj.coltype = PhysicsObject.ColliderType.enemy;

            //Set fist GameObject parameters
            fist.setScale(0.5f);
            fistPosition = new Vector3(fistX + body.physobj.position.X, fistY + body.physobj.position.Y, fistZ + body.physobj.position.Z);
            fist.setPosition(fistPosition);
            fist.physobj.coltype = PhysicsObject.ColliderType.enemy;
            prevFistPos = fistPosition;
            fist.physobj.isStatic = true;
        }
示例#3
0
        protected override void LoadContent()
        {
            // Initialise game object containers.
            gameObjects = new List<GameObject>();
            addedGameObjects = new Stack<GameObject>();
            removedGameObjects = new Stack<GameObject>();
            ghosts = new List<Ghost>();

            // Create game objects.
            player = new Player(this, playerLives);
            base.LoadContent();
        }
        protected override void LoadContent()
        {
            // Initialise game object containers.
            gameObjects = new List<GameObject>();
            addedGameObjects = new Stack<GameObject>();
            removedGameObjects = new Stack<GameObject>();

            arial16BMFont = Content.Load<SpriteFont>("Arial16");
            spriteBatch = ToDisposeContent(new SpriteBatch(GraphicsDevice));

            // Create game objects.
            player = new Player(this);
            gameObjects.Add(player);

            gameObjects.Add(new EnemyController(this));
            gameObjects.Add(new AsteroidController(this));

            crosshair = new Crosshair(this);
            gameObjects.Add(crosshair);

            // Create an input layout from the vertices

            base.LoadContent();
        }
示例#5
0
        /// <summary>
        /// Load game content.
        /// </summary>
        protected override void LoadContent()
        {
            // Initialise game object containers.
            gameObjects = new List<GameObject>();
            addedGameObjects = new Stack<GameObject>();
            removedGameObjects = new Stack<GameObject>();

            // Create game objects.
            worldBase = new Land(this, this.size);
            gameObjects.Add(worldBase);
            ocean = new Ocean(this, this.size);
            gameObjects.Add(ocean);
            lighting = new LightingController(this);
            gameObjects.Add(lighting);
            player = new Player(this);
            gameObjects.Add(player);
            controller = new EnemyController(this);
            gameObjects.Add(controller);

            base.LoadContent();
        }
示例#6
0
        protected override void Initialize()
        {
            Window.Title = "Lab 4";
            camera = new Camera(this);
            mazeLandscape = new MazeLandscape(this,mazeDimension,mazeSeed);
            player = new Player(this);
            sphere = new Sphere(Content.Load<Model>("sphere"), this);
            camera.setStartingPosView();

            //testModel = Content.Load<Model>("woodsphere_obj");
            base.Initialize();
        }
        protected override void LoadContent()
        {
            // Create the camera
            camera = new Camera(this);
            sun = new Sun(this);
            landscape = new Landscape(this); // must init first.
            landscape.shader_option = 0;
            player = new Player(this);
            enemyController = new EnemyController(this);
            allBalls.Add(player);
            foreach(Enemy e in enemyController.enemies){ allBalls.Add(e); }

            camera.position = player.pos;
            this.score = 0;
            this.music = 100;
            this.target_score = 30;
            // Create an input layout from the vertices
            base.LoadContent();
        }
        public void createPlayer(Game game, Vector3 pos)
        {
            GameObject body = createGameObject(game, Vector3.Zero, "sphere", "player");   //Player body
            GameObject fist = createGameObject(game, Vector3.Zero, "sphere", "tex_fist");   //Player fist
            gameobjs.Add(body);
            gameobjs.Add(fist);

            //Add the body and fist of player to gameobjs
            player = new Player(game, body, fist, pos, camera);
            player.body.setPosition(pos);
            //Add to Game.Components
            components.Add(player);

            physworld.addCollisionEvent(player.body.physobj, player.fist.physobj);
        }
示例#9
0
        void SetGameObjects()
        {
            // Initialise game object containers.
            gameObjects = new List<GameObject>();
            addedGameObjects = new Stack<GameObject>();
            removedGameObjects = new Stack<GameObject>();

            lightManager = new LightManager(this);

            // Create the first platform and get the height
            Platform first_platform = new Platform(this);
            int level = first_platform.platform[2, 0];
            init_pos = new Vector3(first_platform.platfom_midpoint, first_platform.Levels[level], 0);

            //Number of platforms to render on screen at any time
            gameObjects.Add(first_platform);
            gameObjects.Add(new Platform(this));
            gameObjects.Add(new Platform(this));
            gameObjects.Add(new Platform(this));
            gameObjects.Add(new Platform(this));
            gameObjects.Add(new Platform(this));
            gameObjects.Add(new Platform(this));
            gameObjects.Add(new Platform(this));

            // Create the player
            player = new Player(this, init_pos);
            gameObjects.Add(player);

            // Create game objects.
            gameObjects.Add(new EnemyController(this));

            spriteBatch = ToDisposeContent(new SpriteBatch(GraphicsDevice));
        }
示例#10
0
        protected override void LoadContent()
        {
            // Initialise game object containers.
            gameObjects = new List<GameObject>();
            addedGameObjects = new Stack<GameObject>();
            removedGameObjects = new Stack<GameObject>();

            // Create game objects.
            player = new Player(this);
            gameObjects.Add(player);
            gameObjects.Add(new EnemyController(this));

            // Create an input layout from the vertices

            base.LoadContent();
        }