public Attackable(GameplayManager gm, Vector2 position, int faction, int HP, float visionRange, World world) : base(world) {
     this.gm = gm;
     this.faction = faction;
     this.maxHP = HP;
     this.HP = HP;
     this.visionRange = visionRange;
 }
Example #2
0
        public Grid(World world, GameplayManager gm)
        {
            this.world = world;
            this.gm = gm;

            pathfinder = new Pathfinder(this);
        }
 public UnitController(Unit u, GameplayManager gm)
 {
     controlledUnit = u;
     this.gm = gm;
     u.Controller = this;
     fsm = new UnitFSM(this,gm);
     SetSteering(new StandStill(gm, u));
 }
 public static Unit SpawnUnit(GameplayManager gm, UnitTypes type, Vector2 position, int faction, World world) {
     switch (type)
     {
         case UnitTypes.Ranged:
             return CreateRangedUnit(gm, position, faction, world);
         case UnitTypes.Melee:
             return CreateMeleeUnit(gm, position, faction, world);
         default:
             return CreateRangedUnit(gm, position, faction, world);
     }
 }
Example #5
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            Texture2D pixelTex = new Texture2D(GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
            pixelTex.SetData(new[] { Color.White });
            AssetManager.AddTexture("pixel", pixelTex);
            AssetManager.AddTexture("circle_100x100", Content.Load<Texture2D>("circle_100x100"));
            AssetManager.AddTexture("softparticle", Content.Load<Texture2D>("softparticle"));

            gm = new GameplayManager(Window);
        }
Example #6
0
        public Unit(GameplayManager gm, World world, Vector2 position, int faction, int HP, float radius, float attackRange, float aggroRange, float visionRange, int attackDamage, float attackDelay, float movementSpeed, float attackSpeed, float productionTime, int cost)
            : base(gm, position, faction, HP, visionRange,cost, world)
        {
            this.attackRange = attackRange;
            this.aggroRange = aggroRange;
            this.attackDamage = attackDamage;
            this.attackDelay = attackDelay;
            this.movementSpeed = movementSpeed;
            this.attackSpeed = attackSpeed;
            this.radius = radius;
            this.productionTime = productionTime;
            this.cost = cost;

            body = BodyFactory.CreateCircle(world, ConvertUnits.ToSimUnits(radius), 10/*????*/, ConvertUnits.ToSimUnits(position));
            body.BodyType = BodyType.Dynamic;
            body.CollisionCategories = Category.All;
            body.CollidesWith = Category.All;

            //A unit must be manually enabled when spawned
            Disable();
        }
Example #7
0
        public Building(GameplayManager gm, int gridX, int gridY, int faction, World world, int tileWidth, int tileHeight, int HP, float visionRange, Grid grid)
            : base(gm, new Vector2(((float)gridX + (float)tileWidth / 2.0f) * Grid.TileSize, ((float)gridY + (float)tileHeight / 2.0f) * Grid.TileSize), faction, HP, visionRange, world)
        {
            body = BodyFactory.CreateRectangle(world, ConvertUnits.ToSimUnits(tileWidth * Grid.TileSize), ConvertUnits.ToSimUnits(tileHeight * Grid.TileSize), 10, ConvertUnits.ToSimUnits(new Vector2(((float)gridX + (float)tileWidth / 2.0f) * Grid.TileSize, ((float)gridY + (float)tileHeight / 2.0f) * Grid.TileSize)));
            body.BodyType = BodyType.Static;
            body.CollisionCategories = Category.All;
            body.CollidesWith = Category.All;

            width = tileWidth * Grid.TileSize;
            height = tileHeight * Grid.TileSize;
            this.tileHeight = tileHeight;
            this.tileWidth = tileWidth;
            this.gridX = gridX;
            this.gridY = gridY;
            this.grid = grid;

            BlockTiles();
            grid.AssignNeighbours();

            radius = Math.Max(width / 2.0f, height / 2.0f);
            bounds = new Rectangle((int)(Position.X - width / 2.0f), (int)(Position.Y - height / 2.0f), (int)width, (int)height);
        }
Example #8
0
 public Barracks(GameplayManager gm, int gridX, int gridY, int faction, World world, Grid grid)
     : base(gm, gridX, gridY, faction, world, 2, 2, 500, 150.0f, 200, grid)
 {
 }
 public UnitController(Unit u, GameplayManager gm) {
     controlledUnit = u;
     this.gm = gm;
     u.Controller = this;
     fsm = new UnitFSM(this);
 }
Example #10
0
 public Base(GameplayManager gm, int gridX, int gridY, int faction, World world, Grid grid) : base(gm,gridX,gridY,faction,world,3,3,1000,200.0f, grid) { 
 
 }
 public static Unit CreateRangedUnit(GameplayManager gm, Vector2 position,int faction, World world)
 {
     Unit u = new Unit(gm, world, position, faction, 100, 5.0f, 60.0f, 80.0f, 100.0f, 6, 0.5f, 5.0f, 0.3f, 3.0f, 50);
     return u;
 }
Example #12
0
 public Barracks(GameplayManager gm, int gridX, int gridY, int faction, World world, Grid grid)
     : base(gm, gridX, gridY, faction, world, 2, 2, 500, 150.0f, 200, grid)
 {
 }
 public ArmyController(GameplayManager gm, int faction)
 {
     this.gm      = gm;
     this.faction = faction;
 }
Example #14
0
 public PlayerController(GameplayManager gm, int faction) : base(gm, faction)
 {
 }
 public PlayerController(GameplayManager gm, int faction)
     : base(gm, faction)
 {
 }
 public ArmyController(GameplayManager gm, int faction) {
     this.gm = gm;
     this.faction = faction;
 }
 public static Unit CreateMeleeUnit(GameplayManager gm, Vector2 position, int faction, World world)
 {
     Unit u = new Unit(gm, world, position, faction, 50, 8.0f, 2.0f, 80.0f, 100.0f, 12, 0.8f, 6.0f, 0.2f, 3.0f, 100);
     return u;
 }