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 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 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);
        }
Beispiel #4
0
        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;
        }
Beispiel #5
0
        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;
        }