X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;ds=sidebyside;f=CarFire%2FCarFire%2FCarFire%2FMap.cs;h=f4d7ea4fa61a2637b90abff61392efcf52d58ce1;hb=beb1ce501897ce4c00f7e97c6923ba0af2451732;hp=8c744bad3e8a96962288d966ea47c991911d099a;hpb=594f1f722dc8e405dff12baad8c2ef5481fa3fa7;p=chaz%2Fcarfire
diff --git a/CarFire/CarFire/CarFire/Map.cs b/CarFire/CarFire/CarFire/Map.cs
index 8c744ba..f4d7ea4 100644
--- a/CarFire/CarFire/CarFire/Map.cs
+++ b/CarFire/CarFire/CarFire/Map.cs
@@ -166,16 +166,6 @@ namespace CarFire
set { mView.Zoom = value; }
}
-
- ///
- /// Get and set the associated game object.
- ///
- public Game Game
- {
- get { return mData.Game; }
- set { mData.Game = value; }
- }
-
#endregion
@@ -287,21 +277,23 @@ namespace CarFire
/// Get all the entities loaded from the map file. Exceptions could be
/// thrown if there are entities without associated classes.
///
+ /// The game reference to be passed to entities.
/// List of entity objects loaded.
- public List GetAllEntities()
+ public List GetAllEntities(Game game)
{
- return mData.GetAllEntities();
+ return mData.GetAllEntities(game);
}
///
/// Get the entities of a certain type loaded from the map file. Exceptions
/// could be thrown if there are entities without associated classes.
///
+ /// The game reference to be passed to entities.
/// Type of the entity you want a list of.
/// List of entity objects loaded.
- public List GetEntities()
+ public List GetEntities(Game game)
{
- return mData.GetEntities();
+ return mData.GetEntities(game);
}
@@ -368,8 +360,6 @@ namespace CarFire
public Point[] PlayerPositions { get { return mPlayerPositions; } }
public bool[,] Grid { get { return mBooleanGrid; } }
- public Game Game;
-
public Model(Metadata metadata, char[,] grid, char defaultTile,
List entities, Point[] playerPositions)
@@ -438,7 +428,7 @@ namespace CarFire
}
- public List GetAllEntities()
+ public List GetAllEntities(Game game)
{
List list = new List();
@@ -452,14 +442,14 @@ namespace CarFire
args[0] = raw.Id;
args[1] = raw.Position;
args[2] = raw.Attributes;
- args[3] = Game;
+ args[3] = game;
try
{
IEntity entity = (IEntity)Activator.CreateInstance(System.Type.GetType("CarFire." + typename), args);
if (entity != null)
{
- entity.LoadContent(Game.ContentManager);
+ entity.LoadContent(game.ContentManager);
list.Add(entity);
}
else throw new RuntimeException();
@@ -480,7 +470,7 @@ namespace CarFire
return list;
}
- public List GetEntities()
+ public List GetEntities(Game game)
{
System.Type type = typeof(T);
List list = new List();
@@ -494,12 +484,12 @@ namespace CarFire
args[0] = raw.Id;
args[1] = raw.Position;
args[2] = raw.Attributes;
- args[3] = Game;
+ args[3] = game;
T entity = (T)Activator.CreateInstance(type, args);
if (entity != null)
{
- ((IEntity)entity).LoadContent(Game.ContentManager);
+ ((IEntity)entity).LoadContent(game.ContentManager);
list.Add(entity);
}
else throw new RuntimeException("Entity of type " + typename + " not loaded because an entity class can't be found.");