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();
|
||||
}
|
||||
public Entity[] GetEntities(Rectangle rectangle)
|
||||
public Entity[] GetEntities(Rectangle rectangle, Entity entity)
|
||||
{
|
||||
|
||||
List<Entity> entities = new List<Entity>();
|
||||
|
@ -219,6 +219,8 @@ namespace ZoFo.GameCore.GameManagers.CollisionManager
|
|||
entities.Add(item);
|
||||
}
|
||||
}
|
||||
if (entities.Contains(entity))
|
||||
entities.Remove(entity);
|
||||
return entities.ToArray();
|
||||
}
|
||||
|
||||
|
|
|
@ -91,12 +91,19 @@ public class Player : LivingEntity
|
|||
{
|
||||
IsTryingToShoot = true;
|
||||
|
||||
Rectangle rectangle = new Rectangle((int)position.X, (int)position.Y, 200, 200);
|
||||
Entity[] entities = AppManager.Instance.server.collisionManager.GetEntities(rectangle);
|
||||
DebugHUD.DebugSet("ent[0]", entities[0].ToString());
|
||||
if(entities != null){
|
||||
foreach (Entity entity in entities){
|
||||
AppManager.Instance.server.DeleteObject(entity);
|
||||
var rect = collisionComponent.stopRectangle.SetOrigin(position);
|
||||
rect.Width += 100;
|
||||
rect.Height += 100;
|
||||
Entity[] entities = AppManager.Instance.server.collisionManager.GetEntities(rect, this);
|
||||
if (entities.Length>0)
|
||||
{
|
||||
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);
|
||||
|
||||
_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)
|
||||
{
|
||||
|
@ -228,7 +228,7 @@ namespace ZoFo.GameCore.Graphics
|
|||
destinationRectangle = Scaling(destinationRectangle);
|
||||
_spriteBatch.Draw(texture,
|
||||
destinationRectangle, sourceRectangle, Color.White, 0,
|
||||
Vector2.Zero, Flip, 0);
|
||||
Vector2.Zero, Flip, (destinationRectangle.Y + destinationRectangle.Height) / 2000f);
|
||||
}
|
||||
private void buildSourceRectangle()
|
||||
{
|
||||
|
|
|
@ -22,6 +22,7 @@ using ZoFo.GameCore.GameObjects.MapObjects;
|
|||
using ZoFo.GameCore.GameObjects.MapObjects.StopObjects;
|
||||
using ZoFo.GameCore.Graphics;
|
||||
using ZoFo.GameCore.GameManagers.NetworkManager.SerializableDTO;
|
||||
using ZoFo.GameCore.GUI;
|
||||
|
||||
namespace ZoFo.GameCore
|
||||
{
|
||||
|
@ -79,7 +80,10 @@ namespace ZoFo.GameCore
|
|||
case "UpdatePlayerParametrs":
|
||||
break;
|
||||
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;
|
||||
case "UpdateTileCreated":
|
||||
break;
|
||||
|
@ -218,6 +222,7 @@ namespace ZoFo.GameCore
|
|||
position = gameObject.position
|
||||
});
|
||||
collisionManager.Register(entity.collisionComponent);
|
||||
entities.Add(entity);
|
||||
}
|
||||
else
|
||||
AddData(new UpdateGameObjectCreated()
|
||||
|
|
Loading…
Add table
Reference in a new issue