Test
This commit is contained in:
@@ -6,7 +6,7 @@ using Microsoft.Xna.Framework;
|
||||
|
||||
namespace DepthsBelow.Component
|
||||
{
|
||||
class Collision : Component
|
||||
public class Collision : Component
|
||||
{
|
||||
|
||||
public Rectangle Rectangle;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
namespace DepthsBelow.Component
|
||||
{
|
||||
@@ -13,5 +14,10 @@ namespace DepthsBelow.Component
|
||||
{
|
||||
Parent = parent;
|
||||
}
|
||||
|
||||
public virtual void Update(GameTime gameTime)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
namespace DepthsBelow
|
||||
{
|
||||
public class Entity
|
||||
@@ -9,7 +11,6 @@ namespace DepthsBelow
|
||||
List<Component.Component> Components;
|
||||
public Component.PixelTransform pixelTransform;
|
||||
public Component.GridTransform gridTransform;
|
||||
public Component.Collision collision;
|
||||
|
||||
public Entity()
|
||||
{
|
||||
@@ -18,8 +19,6 @@ namespace DepthsBelow
|
||||
AddComponent(pixelTransform);
|
||||
gridTransform = new Component.GridTransform(this);
|
||||
AddComponent(gridTransform);
|
||||
collision = new Component.Collision(this, 32, 32);
|
||||
AddComponent(collision);
|
||||
}
|
||||
|
||||
public T GetComponent<T>() where T : Component.Component
|
||||
@@ -37,5 +36,12 @@ namespace DepthsBelow
|
||||
{
|
||||
Components.Add(c);
|
||||
}
|
||||
|
||||
public virtual void Update(GameTime gameTime)
|
||||
{
|
||||
// Update components
|
||||
foreach (Component.Component c in Components)
|
||||
c.Update(gameTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ using Microsoft.Xna.Framework.Media;
|
||||
|
||||
namespace DepthsBelow
|
||||
{
|
||||
class Soldier : Entity
|
||||
public class Soldier : Entity
|
||||
{
|
||||
Core game;
|
||||
bool selected = false;
|
||||
@@ -32,10 +32,14 @@ namespace DepthsBelow
|
||||
rc.Texture = Texture;
|
||||
rc.Color = Color.HotPink;
|
||||
this.AddComponent(rc);
|
||||
|
||||
Component.Collision cc = new Component.Collision(this, 32, 32);
|
||||
this.AddComponent(cc);
|
||||
}
|
||||
|
||||
public void Update(GameTime gameTime)
|
||||
public override void Update(GameTime gameTime)
|
||||
{
|
||||
base.Update(gameTime);
|
||||
/*KeyboardState ks = Keyboard.GetState();
|
||||
if (ks.IsKeyDown(Keys.Right) && lastKeyboardState.IsKeyUp(Keys.Right))
|
||||
gridTransform.Position.X += 1;
|
||||
|
||||
Reference in New Issue
Block a user