示例#1
0
        public HealthBarSprite(AbstractSprite referenceSprite, Vector2 position, float width, float height) : base(position)
        {
            ReferenceSprite = referenceSprite;
            Width           = width;
            Height          = height;


            LayerDepth = 20;
        }
示例#2
0
        public HealthBar2Sprite(HealthBarPosition position, AbstractSprite hostSprite)
        {
            switch (position)
            {
            case HealthBarPosition.ScreenTop:
                this.Position = new Vector2(0, 0);
                break;

            case HealthBarPosition.ScreenBottom:
                this.Position = new Vector2(0, Game.RenderSize.Y - 10);
                break;
            }

            this.HostSprite = hostSprite;

            this.Scale = new Vector2(HEALTH_BAR_WIDTH_MAX, 10);
        }
示例#3
0
 public bool DoesCollide(AbstractSprite sprite)
 {
     return((sprite.Position - Position).Length() < (sprite.TextureSize.X * 0.5f + 4));
 }
示例#4
0
 /// <summary>
 ///     Spawns a <see cref="AbstractSprite" /> in the <see cref="SceneManager.CurrentScene" />
 /// </summary>
 /// <param name="sprite"></param>
 protected static void SpawnSprite(AbstractSprite sprite)
 {
     SceneManager.GetCurrentScene().BufferedAddSprite(sprite);
 }