public override void Update(double deltaTime) { position.X = offset.X * (float)Math.Cos(MiscUtils.DegToRad(angle)) + inputPosition.X; position.Y = offset.X * (float)Math.Sin(MiscUtils.DegToRad(angle)) + inputPosition.Y; var rectPos = new Vector2f(); rectPos.X = offset.Y * (float)Math.Sin(MiscUtils.DegToRad(-angle)) + position.X; rectPos.Y = offset.Y * (float)Math.Cos(MiscUtils.DegToRad(-angle)) + position.Y; display = FarBeyond.showHitboxes; displayLine.Position = position; displayLine.Rotation = angle; displayRect.Position = rectPos; for (var i = 0; i < projectiles.Count; i++) { if (!projectiles[i].disposed) { projectiles[i].Update(deltaTime); } } }
// TODO: Replace with registry public void Fire(ProjectileType type) { switch (type) { case ProjectileType.playerShot: var pos = new Vector2f(); pos.X = offset.Y * (float)Math.Sin(MiscUtils.DegToRad(-angle)) + position.X; pos.Y = offset.Y * (float)Math.Cos(MiscUtils.DegToRad(-angle)) + position.Y; var projectile = new Projectile(pos, Projectile.ProjectileType.player, angle, damage); projectile.speed = 200; projectile.lifeTime = 5000; projectiles.Add(projectile); break; } }