Example #1
0
            private void Update()
            {
                if (Controller == null)
                {
                    return;
                }

                var currentGroup = _drone.net.group;

                if (currentGroup != _networkGroup)
                {
                    Controller.net.SwitchSecondaryGroup(currentGroup);
                    _networkGroup = currentGroup;
                }
            }
        // Clients destroy entities from a network group when they leave it.
        // This helps determine later on whether the client is creating the entity or simply receiving an update.
        private void OnNetworkGroupLeft(BasePlayer player, Network.Visibility.Group group)
        {
            for (var i = 0; i < group.networkables.Count; i++)
            {
                var networkable = group.networkables.Values.Buffer[i];
                if (networkable == null)
                {
                    continue;
                }

                var entity = networkable.handler as BaseNetworkable;
                if (entity == null || entity.net == null)
                {
                    continue;
                }

                EntitySubscriptionManager.Instance.RemoveEntitySubscription(entity.net.ID, player.userID);
            }
        }
Example #3
0
 private void Awake()
 {
     _drone        = GetComponent <Drone>();
     _networkGroup = _drone.net.group;
 }