static void OnChangeTarget(ref ChangeTargetMsg msg, MyNetworkClient sender) { MyEntity entity; MyEntities.TryGetEntityById(msg.EntityId, out entity); var turret = entity as MyLargeTurretBase; if (turret != null) { MyEntity target = null; if (msg.Target != 0) { MyEntities.TryGetEntityById(msg.Target, out target); } turret.SetTarget(target, msg.IsPotential); } }
static void OnChangeTarget(ref ChangeTargetMsg msg, MyNetworkClient sender) { MyEntity entity; MyEntities.TryGetEntityById(msg.EntityId, out entity); var turret = entity as MyLargeTurretBase; if (turret != null) { MyEntity target = null; if (msg.Target != 0) MyEntities.TryGetEntityById(msg.Target, out target); turret.SetTarget(target, msg.IsPotential); } }
public void SendChangeTarget(long target, bool isPotentialTarget) { var msg = new ChangeTargetMsg(); msg.EntityId = m_turret.EntityId; msg.Target = target; msg.IsPotential = isPotentialTarget; Sync.Layer.SendMessageToAll(ref msg, MyTransportMessageEnum.Success); }