public Squares(int SquareSize, Vector2 Location, int x, int y, int defDist) { sqrLoc = Location; typeOfSquare = SqrFlags.Unoccupied; Building = BuildingType.None; TowerHere = null; rect = new Rectangle((int)Location.X, (int)Location.Y, SquareSize, SquareSize); sqrCoord = new Coordinates(x, y, defDist); PixelScreenPos = new Vector2(rect.X + rect.Width / 2, rect.Y + rect.Height / 2); }
public Projectile(Type type, Tower tower, Vector2 position, Vector2 direction, float lifetime, int damage, float speed = 10) { direction.Normalize(); m_tower = tower; Lifetime = lifetime; m_position = Position = position; m_speed = speed; m_velocity = direction * m_speed; m_damage = damage; switch (type) { case Type.Gun: TypeofProj = type; m_sprite = Art.ProjectileGun; m_center = new Vector2(m_sprite.Width / 2, m_sprite.Height / 2); Radius = m_sprite.Width / 2; break; } }
public static void TowerDamaged(float Damage, Tower tower, Projectile.Type projectile) { //Damage calcualtions should be put here. Not sure on the best way to handle this, could get very large with if's tower.Health -= (int)Damage; }
public static void RemoveTowerFromSquare(Tower tower) { GameManager.grid.gridSquares[(int)tower.towerCoords.x, (int)tower.towerCoords.y].typeOfSquare = Squares.SqrFlags.Unoccupied; GameManager.grid.gridSquares[(int)tower.towerCoords.x, (int)tower.towerCoords.y].Building = Squares.BuildingType.None; }
public static void Add(Tower tower) { TowersList.Add(tower); }
static void Shoot(Tower TargetTower, Enemy enemy, Vector2 Direction) { Quaternion aimQuat = Quaternion.CreateFromYawPitchRoll(0, 0, Rotation); Vector2 offset = Vector2.Transform(new Vector2(35, 0), aimQuat); EnemyProjectiles.Add(new Projectile(Projectile.Type.Gun, TargetTower, enemy.ScreenPos, Direction, 1f, 2)); }