minor fixes + layerDepth attempt failed
This commit is contained in:
parent
b228c526a3
commit
a4e877668b
4 changed files with 24 additions and 10 deletions
|
@ -208,7 +208,7 @@ namespace ZoFo.GameCore.GameManagers.CollisionManager
|
||||||
}
|
}
|
||||||
return players.ToArray();
|
return players.ToArray();
|
||||||
}
|
}
|
||||||
public Entity[] GetEntities(Rectangle rectangle)
|
public Entity[] GetEntities(Rectangle rectangle, Entity entity)
|
||||||
{
|
{
|
||||||
|
|
||||||
List<Entity> entities = new List<Entity>();
|
List<Entity> entities = new List<Entity>();
|
||||||
|
@ -219,6 +219,8 @@ namespace ZoFo.GameCore.GameManagers.CollisionManager
|
||||||
entities.Add(item);
|
entities.Add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (entities.Contains(entity))
|
||||||
|
entities.Remove(entity);
|
||||||
return entities.ToArray();
|
return entities.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,12 +91,19 @@ public class Player : LivingEntity
|
||||||
{
|
{
|
||||||
IsTryingToShoot = true;
|
IsTryingToShoot = true;
|
||||||
|
|
||||||
Rectangle rectangle = new Rectangle((int)position.X, (int)position.Y, 200, 200);
|
var rect = collisionComponent.stopRectangle.SetOrigin(position);
|
||||||
Entity[] entities = AppManager.Instance.server.collisionManager.GetEntities(rectangle);
|
rect.Width += 100;
|
||||||
DebugHUD.DebugSet("ent[0]", entities[0].ToString());
|
rect.Height += 100;
|
||||||
if(entities != null){
|
Entity[] entities = AppManager.Instance.server.collisionManager.GetEntities(rect, this);
|
||||||
foreach (Entity entity in entities){
|
if (entities.Length>0)
|
||||||
AppManager.Instance.server.DeleteObject(entity);
|
{
|
||||||
|
DebugHUD.DebugSet("ent[0]", entities[0].ToString());
|
||||||
|
if (entities != null)
|
||||||
|
{
|
||||||
|
foreach (Entity entity in entities)
|
||||||
|
{
|
||||||
|
AppManager.Instance.server.DeleteObject(entity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,7 +202,7 @@ namespace ZoFo.GameCore.Graphics
|
||||||
destinationRectangle = Scaling(destinationRectangle);
|
destinationRectangle = Scaling(destinationRectangle);
|
||||||
|
|
||||||
_spriteBatch.Draw(texture, destinationRectangle, sourceRectangle, Color.White, Rotation,
|
_spriteBatch.Draw(texture, destinationRectangle, sourceRectangle, Color.White, Rotation,
|
||||||
Vector2.Zero, Flip, 0);
|
Vector2.Zero, Flip, (destinationRectangle.Y + destinationRectangle.Height) / 2000f);
|
||||||
}
|
}
|
||||||
public override void Draw(Rectangle destinationRectangle, SpriteBatch _spriteBatch, Rectangle sourceRectangle)
|
public override void Draw(Rectangle destinationRectangle, SpriteBatch _spriteBatch, Rectangle sourceRectangle)
|
||||||
{
|
{
|
||||||
|
@ -228,7 +228,7 @@ namespace ZoFo.GameCore.Graphics
|
||||||
destinationRectangle = Scaling(destinationRectangle);
|
destinationRectangle = Scaling(destinationRectangle);
|
||||||
_spriteBatch.Draw(texture,
|
_spriteBatch.Draw(texture,
|
||||||
destinationRectangle, sourceRectangle, Color.White, 0,
|
destinationRectangle, sourceRectangle, Color.White, 0,
|
||||||
Vector2.Zero, Flip, 0);
|
Vector2.Zero, Flip, (destinationRectangle.Y + destinationRectangle.Height) / 2000f);
|
||||||
}
|
}
|
||||||
private void buildSourceRectangle()
|
private void buildSourceRectangle()
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,6 +22,7 @@ using ZoFo.GameCore.GameObjects.MapObjects;
|
||||||
using ZoFo.GameCore.GameObjects.MapObjects.StopObjects;
|
using ZoFo.GameCore.GameObjects.MapObjects.StopObjects;
|
||||||
using ZoFo.GameCore.Graphics;
|
using ZoFo.GameCore.Graphics;
|
||||||
using ZoFo.GameCore.GameManagers.NetworkManager.SerializableDTO;
|
using ZoFo.GameCore.GameManagers.NetworkManager.SerializableDTO;
|
||||||
|
using ZoFo.GameCore.GUI;
|
||||||
|
|
||||||
namespace ZoFo.GameCore
|
namespace ZoFo.GameCore
|
||||||
{
|
{
|
||||||
|
@ -79,7 +80,10 @@ namespace ZoFo.GameCore
|
||||||
case "UpdatePlayerParametrs":
|
case "UpdatePlayerParametrs":
|
||||||
break;
|
break;
|
||||||
case "UpdateInput":
|
case "UpdateInput":
|
||||||
players[0].HandleNewInput(updateData as UpdateInput);
|
if (players.Count > 0)
|
||||||
|
players[0].HandleNewInput(updateData as UpdateInput);//TODO id instead of 0
|
||||||
|
else
|
||||||
|
DebugHUD.DebugLog("NO PLAYER ON MAP");
|
||||||
break;
|
break;
|
||||||
case "UpdateTileCreated":
|
case "UpdateTileCreated":
|
||||||
break;
|
break;
|
||||||
|
@ -218,6 +222,7 @@ namespace ZoFo.GameCore
|
||||||
position = gameObject.position
|
position = gameObject.position
|
||||||
});
|
});
|
||||||
collisionManager.Register(entity.collisionComponent);
|
collisionManager.Register(entity.collisionComponent);
|
||||||
|
entities.Add(entity);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
AddData(new UpdateGameObjectCreated()
|
AddData(new UpdateGameObjectCreated()
|
||||||
|
|
Loading…
Add table
Reference in a new issue