Beispiel #1
0
        protected virtual void OnHealthChanged()
        {
            var evnt = UpdateNetworkedBuilding.Create(Bolt.GlobalTargets.OnlyServer, Bolt.ReliabilityModes.Unreliable);

            evnt.buildingUID = networkedID;
            evnt.health      = health;
            evnt.Send();
        }
Beispiel #2
0
        public override void OnEvent(UpdateNetworkedBuilding evnt)
        {
            if (BoltNetwork.isServer)
            {
                return;
            }

            BoltEntitiesManager.UpdateEntity(evnt);
        }
Beispiel #3
0
        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();
        }
Beispiel #4
0
        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();
                }
            }
        }
Beispiel #5
0
 public override void OnEvent(UpdateNetworkedBuilding evnt)
 {
     UpdateEntity(evnt);
 }