public override void Initialize()
        {
            base.Initialize();
            _texture = Entity.Scene.Content.Load <Texture2D>(_isCircle ? Content.Circle : Content.Square);

            _spriteRenderer             = Entity.AddComponent(new SpriteRenderer(_texture));
            _spriteRenderer.LayerDepth  = 0;
            _spriteRenderer.RenderLayer = 1;
            _spriteRenderer.Transform.SetScale(0.75f);
            _textLabel        = Entity.Scene.CreateEntity("TextLabel");
            _textLabel.Parent = Entity.Transform;

            _outlineRenderer = Entity.AddComponent(new SpriteOutlineRenderer(_spriteRenderer)
            {
                OutlineColor = new Color(61, 9, 107),
                OutlineWidth = 10
            });
            _outlineRenderer.RenderLayer = 9999;

            _textComponent = _textLabel.AddComponent <TextComponent>();
            _textComponent.SetFont(Entity.Scene.Content.Load <IFont>(Content.DefaultTitleFont));
            _textComponent.VerticalOrigin   = VerticalAlign.Center;
            _textComponent.HorizontalOrigin = HorizontalAlign.Center;

            _textComponent.Text       = _value;
            _textComponent.LayerDepth = 0;
            _textComponent.Color      = Color.Black;
            _textComponent.Transform.SetScale(0.5f);
            _textComponent.Transform.Parent = Entity.Transform;
            //_textComponent.Transform.LocalPosition = new Vector2(0, 0);
            //_textComponent.Transform.LocalPosition = Vector2.Zero;
        }
Exemple #2
0
        public override void OnAddedToEntity()
        {
            base.OnAddedToEntity();

            spriteOutline             = Entity.AddComponent(new SpriteOutlineRenderer(renderer));
            spriteOutline.Color       = Color.Green;
            spriteOutline.RenderLayer = 0;
        }