Advertisement
Michael_smith

Entity

Mar 31st, 2020
397
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.41 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using Microsoft.Xna.Framework;
  7. using Microsoft.Xna.Framework.Graphics;
  8.  
  9. namespace GameBase
  10. {
  11.     class Entity
  12.     {
  13.         public Entity nextEntity;
  14.         public Texture2D texture;
  15.         public bool isActive;
  16.         public Vector2 rotationXY;
  17.         public Vector2 positionXY;
  18.         public float rotationDEG;
  19.         public float velocity;
  20.         public Vector2 velocityXY;
  21.         public Entity()
  22.         {
  23.             nextEntity = null;
  24.             isActive = true;
  25.            
  26.         }
  27.         public virtual void Update(GameTime gameTime)
  28.         {
  29.             Entity stepEntity = this.nextEntity;
  30.             if (nextEntity != null)
  31.             {
  32.                 while (stepEntity != null)
  33.                 {
  34.                     stepEntity.Update(gameTime);
  35.                     stepEntity = stepEntity.nextEntity;
  36.  
  37.                 }
  38.             }
  39.            
  40.         }
  41.  
  42.         public virtual void Draw(SpriteBatch spriteBatch)
  43.         {
  44.             Entity stepEntity = this.nextEntity;
  45.             if (nextEntity != null)
  46.             {
  47.                 while (stepEntity != null)
  48.                 {
  49.                     stepEntity.Draw(spriteBatch);
  50.                     stepEntity = stepEntity.nextEntity;
  51.  
  52.                 }
  53.             }
  54.         }
  55.  
  56.     }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement