/// <summary> /// Gets a list of all of the strings that should be drawn /// </summary> /// <returns></returns> private List<Text> allStrings() { List<Text> strings = new List<Text>(); #region Strings for Debugging #if DEBUG int numDebugStrings = 0; List<String> debugStrings = new List<String>(); if (SnailsPace.debugHelixPosition) { // Output helix's position debugStrings.Add("Helix: (" + Player.helix.position.X + ", " + Player.helix.position.Y + ")"); } if (SnailsPace.debugCameraPosition) { // Output camera and crosshair coordinates debugStrings.Add("Camera: (" + Renderer.cameraPosition.X + ", " + Renderer.cameraPosition.Y + ", " + Renderer.cameraPosition.Z + ")"); Vector3 cameraTargetPosition = gameRenderer.getCameraTargetPosition(); debugStrings.Add("Target: (" + cameraTargetPosition.X + ", " + cameraTargetPosition.Y + ", " + cameraTargetPosition.Z + ")"); Vector3 distance = cameraTargetPosition - Renderer.cameraPosition; debugStrings.Add("Distance: (" + distance.X + ", " + distance.Y + ", " + distance.Z + ")"); debugStrings.Add("Crosshair: (" + Player.crosshair.position.X + ", " + Player.crosshair.position.Y + ")"); } List<String>.Enumerator debugStringEnum = debugStrings.GetEnumerator(); while (debugStringEnum.MoveNext()) { Text debugString = new Text(); debugString.color = Color.Yellow; debugString.content = debugStringEnum.Current; debugString.font = debugFont; debugString.position = new Vector2(2 * debugFont.Spacing, debugFont.Spacing + numDebugStrings++ * debugFont.LineSpacing); debugString.scale = Vector2.One; strings.Add(debugString); } debugStringEnum.Dispose(); #endif #endregion strings.AddRange(player.textStrings()); return strings; }
/// <summary> /// /// </summary> /// <param name="startPosition"></param> /// <param name="weaponName"></param> public Player(Vector2 startPosition, String weaponName, String nextLevel) : base() { if (allowLevelProgression) { this.nextLevel = nextLevel; } else { this.nextLevel = null; } saveObject = new GameObject(); saveObject.affectedByGravity = false; saveObject.collidable = false; save(startPosition); Weapon[] oldInventory = new Weapon[0]; if (helix != null) { oldInventory = helix.inventory; } helix = new Helix(startPosition, weaponName); if (SnailsPace.cheatAllWeapons) { helix.AddWeapon(Weapon.load("stinger")); helix.weapon.ammunition = 50; helix.weapon.cooldown *= 0.25; helix.AddWeapon(Weapon.load("grenadelauncher")); helix.weapon.ammunition = 20; helix.weapon.cooldown *= 1; helix.AddWeapon(Weapon.load("minigun")); helix.weapon.ammunition = 200; helix.weapon.cooldown *= 4; helix.AddWeapon(Weapon.load("flamethrower")); helix.weapon.ammunition = 20; helix.weapon.cooldown *= 1; helix.AddWeapon(Weapon.load("generic")); } load(); // Crosshair creation Sprite crosshairSprite = new Sprite(); crosshairSprite.image = new Image(); crosshairSprite.image.filename = "Resources/Textures/Crosshair"; crosshairSprite.image.blocks = new Vector2(1.0f, 1.0f); crosshairSprite.image.size = new Vector2(64.0f, 64.0f); crosshairSprite.visible = true; crosshairSprite.effect = "Resources/Effects/effects"; crosshair = new GameObject(); crosshair.sprites = new Dictionary<string, Sprite>(); crosshair.sprites.Add("Crosshair", crosshairSprite); crosshair.position = new Vector2(0.0f, 0.0f); crosshair.layer = 0; crosshair.collidable = false; // Weapon weapon = new GameObject(); weapon.sprites = new Dictionary<string, Sprite>(); weapon.sprites.Add("Weapon", helix.weapon.sprite); weapon.position = helix.position; weapon.layer = -5; weapon.collidable = false; strings = new List<Text>(); pointsText = new Text(); pointsText.position = new Vector2(400, 0); pointsText.font = SnailsPace.getInstance().Content.Load<SpriteFont>("Resources/Fonts/Score"); pointsText.color = Color.White; pointsText.scale = Vector2.One; pointsText.content = points.ToString(); strings.Add(pointsText); recalculatePoints(); Engine.player = this; Renderer.cameraTarget = helix; }