LivingEntitySendPositionSupport(ЗОМБИ ХОДЯТ!!!)
This commit is contained in:
parent
dcc845a517
commit
c0997c903c
5 changed files with 19 additions and 18 deletions
|
@ -247,11 +247,6 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
|||
}
|
||||
}
|
||||
}
|
||||
if (AppManager.Instance.multiPlayerStatus != MultiPlayerStatus.SinglePlayer)
|
||||
{
|
||||
NetworkTask task = new NetworkTask(id, Pos);
|
||||
AppManager.Instance.NetworkTasks.Add(task);
|
||||
}
|
||||
}
|
||||
public void MoveDown()
|
||||
{
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
using Microsoft.Xna.Framework;
|
||||
using DangerousD.GameCore.GameObjects.LivingEntities;
|
||||
using DangerousD.GameCore.Network;
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
namespace DangerousD.GameCore.GameObjects;
|
||||
|
||||
|
@ -15,6 +17,14 @@ public abstract class LivingEntity : Entity
|
|||
public override void SetPosition(Vector2 position)
|
||||
{
|
||||
_pos = position;
|
||||
if (AppManager.Instance.multiPlayerStatus != MultiPlayerStatus.SinglePlayer)
|
||||
{
|
||||
NetworkTask task = new NetworkTask(id, _pos);
|
||||
if (this is Player || AppManager.Instance.multiPlayerStatus == MultiPlayerStatus.Host)
|
||||
{
|
||||
AppManager.Instance.NetworkTasks.Add(task);
|
||||
}
|
||||
}
|
||||
|
||||
} //TODO befrend targetpos and physics engine
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
using DangerousD.GameCore.Managers;
|
||||
using DangerousD.GameCore.GameObjects;
|
||||
using DangerousD.GameCore.GameObjects.LivingEntities;
|
||||
using DangerousD.GameCore.Managers;
|
||||
using DangerousD.GameCore.Network;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Content;
|
||||
|
@ -107,14 +109,14 @@ namespace DangerousD.GameCore.Graphics
|
|||
|
||||
public void StartAnimation(string startedanimationId)
|
||||
{
|
||||
if (startedanimationId == "playerShootRight" && parentId == 17)
|
||||
if (AppManager.Instance.multiPlayerStatus != MultiPlayerStatus.SinglePlayer)
|
||||
{
|
||||
string a = "2";
|
||||
}
|
||||
if (AppManager.Instance.multiPlayerStatus != MultiPlayerStatus.SinglePlayer && startedanimationId != GetCurrentAnimation)
|
||||
LivingEntity entity = AppManager.Instance.GameManager.livingEntities.Find(x => x.id == parentId);
|
||||
if (((entity is Player) || AppManager.Instance.multiPlayerStatus == MultiPlayerStatus.Host) && startedanimationId != GetCurrentAnimation)
|
||||
{
|
||||
AppManager.Instance.NetworkTasks.Add(new NetworkTask(parentId, startedanimationId, Vector2.Zero));
|
||||
}
|
||||
}
|
||||
currentFrame = 0;
|
||||
currentAnimation = animations.Find(x => x.Id == startedanimationId);
|
||||
|
||||
|
|
|
@ -242,11 +242,6 @@ namespace DangerousD.GameCore
|
|||
case NetworkTaskOperationEnum.ChangeState:
|
||||
if (networkTask.objId != GameManager.GetPlayer1.id)
|
||||
{
|
||||
List<GraphicsComponent> gcs = new List<GraphicsComponent>();
|
||||
foreach (var player in GameManager.players)
|
||||
{
|
||||
gcs.Add(player.GetGraphicsComponent());
|
||||
}
|
||||
LivingEntity entity = GameManager.livingEntities.Find(x => x.id == networkTask.objId);
|
||||
if (entity != null)
|
||||
{
|
||||
|
|
|
@ -149,7 +149,6 @@ namespace DangerousD.GameCore
|
|||
}
|
||||
}
|
||||
else
|
||||
|
||||
{
|
||||
for (int i = 0; i < livingEntitiesWithoutPlayers.Count; i++)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue