public TextAnnouncerEntity(AnnouncerEnded endFunction, Color color, string title, string text, int width, float speed) : base(endFunction, 1) { this.text = new Text("", FontSize.Small); this.TintColor = color; titleText = new Text(title, FontSize.Large); inlineText = new Text(text[0] + "", FontSize.Medium); hintText = new Text("Click to continue", FontSize.Small); titleText.Align(AlignType.Center); hintText.Align(AlignType.Center); titleText.TintColor = color; hintText.TintColor = color; currentText = 1; totalText = Text.GetText(text, (int)(width / inlineText.Width)); maxHeight = totalText.Split('\n').Length * inlineText.Height + titleText.Height + hintText.Height + 50; string[] separatedStrings = totalText.Split('\n'); drawableInLineText = new List<Text>(); for (int i = 0; i < separatedStrings.Length; i++) { drawableInLineText.Add(new Text("", FontSize.Medium)); drawableInLineText[drawableInLineText.Count - 1].Align(AlignType.Center); drawableInLineText[drawableInLineText.Count - 1].TintColor = color; } this.textSpeed = speed; }
public Popur2Enemy() : base(new Color(255,150,150)) { maxSpeed = 0.7f * SPEED_UNIT; acceleration = 0.25f; totalTime = (float)((totalTime - 3) + 3 * OGE.Random.NextDouble()); direction = random.Next(360); rotationSpeed = 5f; health = 30f; damage = 0f; score = 120; enemyStatus = EnemyStatus.Attacking; CurrentImages.Add(new Image(OGE.Content.Load<Texture2D>(@"Graphics\Entities\Enemies\Popur2"))); CurrentImages[0].CenterOrigin(); AddCollisionMask(new HitboxMask(CurrentImages[0].Width, CurrentImages[0].Height, CurrentImages[0].OriginX, CurrentImages[0].OriginY)); thrusters.Add(new EnemyThrusterData { Direction = 180, Length = 22 }); explosionAlarm = new Alarm(totalTime, TweenType.OneShot, EnemyDestroy); AddTween(explosionAlarm, true); flickerAlarm = new Alarm(MAX_FLICKER_AMOUNT, TweenType.OneShot, FlickerColor); AddTween(flickerAlarm, true); alarmText = new Text(Math.Ceiling((1 - explosionAlarm.PercentComplete()) * totalTime).ToString(), FontSize.Small); alarmText.Angle = direction + 90; alarmText.OriginX = alarmText.Width / 2; alarmText.OriginY = alarmText.Height / 2; }
public TimeAnnouncerEntity(AnnouncerEnded endFunction, float height, float time, FontSize size) : base(endFunction, height) { endAlarm = new Alarm(time, TweenType.OneShot, new AlarmFinished(FinishAnnouncer)); AddTween(endAlarm, true); text = new Text("", size); }
public LevelNameAnnouncerEntity(AnnouncerEnded endFunction, string levelName, int levelNumber) : base(endFunction,100, 2, FontSize.Large) { this.levelNumberText = new Text("Sector " + levelNumber, FontSize.Small); this.levelNumberText.Align(AlignType.Center); TextContext = levelName; this.speed = 4; this.text.OriginX = this.text.Width / 2; this.text.OriginY = this.text.Height / 2; }
public VirusButtonAnnouncerEntity(AnnouncerEnded endFunction, Color color, Dictionary<Type, EnemyData> viewedEnemies, string playText, ButtonPressed playPressed) : base(endFunction, 325) { this.text = new Text("Security Console", FontSize.Large); this.text.OriginX = this.text.Width / 2; this.virusBackImage = new Image(OGE.Content.Load<Texture2D>(@"Graphics\Entities\WindowGraphics\EnemyWindow")); this.virusBackImage.CenterOrigin(); this.virusBackImage.TintColor = color; this.startLevel = new Button(color, playText, playPressed); this.nextVirus = new Button(color, "Next =>", GetNextEnemy); this.previousVirus = new Button(color, "<= Previous", GetPreviousEnemy); this.startLevel.TintColor = color; this.nextVirus.TintColor = color; this.previousVirus.TintColor = color; this.startLevel.Position.X = OGE.HUDCamera.Width / 2; this.startLevel.Position.Y = OGE.HUDCamera.Height / 2 + maxHeight / 2 - 40; this.previousVirus.Position.X = OGE.HUDCamera.Width / 2 - 350; this.previousVirus.Position.Y = OGE.HUDCamera.Height / 2 + maxHeight / 2 - 40; this.nextVirus.Position.X = OGE.HUDCamera.Width / 2 + 350; this.nextVirus.Position.Y = OGE.HUDCamera.Height / 2 + maxHeight / 2 - 40; this.viewedEnemies = viewedEnemies; this.selectedKey = 0; this.keys = this.viewedEnemies.Keys.ToList(); if (this.viewedEnemies.Count > 0) { this.enemy = Activator.CreateInstance(keys[selectedKey], false) as BaseEntity; } this.nameWordText = new Text("Name", FontSize.Small); this.nameText = new Text("", FontSize.Small); this.descriptionWordText = new Text("Description", FontSize.Small); this.descriptionText = new Text("", FontSize.Small); this.nameText.TintColor = color; this.nameWordText.TintColor = color; this.descriptionWordText.TintColor = color; this.descriptionText.TintColor = color; this.nameWordText.Align(AlignType.Center); this.nameText.Align(AlignType.Center); this.descriptionText.Align(AlignType.Center); this.descriptionWordText.Align(AlignType.Center); this.TintColor = color; }
public TextNotifierEntity(string showingText) { Position.X = OGE.HUDCamera.Width / 2; Position.Y = OGE.HUDCamera.Height / 2; scale = 1; scaleSpeed = 0.3f; alpha = 0.5f; alphaSpeed = 0.008f; normalColor = new Color(150, 255, 130); text = new Text(showingText, FontSize.XLarge); text.Align(AlignType.Center); text.OriginY = text.Height / 2; text.TintColor = normalColor * alpha; text.Scale = scale; EntityCollisionType = Collision.CollisionType.Explosion; }
public TitleSubtitleButtonAnnouncerEntity(AnnouncerEnded endFunction, Color color, string title, string subtitle, List<Button> buttons) : base(endFunction, 60 * buttons.Count + 100) { this.text = new Text(title, FontSize.Large); this.text.OriginX = this.text.Width / 2; this.subtitle = new Text(subtitle, FontSize.Medium); this.subtitle.Align(AlignType.Center); this.subtitle.TintColor = color; this.buttons = buttons; this.TintColor = color; for (int i = 0; i < this.buttons.Count; i++) { this.buttons[i].TintColor = color; this.buttons[i].AddFunction(FinishAnnouncer); this.buttons[i].Position.X = OGE.HUDCamera.Width / 2; this.buttons[i].Position.Y = OGE.HUDCamera.Height / 2 + maxHeight / 2 - (this.buttons.Count - i) * 60 + 10; } }
public LevelSelectorAnnouncer(AnnouncerEnded endFunction,Color color, ButtonPressed playPressed, ButtonPressed backPressed) : base(endFunction, (float)(Math.Ceiling(LevelData.MAX_LEVEL_DRIVE_NUMBER / 5.0) * 110 + 200)) { text = new Text("Sector Console", FontSize.Large); text.Align(AlignType.Center); levels = new List<CheckButton>(); int rowNumber = (int)Math.Ceiling(LevelData.MAX_LEVEL_DRIVE_NUMBER / 5.0); for (int i = 0; i < rowNumber; i++) { int coloumNumber = Math.Min(5, LevelData.MAX_LEVEL_DRIVE_NUMBER - i * 5); for (int j = 0; j < coloumNumber; j++) { levels.Add(new CheckButton(color, (i * 5 + j + 1).ToString(), new ButtonPressed(ClearSelection))); levels[levels.Count - 1].Position.X = OGE.HUDCamera.Width / 2 + (j - coloumNumber / 2.0f) * 110 + 50; levels[levels.Count - 1].Position.Y = OGE.HUDCamera.Height / 2 + (i - rowNumber / 2.0f) * 110; levels[levels.Count - 1].Selected = false; levels[levels.Count - 1].Active = !GlobalVariables.LockedLevels[(GlobalVariables.CurrentDrive - 1) * LevelData.MAX_LEVEL_DRIVE_NUMBER + i * 5 + j]; } } levels[GlobalVariables.CurrentLevel - 1].Selected = true; TintColor = color; backButton = new Button(color, "Return to Drive Console", backPressed); backButton.Position.X = OGE.HUDCamera.Width / 2; backButton.Position.Y = OGE.HUDCamera.Height / 2 + maxHeight / 2 - 35; playButton = new Button(color, "Select Sector", playPressed); playButton.Position.X = backButton.Position.X; playButton.Position.Y = backButton.Position.Y - 60; selectedLevel = GlobalVariables.CurrentLevel; levelDataText = new Text("Sector Name: " + LevelData.GetLevel(selectedLevel).LevelName, FontSize.Medium); levelDataText.TintColor = color; levelDataText.Align(AlignType.Center); }
public Button(Color color, string text, ButtonPressed pressedFunction) { this.Active = true; this.Position = new Vector2(); this.status = WindowButtonState.Normal; Texture2D texture = OGE.Content.Load<Texture2D>(@"Graphics\Entities\WindowGraphics\Buttons"); normalImage = new Image(texture, new Rectangle(0, 0, texture.Width, texture.Height / 2)); overImage = new Image(texture, new Rectangle(0, texture.Height / 2, texture.Width, texture.Height / 2)); normalImage.CenterOrigin(); overImage.CenterOrigin(); this.color = color; this.TintColor = color; this.text = new Text(text, FontSize.Medium); this.text.OriginX = this.text.Width / 2; this.text.OriginY = this.text.Height / 2; this.pressedFunction = new List<ButtonPressed>(); this.pressedFunction.Add(pressedFunction); collision = new Rectangle(-normalImage.OriginX, -normalImage.OriginY, normalImage.Width, normalImage.Height); }
public TutorialEntity(Color color, Action removeEntityAction = null) { this.removeEntityAction = removeEntityAction; GlobalVariables.IsFirstTime = false; this.color = color; controlsImage = new Image(OGE.Content.Load<Texture2D>(@"Graphics\Entities\Tutorial\Controls")); arrowLayoutImage = new Image(OGE.Content.Load<Texture2D>(@"Graphics\Entities\Tutorial\ArrowLayout")); controlsImage.TintColor = color; arrowLayoutImage.TintColor = color; Position = new Vector2(OGE.HUDCamera.Width / 2, OGE.HUDCamera.Height / 2) - new Vector2(controlsImage.Width / 2, controlsImage.Height / 2); wText = new Text("W", FontSize.Medium); aText = new Text("A", FontSize.Medium); sText = new Text("S", FontSize.Medium); dText = new Text("D", FontSize.Medium); wText.Align(AlignType.Center); aText.Align(AlignType.Center); sText.Align(AlignType.Center); dText.Align(AlignType.Center); moveText = new Text("Move Player", FontSize.Small); moveText.Align(AlignType.Right); moveText.TintColor = color; spaceText = new Text("Spacebar", FontSize.Medium); spaceText.Align(AlignType.Center); overclockingText = new Text("Start Overclocking", FontSize.Small); overclockingText.Align(AlignType.Center); overclockingText.TintColor = color; overclockingDetailsText = new Text("(It launches a random special ability from player abilities when the Overclocking meter is full)", FontSize.Small); overclockingDetailsText.Align(AlignType.Center); overclockingDetailsText.TintColor = color; leftMouseText = new Text("Fire", FontSize.Small); leftMouseText.TintColor = color; labelsImage = new Image(OGE.Content.Load<Texture2D>(@"Graphics\Entities\Tutorial\TutorialLabels")); labelsImage.TintColor = color; healthText = new Text("Player Health (if depleted, player dies)", FontSize.Small); topProcessorText = new Text("Primary Turret Processor(if reach maximum, it must cooldown)", FontSize.Small); bottomProcessorText = new Text("Secondry Turret Processor(if reach maximum, it must cooldown)", FontSize.Small); scoreText = new Text("Player score in that level", FontSize.Small); overclockingBarText = new Text("Show percentage filled of Overclocking (Increase by killing enemies)", FontSize.Small); healthText.TintColor = color; topProcessorText.TintColor = color; bottomProcessorText.TintColor = color; scoreText.TintColor = color; overclockingBarText.TintColor = color; scoreText.Align(AlignType.Right); overclockingBarText.Align(AlignType.Center); this.finishingAlarm = new Alarm(10, TweenType.OneShot, FadeEntity); AddTween(finishingAlarm); AdjustAlpha(); EntityCollisionType = Collision.CollisionType.Solid; }
public HUDEntity() { Texture2D texture = OGE.Content.Load<Texture2D>(@"Graphics\Entities\HUD\LifeBG"); lifeBGImage = new Image(texture, new Rectangle(0, 0, texture.Width, texture.Height)); texture = OGE.Content.Load<Texture2D>(@"Graphics\Entities\HUD\Life"); lifeRect = new Rectangle(0, 0, texture.Width, texture.Height); lifeImage = new Image(texture, lifeRect); texture = OGE.Content.Load<Texture2D>(@"Graphics\Entities\HUD\ProcessorBG"); topProcessorBGImage = new Image(texture, new Rectangle(0, 0, texture.Width, texture.Height)); downProcessorBGImage = new Image(texture, new Rectangle(0, 0, texture.Width, texture.Height)); texture = OGE.Content.Load<Texture2D>(@"Graphics\Entities\HUD\Processor"); processorRect = new Rectangle(0, 0, texture.Width, texture.Height); topProcessorImage = new Image(texture, processorRect); downProcessorImage = new Image(texture, processorRect); texture = OGE.Content.Load<Texture2D>(@"Graphics\Entities\HUD\RageBG"); overclockingBGImage = new Image(texture, new Rectangle(0, 0, texture.Width, texture.Height)); texture = OGE.Content.Load<Texture2D>(@"Graphics\Entities\HUD\Rage"); overclockingImage = new Image(texture, new Rectangle(0, 0, texture.Width, texture.Height)); texture = OGE.Content.Load<Texture2D>(@"Graphics\Entities\HUD\BossHealthBG"); bossHealthBGImage = new Image(texture, new Rectangle(0, 0, texture.Width, texture.Height)); texture = OGE.Content.Load<Texture2D>(@"Graphics\Entities\HUD\BossHealth"); bossHealthImage = new Image(texture, new Rectangle(0, 0, texture.Width, texture.Height)); topGunText = new Text(TopGunName, FontSize.Small); downGunText = new Text(DownGunName, FontSize.Small); scoreText = new Text(GlobalVariables.LevelScore.ToString(), FontSize.Large); scoreText.Align(AlignType.Right); overclockingText = new Text("Overclocking", FontSize.Small); overclockingText.Align(AlignType.Center); bossText = new Text("Boss", FontSize.Small); bossText.Align(AlignType.Center); survivalTimeText = new Text("00:00", FontSize.Medium); survivalTimeText.Align(AlignType.Center); normalColor = new Color(150, 255, 130); warningColor = new Color(255, 255, 130); overheatColor = new Color(255, 180, 180); warningPercentage = 0.75f; topGunText.TintColor = normalColor; downGunText.TintColor = normalColor; overclockingText.TintColor = normalColor; scoreText.TintColor = normalColor; survivalTimeText.TintColor = normalColor; bossHealthImage.TintColor = normalColor; bossHealthBGImage.TintColor = normalColor; bossText.TintColor = normalColor; }