Merge branch 'main' into livingEntities
This commit is contained in:
commit
607d047c6d
1 changed files with 30 additions and 2 deletions
|
@ -25,7 +25,7 @@ namespace DangerousD.GameCore
|
||||||
public List<Player> players;
|
public List<Player> players;
|
||||||
public List<GameObject> otherObjects = new();
|
public List<GameObject> otherObjects = new();
|
||||||
|
|
||||||
public Player GetPlayer1 { get; private set; }
|
public Player GetPlayer1 => players[0];
|
||||||
public GameManager()
|
public GameManager()
|
||||||
{
|
{
|
||||||
others = new List<GameObject>();
|
others = new List<GameObject>();
|
||||||
|
@ -49,7 +49,6 @@ namespace DangerousD.GameCore
|
||||||
{
|
{
|
||||||
livingEntities.Add(gameObject as LivingEntity);
|
livingEntities.Add(gameObject as LivingEntity);
|
||||||
players.Add(objPl);
|
players.Add(objPl);
|
||||||
GetPlayer1 = players[0];
|
|
||||||
}
|
}
|
||||||
else if (gameObject is LivingEntity objLE)
|
else if (gameObject is LivingEntity objLE)
|
||||||
{
|
{
|
||||||
|
@ -72,6 +71,35 @@ namespace DangerousD.GameCore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Remove(GameObject gameObject)
|
||||||
|
{
|
||||||
|
GetAllGameObjects.Remove(gameObject);
|
||||||
|
if (gameObject is Player objPl)
|
||||||
|
{
|
||||||
|
livingEntities.Remove(gameObject as LivingEntity);
|
||||||
|
players.Remove(objPl);
|
||||||
|
}
|
||||||
|
else if (gameObject is LivingEntity objLE)
|
||||||
|
{
|
||||||
|
livingEntities.Remove(objLE);
|
||||||
|
}
|
||||||
|
else if (gameObject is Entity objE)
|
||||||
|
{
|
||||||
|
entities.Remove(objE);
|
||||||
|
}
|
||||||
|
else if (gameObject is MapObject obj)
|
||||||
|
{
|
||||||
|
if (obj.IsColliderOn)
|
||||||
|
mapObjects.Remove(obj);
|
||||||
|
else
|
||||||
|
BackgroundObjects.Remove(obj);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
otherObjects.Remove(gameObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void Draw(SpriteBatch _spriteBatch)
|
public void Draw(SpriteBatch _spriteBatch)
|
||||||
{
|
{
|
||||||
foreach (var item in BackgroundObjects)
|
foreach (var item in BackgroundObjects)
|
||||||
|
|
Loading…
Add table
Reference in a new issue