protected virtual void OnHealthChanged() { var evnt = UpdateNetworkedBuilding.Create(Bolt.GlobalTargets.OnlyServer, Bolt.ReliabilityModes.Unreliable); evnt.buildingUID = networkedID; evnt.health = health; evnt.Send(); }
public override void DestroyBuilding(BaseBuilding building, RaycastHit hit) { BoltBuilding boltBuilding = (BoltBuilding)building; if(boltBuilding == null) { base.DestroyBuilding(building,hit); return; } var evnt = UpdateNetworkedBuilding.Create(Bolt.GlobalTargets.OnlyServer, Bolt.ReliabilityModes.ReliableOrdered); evnt.buildingUID = boltBuilding.networkedID; evnt.health = 0; evnt.Send(); }
public static void UpdateEntity(UpdateNetworkedBuilding evnt) { int id = evnt.buildingUID; var building = GetEntity(id); if (building != null) { building.AssingNetworkedHealth(evnt.health); if (BoltNetwork.isServer) { evnt = UpdateNetworkedBuilding.Create(Bolt.GlobalTargets.Others, Bolt.ReliabilityModes.ReliableOrdered); evnt.buildingUID = id; evnt.Send(); } } }