]> git.r.bdr.sh - rbdr/super-polarity/blobdiff - SuperPolarity/Actors/Actor.cs
Update project to work on VS Code mac
[rbdr/super-polarity] / SuperPolarity / Actors / Actor.cs
index 5e7e482781af182d63aaeefb813970bae1945dc1..b25de42acb309b6e727fc77e89105cde0e5104af 100644 (file)
@@ -1,4 +1,4 @@
-using System;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
@@ -14,13 +14,12 @@ namespace SuperPolarity
 
         public List<Actor> Children;
 
 
         public List<Actor> Children;
 
-        // Graphics / In-Game
-        protected Texture2D Texture;
-        protected Vector2 Origin;
+        // In-Game Properties
         public bool Active;
         public bool Active;
-        public Rectangle Box;
-        public Vector4 BoxDimensions;
-        protected Texture2D BoxTexture;
+               public Rectangle Box;
+               public Vector4 BoxDimensions;
+               protected Texture2D BoxTexture;
+               protected Color Color;
 
         // Physical Properties
         public Vector2 Position;
 
         // Physical Properties
         public Vector2 Position;
@@ -31,68 +30,58 @@ namespace SuperPolarity
 
         // Constraints / Behavior
         public float MaxVelocity;
 
         // Constraints / Behavior
         public float MaxVelocity;
-        protected float AccelerationRate;
-        public int HP;
-        protected bool Immortal;
+               protected float AccelerationRate;
         public bool Dying;
         public bool Dying;
-        public int Value;
-        protected Color Color;
 
         public Actor Parent;
 
 
         public Actor Parent;
 
-        public int Width
+        public virtual int Width
         {
         {
-            get { return Texture.Width; }
+            get { return 0; }
         }
 
         }
 
-        public int Height
+        public virtual int Height
         {
         {
-            get { return Texture.Height; }
+            get { return 0; }
         }
 
         public Actor(SuperPolarity newGame)
         {
             game = newGame;
         }
 
         public Actor(SuperPolarity newGame)
         {
             game = newGame;
-            BoxDimensions.X = 20;
-            BoxDimensions.Y = 20;
-            BoxDimensions.W = 15;
-            BoxDimensions.Z = 15;
+                       BoxDimensions.X = 20;
+                       BoxDimensions.Y = 20;
+                       BoxDimensions.W = 15;
+                       BoxDimensions.Z = 15;
         }
 
         }
 
-        public virtual void Initialize(Texture2D texture, Vector2 position)
+        public virtual void Initialize(Vector2 position)
         {
         {
-            Texture = texture;
             Position = position;
             Active = true;
 
             Position = position;
             Active = true;
 
-                       Collides = true;
+                       Collides = false;
 
             Children = new List<Actor>();
 
 
             Children = new List<Actor>();
 
-            Origin = new Vector2(Texture.Width / 2, Texture.Height / 2);
             Velocity = new Vector2(0, 0);
             Acceleration = new Vector2(0, 0);
 
             MaxVelocity = 5;
             AccelerationRate = 10;
 
             Velocity = new Vector2(0, 0);
             Acceleration = new Vector2(0, 0);
 
             MaxVelocity = 5;
             AccelerationRate = 10;
 
-            HP = 1;
-            Immortal = false;
-
             Dying = false;
             Dying = false;
-            Value = 1;
 
 
-            InitBox();
-            BoxTexture = new Texture2D(game.GraphicsDevice, 1, 1);
-            BoxTexture.SetData(new Color[] { Color.White });
+                       InitBox();
+                       BoxTexture = new Texture2D(game.GraphicsDevice, 1, 1);
+                       BoxTexture.SetData(new Color[] { Color.White });
 
             Color = Color.White;
         }
 
 
             Color = Color.White;
         }
 
-        protected void InitBox()
-        {
-            Box = new Rectangle((int)(Position.X - BoxDimensions.X), (int)(Position.Y - BoxDimensions.X), (int)(BoxDimensions.X + BoxDimensions.X + BoxDimensions.W), (int)(BoxDimensions.Y + BoxDimensions.Y + BoxDimensions.Z));
-        }
+               protected void InitBox()
+               {
+                       Box = new Rectangle((int)(Position.X - BoxDimensions.X), (int)(Position.Y - BoxDimensions.X), (int)(BoxDimensions.X + BoxDimensions.X + BoxDimensions.W), (int)(BoxDimensions.Y + BoxDimensions.Y + BoxDimensions.Z));
+               }
 
         public void AutoDeccelerate(GameTime gameTime)
         {
 
         public void AutoDeccelerate(GameTime gameTime)
         {
@@ -154,21 +143,19 @@ namespace SuperPolarity
             Move(gameTime);
             ChangeAngle();
             CheckOutliers();
             Move(gameTime);
             ChangeAngle();
             CheckOutliers();
-            UpdateBox();
+                       UpdateBox ();
         }
 
         }
 
-        protected virtual void UpdateBox()
-        {
-            Box.X = (int)(Position.X - BoxDimensions.X);
-            Box.Y = (int)(Position.Y - BoxDimensions.Y);
-        }
+               protected virtual void UpdateBox()
+               {
+                       Box.X = (int)(Position.X - BoxDimensions.X);
+                       Box.Y = (int)(Position.Y - BoxDimensions.Y);
+               }
 
         public virtual void Move(GameTime gameTime)
         {
             AutoDeccelerate(gameTime);
 
 
         public virtual void Move(GameTime gameTime)
         {
             AutoDeccelerate(gameTime);
 
-            var maxVelocity = MaxVelocity;
-
             Velocity.X = Velocity.X + Acceleration.X * (float)gameTime.ElapsedGameTime.TotalSeconds;
             Velocity.Y = Velocity.Y + Acceleration.Y * (float)gameTime.ElapsedGameTime.TotalSeconds;
 
             Velocity.X = Velocity.X + Acceleration.X * (float)gameTime.ElapsedGameTime.TotalSeconds;
             Velocity.Y = Velocity.Y + Acceleration.Y * (float)gameTime.ElapsedGameTime.TotalSeconds;
 
@@ -220,8 +207,7 @@ namespace SuperPolarity
                 child.Draw(spriteBatch);
             }
 
                 child.Draw(spriteBatch);
             }
 
-            spriteBatch.Draw(Texture, Position, null, Color, Angle, Origin, 1f, SpriteEffects.None, 0f);
-            //spriteBatch.Draw(BoxTexture, Box, new Color(255, 0, 255, 25));
+                       //spriteBatch.Draw(BoxTexture, Box, new Color(255, 0, 255, 25));
         }
 
         void CheckOutliers()
         }
 
         void CheckOutliers()
@@ -242,18 +228,6 @@ namespace SuperPolarity
         {
         }
 
         {
         }
 
-        public void TakeDamage(int amount)
-        {
-            if (!Immortal)
-            {
-                HP = HP - amount;
-                if (HP < 0)
-                {
-                    Die();
-                }
-            }
-        }
-
         protected virtual void Die()
         {
             Dying = true;
         protected virtual void Die()
         {
             Dying = true;
@@ -261,10 +235,8 @@ namespace SuperPolarity
 
         public virtual void CleanUp()
         {
 
         public virtual void CleanUp()
         {
-            Texture = null;
-            BoxTexture = null;
-            Children = null;
-            Texture = null;
+                       BoxTexture = null;
+                       Children = null;
         }
     }
 }
         }
     }
 }