private void DiedEntity(ConsoleEntity entity) { var animated = new Animated("default", 1, 1, _adventureFont); BasicNoDraw frame = animated.CreateFrame(); frame[0].Glyph = 143; frame[0].Foreground = Color.Gainsboro; entity.Animation = animated; }
public void DrawEntity(AdventureEntity adventureEntity) { int glyph; Color color; switch (adventureEntity) { case Mogwai _: glyph = 1; color = Color.DarkOrange; break; case Monster _: glyph = 135; //64; color = Color.SandyBrown; break; case Chest _: glyph = 146; //64; color = Color.Pink; break; default: throw new NotImplementedException(); } // TODO: rotating symbols for multiple mogwais var defaultAnim = new Animated("default", 1, 1, _adventureFont); BasicNoDraw frame = defaultAnim.CreateFrame(); frame[0].Glyph = glyph; frame[0].Foreground = color; Coord pos = adventureEntity.Coordinate; var entity = new ConsoleEntity(defaultAnim) { Position = new Point(pos.X, pos.Y), }; // damage animation var defAnimated = new Animated("default", 1, 1, _adventureFont); var animEntity = new ConsoleEntity(defAnimated); var damageAnim = new Animated("damage", 1, 1, _adventureFont) { AnimationDuration = 1 }; BasicNoDraw damageFrame = damageAnim.CreateFrame(); damageAnim.CreateFrame(); damageFrame[0].Glyph = 15; damageFrame[0].Foreground = Color.Red; animEntity.Animations.Add("damage", damageAnim); // add animation entity entity.Children.Add(animEntity); // TODO change this ... to a more appropriate handling // do not revive ... dead shapes if (adventureEntity is Combatant combatant && combatant.IsDead) { DiedEntity(entity); } entity.IsVisible = false; _entities.Add(adventureEntity.AdventureEntityId, entity); _entityManager.Entities.Add(entity); }
/// <summary> /// Creates a new drawing surface control with the specified width and height. /// </summary> /// <param name="width">Width of the control.</param> /// <param name="height">Height of the control.</param> public DrawingSurface(int width, int height) : base(width, height) { Surface = new BasicNoDraw(width, height); base.TabStop = false; }