コード例 #1
0
        public Tooltip(Scene scene, TransformComponent tc, TooltipSpecs specs) : base(scene, tc, null)
        {
            DC = new DrawComponent(null, new Size(50.0, 8.0));

            Direction = specs.Direction;
            Velocity  = specs.Velocity;
            LifeSpan  = specs.LifeSpan;

            Text = new TextComponent(specs.Text);
        }
コード例 #2
0
ファイル: Booster.cs プロジェクト: FatalRuntimeError/Space
        public void CreateTooltip()
        {
            TooltipSpecs specs = new TooltipSpecs();

            specs.Direction = new Point(0.0, -1.0);
            specs.LifeSpan  = 0.5;
            specs.Velocity  = 100.0;
            specs.Text      = "";

            switch (Type)
            {
            case BoosterType.AddHP:
                if (Scene.Game.player.HP + 5 <= Scene.Game.player.MaxHP)
                {
                    specs.Text = "+5 HP";
                }
                else
                {
                    specs.Text = "Max HP";
                }
                break;

            case BoosterType.AddDamage:
                if (Scene.Game.player.Damage + 5 <= Scene.Game.player.MaxDamage)
                {
                    specs.Text = "+5 Damage";
                }
                else
                {
                    specs.Text = "Max Damage";
                }
                break;

            case BoosterType.AddLazer:
                if (Scene.Game.player.LazerCount < 3)
                {
                    specs.Text = "+1 Lazer";
                }
                else
                {
                    specs.Text = "Max weapon";
                }
                break;

            case BoosterType.Bomb:
                specs.Text = "+1 Bomb";
                break;

            case BoosterType.Shield:
                specs.Text = "+5s Shield";
                break;

            case BoosterType.ChainsawShield:
                specs.Text = "+5s Shield";
                break;

            default:
                break;
            }

            Tooltip tooltip = new Tooltip(Scene, new TransformComponent(TC.Position), specs);

            Scene.NewActors.Add(tooltip);
        }