public Unit(KDefenseTower game, Crossroad spawn, Vector2 offset, Vector2 movement, float speed, int tier, Texture2D textureLiving, Texture2D textureDead, int value, int maxHP) { destination = spawn; // sets the unit's first destination position = spawn.Position + offset; // set the unit's first position scale = 0.2f; this.game = game; this.offset = offset; this.movement = movement; this.speed = speed; dSpeed = speed; this.tier = tier; this.textureLiving = textureLiving; this.textureDead = textureDead; this.value = value; currentTexture = textureLiving; tint = Color.White; health = maxHP; maxHealth = maxHP; armor = 0; }
/// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { using (KDefenseTower game = new KDefenseTower()) { game.Run(); } }
public FastUnit(KDefenseTower game, Crossroad spawn, Vector2 offset, Vector2 movement, float speed, int tier, Texture2D textureLiving, Texture2D textureDead, int value, int maxHP) : base(game, spawn, offset, movement, speed, tier, textureLiving, textureDead, value, maxHP) { tint = Color.Yellow; dSpeed *= 1.5f; this.speed = dSpeed; this.value = value; }
public RegenUnit(KDefenseTower game, Crossroad spawn, Vector2 offset, Vector2 movement, float speed, int tier, Texture2D textureLiving, Texture2D textureDead, int value, int maxHP) : base(game, spawn, offset, movement, speed, tier, textureLiving, textureDead, value, maxHP) { tint = Color.Green; regenAmount = (int)(maxHealth * 0.1f); this.speed = dSpeed; this.value = value; }
protected float shieldTimer = 0; // shield timer #endregion Fields #region Constructors public StrongUnit(KDefenseTower game, Crossroad spawn, Vector2 offset, Vector2 movement, float speed, int tier, Texture2D textureLiving, Texture2D textureDead, int value, int maxHP) : base(game, spawn, offset, movement, speed, tier, textureLiving, textureDead, value, maxHP) { tint = Color.CornflowerBlue; DSpeed *= 0.7f; this.speed = DSpeed; this.value = value; maxHealth *= 2; health = maxHealth; }
int unitType; // type of unit to create #endregion Fields #region Constructors public Wave(KDefenseTower game, int unitType, Crossroad spawn, int numUnits, int tileSize, float interval) { thisWave = game.status.Wave; spawningPoint = spawn; this.game = game; this.tile = tileSize; this.unitType = unitType; toCreate = numUnits; this.interval = interval; CalculateMaxOffsets(); }
// Constructor public World(KDefenseTower game) { this.game = game; sbAlpha = game.spriteBatch; sbAdditive = game.spriteBatchAdditive; waves = new List<Wave>(); spawnTimer = spawnInterval; LoadTextures(); SetupMap(); }
public Camera2D(KDefenseTower game, Rectangle bounds) { gDevice = game.GraphicsDevice; this.bounds = bounds; position = new Vector2(1000, 1000); screenCenter = new Vector2(gDevice.Viewport.Width / 2, gDevice.Viewport.Height / 2); // calculate the largest zoom value that would fit one side of the map within the viewport minZoom = MathHelper.Max((float)gDevice.Viewport.Width / bounds.Width, (float)gDevice.Viewport.Height / bounds.Height); UpdateCamera(); }
public AggressiveUnit(KDefenseTower game, Crossroad spawn, Vector2 offset, Vector2 movement, float speed, int tier, Texture2D textureLiving, Texture2D textureDead, int value, int maxHP, World world,int damage, int range, float attackRate) : base(game, spawn, offset, movement, speed, tier, textureLiving, textureDead, value, maxHP) { this.tint = Color.Yellow; this.dSpeed *= 1.5f; this.speed = dSpeed; this.value = 2; this.world = world; this.damage = damage; this.range = range; this.attackRate = attackRate; this.attackTimer = 0.0f; }
public FlyingUnit(KDefenseTower game, Crossroad spawn, Vector2 offset, Vector2 movement, float speed, int tier, Texture2D textureLiving, Texture2D textureDead, int value, int maxHP, World world) : base(game, spawn, offset, movement, speed, tier, textureLiving, textureDead, value, maxHP) { tint = Color.Yellow; dSpeed *= 1.5f; this.speed = dSpeed; this.value = 2; destination = world.Base.Crossroad; movement = new Vector2(0, 0); Vector2 toMove; float divisor; toMove = destination.Position - position; divisor = Math.Max(Math.Abs(toMove.X), Math.Abs(toMove.Y)); movement = (toMove / divisor); // adjust movement vector tier = destination.tier; // set the unit's tier to its destination's tier }
// Constructor public UI(KDefenseTower game) { int mmSide; this.game = game; spriteBatch = game.spriteBatch; LoadTextures(); SetupPanels(); // Initialize the screen settings screen = new Rectangle(0, 0, game.Window.ClientBounds.Width, game.Window.ClientBounds.Height); camera = new Camera2D(game, game.world.map); // Initialize the minimap by the screen and map settings //mmSide = (int)(game.Window.ClientBounds.Width*mmProportion); mmSide = 200; minimap = new Rectangle(bPanelSelect.Right-mmSide, bPanelSelect.Bottom-mmSide, mmSide,mmSide); mmOriginal = minimap; mapArea = new Rectangle(0, 0, game.Window.ClientBounds.Width, game.Window.ClientBounds.Height - bPanel.Height); 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 tilesX = (int)(game.world.map.Width / game.world.tile); tilesY = (int)(game.world.map.Height / game.world.tile); SetupMenu(); SetupButtons(); }
public Audio(KDefenseTower game) : base(game) { this.game = game; }