A Smoll game engine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
626 B

  1. using System.Numerics;
  2. using Raylib_cs;
  3. namespace Smoll.Ex2 {
  4. class TimeToLiveComponent : Smoll.Component {
  5. float secondsToLive;
  6. float lived = 0f;
  7. public TimeToLiveComponent(float secondsToLive)
  8. {
  9. this.secondsToLive = secondsToLive;
  10. }
  11. public override void Update(float deltaTimeSeconds)
  12. {
  13. lived += deltaTimeSeconds;
  14. if(lived > secondsToLive) owner.mustDelete = true;
  15. }
  16. public override void Draw(Smoll.Layer.DrawMode drawMode) {
  17. if(drawMode == Layer.DrawMode.Debug) {
  18. }
  19. }
  20. }
  21. }