static void TargetPositionRequest(ref TargetPositionMsg msg, MyNetworkClient sender) { MyEntity entity; MyEntities.TryGetEntityById(msg.EntityId, out entity); if (entity is MyLargeTurretBase) { Sync.Layer.SendMessageToAllAndSelf(ref msg, MyTransportMessageEnum.Success); } }
static void TargetPositionSuccess(ref TargetPositionMsg msg, MyNetworkClient sender) { MyEntity entity; MyEntities.TryGetEntityById(msg.EntityId, out entity); var turret = entity as MyLargeTurretBase; if (turret != null) { turret.TargetPosition(msg.TargetPos, msg.TargetVelocity, msg.UsePrediction); } }
public void SendTargetPosition(Vector3D targetPos, Vector3?targetVelocity = null) { var msg = new TargetPositionMsg(); msg.EntityId = m_turret.EntityId; msg.TargetPos = targetPos; if (targetVelocity.HasValue) { msg.TargetVelocity = targetVelocity.Value; msg.UsePrediction = true; } else { msg.UsePrediction = false; } Sync.Layer.SendMessageToServer(ref msg, MyTransportMessageEnum.Request); }
static void TargetPositionSuccess(ref TargetPositionMsg msg, MyNetworkClient sender) { MyEntity entity; MyEntities.TryGetEntityById(msg.EntityId, out entity); var turret = entity as MyLargeTurretBase; if (turret != null) { turret.TargetPosition(msg.TargetPos,msg.TargetVelocity,msg.UsePrediction); } }
public void SendTargetPosition(Vector3D targetPos,Vector3? targetVelocity = null) { var msg = new TargetPositionMsg(); msg.EntityId = m_turret.EntityId; msg.TargetPos = targetPos; if (targetVelocity.HasValue) { msg.TargetVelocity = targetVelocity.Value; msg.UsePrediction = true; } else { msg.UsePrediction = false; } Sync.Layer.SendMessageToServer(ref msg, MyTransportMessageEnum.Request); }