public Wave(KDefGame game, Crossroad spawn, UnitType unitType, int numUnits, int tileSize, float interval) { // set thisWave this.game = game; this.spawningPoint = spawn; this.unitType = unitType; this.tile = tileSize; this.unitsToCreate = numUnits; this.interval = interval; CalculateMaxOffsets (); }
public StrongUnit(KDefGame game, Crossroad spawn, float speed, int level, int goldValue, int maxHP, Vector2 offset, Vector2 movement, Texture2D textureLiving, Texture2D textureDead) : base(game, spawn, speed, level, goldValue, maxHP, offset, movement, textureLiving, textureDead) { this.defaultSpeed *= speedModifier; this.currentSpeed *= speedModifier; this.maxHealth = (int) (maxHealth * healthModifier); this.currentHealth = (int) (maxHealth * currentHealth); this.tint = Color.CornflowerBlue; this.physicalResistModifier = 0.7f; this.magicalResistModifier = 1.5f; }
public Unit(KDefGame game, Crossroad spawn, float speed, int level, int goldValue, int maxHP, Vector2 offset, Vector2 movement, Texture2D textureLiving, Texture2D textureDead) { this.game = game; this.defaultSpeed = speed; this.currentSpeed = speed; this.level = level; this.goldValue = goldValue; this.maxHealth = maxHP; this.currentHealth = maxHP; this.textureLiving = textureLiving; this.textureDead = textureDead; this.tint = Color.White; this.destination = spawn; this.position = spawn.Position + offset; this.offset = offset; this.movement = movement; this.scale = 0.2f; }
public World(KDefGame game) { this.game = game; this.sbAlpha = game.SpriteBatch; this.sbAdditive = game.SpriteBatchAdditive; this.waves = new List<Wave>(); this.spawnTimer = spawnInterval; this.unitTypes = new UnitType[] { KLinuxDefense.UnitType.STRONG_UNIT, }; LoadTextures(); SetupMap(); }
static void Main() { game = new KDefGame (); game.Run (); }
public UI(KDefGame game) { this.game = game; this.spriteBatch = game.SpriteBatch; LoadTextures (); SetupPanels (); // Initialize the screen settings this.screen = new Rectangle (0, 0, game.Window.ClientBounds.Width, game.Window.ClientBounds.Height); this.camera = new Camera2D (game.GraphicsDevice, game.World.Map); // Initialize the minimap by the screen and map settings //mmSide = (int)(game.Window.ClientBounds.Width*mmProportion); int mmSide = 200; this.minimap = new Rectangle (bPanelSelect.Right - mmSide, bPanelSelect.Bottom - mmSide, mmSide, mmSide); this.mmOriginal = minimap; this.mapArea = new Rectangle (0, 0, game.Window.ClientBounds.Width, game.Window.ClientBounds.Height - bPanel.Height); this.mmRatio = new Vector2 ((float)minimap.Width / game.World.Map.Width, (float)minimap.Height / game.World.Map.Height); // Number of tiles in the x,y directions to fill a screen this.tilesX = (int)(game.World.Map.Width / game.World.Tile); this.tilesY = (int)(game.World.Map.Height / game.World.Tile); SetupMenu (); SetupButtons (); }