Ejemplo n.º 1
0
        public Unit(GraphicsDevice device, ContentManager Content, String modelName, String profilePic, Vector3 position, Vector3 WorldSize, Commander Owner)
            : base(device, Content, modelName, profilePic, position, WorldSize, false, Owner)
        {
            Swarm = new List<Unit>();
            Owner.Units.Add(this);

            ViewRange = 500;
            AttackRange = 350;
        }
Ejemplo n.º 2
0
 public SelectableModel(GraphicsDevice device, ContentManager Content, String modelName, String profilePic, Vector3 position, Vector3 WorldSize, bool Animated, Commander Owner)
     : base(device, Content, modelName, profilePic, position, WorldSize, Animated)
 {
     this.Owner = Owner;
     healthBar = new HealthBar(device, Content);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {

            spriteBatch = new SpriteBatch(GraphicsDevice);

            Random random = new Random();
            Vector3 position = new Vector3();
            
            //Main Commander (Player)
            //Enemy Commander (Computer)
            Player = new Commander();
            AI = new AICommander();
            

            // Camera Manager
            cameraManager = new CameraManager();
            Services.AddService(typeof(CameraManager), cameraManager);
            float aspectRatio = GraphicsDevice.Viewport.Width / (float)GraphicsDevice.Viewport.Height;
            // Light Manager
            lightManager = new LightManager();
            lightManager.AmbientLightColor = new Vector3(0.3f, 0.3f, 0.3f);
            Services.AddService(typeof(LightManager), lightManager);
            // Light 1
            lightManager.Add("Light1", new PointLight(new Vector3(1500, 1500, 1500), Vector3.One));
            // Camera 1 - ThirdPerson Camera
            RTSCamera camera1 = new RTSCamera(GraphicsDevice, new Vector3(0, 0, 600), Vector3.Forward);
            camera1.aspectRatio = aspectRatio;
            cameraManager.Add("Camera1", camera1);
            // Camera 2 - MoveableCamera Camera
            position = new Vector3(500, 0, 75);
            position.Y = position.Y + 30;
            MoveableCamera camera2 = new MoveableCamera(GraphicsDevice, new Vector3(0, 0, 400), 45.0f, 30.0f);
            camera2.aspectRatio = aspectRatio;
            camera2.CameraPosition = position;
            camera2.CameraTarget = camera2.CameraPosition + new Vector3(-3.0f, 0.0f, -1.0f);
            cameraManager.Add("Camera2", camera2);
            // Terrain
            terrain = new Terrain(this);
            terrain.Load(Content, @"Terrains\heightmap1", 12.0f, 1f);
            // Terrain material
            TerrainMaterial material = new TerrainMaterial();
            material.DiffuseTexture1 = LoadTextureMaterial(@"grass", new Vector2(100, 100));
            material.LightMaterial = new LightMaterial(new Vector3(0.8f), new Vector3(0.3f), 32);
            terrain.Material = material;
            worldModel = new WorldModel((int)terrain.EndPosition.X, (int)terrain.EndPosition.Y, (int)terrain.EndPosition.Y);

            //add Player
            Marine marine;
            for (int x = 0; x < 10; x++)
            {
                position = new Vector3(worldModel.MaxX / 2 + 20 * x, 0, worldModel.MaxY / 2);
                position.Y = terrain.GetHeight(position.X, position.Z);
                marine = new Marine(GraphicsDevice, Content, @"Models\Dude", @"Images\dude1", position, new Vector3(worldModel.MaxX, worldModel.MaxY, worldModel.MaxZ), Player) { Scale = 0.3f, Name = "Ranger" + x, ViewRange = 100, AttackRange = 50, AttackDamage = 10, AttackCooldown = 2, CurrentHealth = 100 };
                worldModel.Models.Add(marine);
            }

            //add AI
            position = new Vector3(worldModel.MaxX / 2, 0, worldModel.MaxY / 2+100);
            position.Y = terrain.GetHeight(position.X, position.Z);
            marine = new Marine(GraphicsDevice, Content, @"Models\Dude", @"Images\dude2", position, new Vector3(worldModel.MaxX, worldModel.MaxY, worldModel.MaxZ), AI) { Scale = 0.3f, Name = "dude20", ViewRange = 100, AttackRange = 50, AttackDamage = 10, AttackCooldown = 2, CurrentHealth = 100 };
            worldModel.Models.Add(marine);

            //add rocks
            GameModel gameModel;
            for (int x = 0; x < 100; x++)
            {
                position = new Vector3(random.Next(worldModel.MaxX), 0, random.Next(worldModel.MaxY));
                position.Y = terrain.GetHeight(position.X, position.Z);
                gameModel = new Marine(GraphicsDevice, Content, @"Models\MainTree", @"Images\dude1", position, new Vector3(worldModel.MaxX, worldModel.MaxY, worldModel.MaxZ), Player) { Scale = random.Next(10)*0.03f, Name = "dude" + x, ViewRange = 100, AttackRange = 50, AttackDamage = 10, AttackCooldown = 2, CurrentHealth = 100 };
                worldModel.Models.Add(gameModel);
            }
            //add trees

            cameraManager.ActiveCamera.modelPosition = worldModel.Models[0].Position;
            worldModel.SpacialIndex.updateGrid();

            //Other Methods

            //Top most menu system
            topMenu = new TopMenu(Content, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);
            botMenu = new BotMenu(graphics.GraphicsDevice, Content, new Rectangle(0,0,graphics.PreferredBackBufferWidth,graphics.PreferredBackBufferHeight));

            Player.LoadDefaults();
            AI.LoadDefaults();
            //List<Unit> res=worldModel.SpacialIndex.getNearbyUnits(Player.Units[1]);
        }
Ejemplo n.º 4
0
        public Structure(GraphicsDevice device, ContentManager Content, String modelName, String profilePic, Vector3 position, Vector3 WorldSize, Commander Player)
            : base(device, Content, modelName, profilePic, position, WorldSize, false, Player)
        {

        }
Ejemplo n.º 5
0
 public Marine(GraphicsDevice device, ContentManager Content, String modelName, String profilePic, Vector3 position, Vector3 WorldSize, Commander Owner)
     : base(device, Content, modelName, profilePic, position, WorldSize, Owner)
 {
 }