public HealthBarSprite(AbstractSprite referenceSprite, Vector2 position, float width, float height) : base(position) { ReferenceSprite = referenceSprite; Width = width; Height = height; LayerDepth = 20; }
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); }
public bool DoesCollide(AbstractSprite sprite) { return((sprite.Position - Position).Length() < (sprite.TextureSize.X * 0.5f + 4)); }
/// <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); }