public void CapacityChange(float capacity) { var msg = new CapacityMsg(); msg.EntityId = m_batteryBlock.EntityId; msg.capacity = capacity; Sync.Layer.SendMessageToServer(ref msg); }
static void CapacityChange(ref CapacityMsg msg, MyNetworkClient sender) { MyBatteryBlock batteryBlock; if (MyEntities.TryGetEntityById <MyBatteryBlock>(msg.EntityId, out batteryBlock)) { batteryBlock.CurrentStoredPower = msg.capacity; if (Sync.IsServer) { Sync.Layer.SendMessageToAll(ref msg); } } }
static void CapacityChange(ref CapacityMsg msg, MyNetworkClient sender) { MyBatteryBlock batteryBlock; if (MyEntities.TryGetEntityById<MyBatteryBlock>(msg.EntityId, out batteryBlock)) { batteryBlock.CurrentStoredPower = msg.capacity; if (Sync.IsServer) Sync.Layer.SendMessageToAll(ref msg); } }