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

            evnt.buildingUID = networkedID;
            evnt.health      = health;
            evnt.Send();
        }
예제 #2
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();
        }
예제 #3
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();
                }
            }
        }