Exemplo n.º 1
0
        public void Cmd_RequestUnUseTrigger(RequestUseTriggerMessage data)
        {
            DevdogLogger.LogVerbose("[UNet][Server] Client with netID " + netId + " requested to un-use trigger...", this);

            var trigger = data.triggerIdentity.GetComponent <ITrigger>();

            if (trigger != null)
            {
                var canUnUse = trigger.CanUnUse(player);
                if (canUnUse)
                {
                    trigger.Server_UnUse(player);

                    // NOTE: isHost check to avoid doing the same thing twice, which is a bit heavy and spammy to the console...
                    if (isHost == false)
                    {
                        TargetRpc_UnUseTrigger(connectionToClient, data.triggerIdentity);
                    }

//                    foreach (var character in trigger.rangeHandler.GetCharactersInRange())
//                    {
//                        if (character == player)
//                        {
//                            continue;
//                        }
//
//                        Rpc_TriggerUnUsedByOtherClient(trigger.GetComponent<NetworkIdentity>());
//                    }
                }
            }
        }
Exemplo n.º 2
0
        private void TargetRpc_UnUseTrigger(NetworkConnection target, NetworkIdentity triggerIdentity)
        {
            DevdogLogger.LogVerbose("[UNet][Client] Server told us (netID: " + netId + ") to un-use trigger with netID: " + triggerIdentity.netId, this);

            var trigger = triggerIdentity.GetComponent <ITrigger>();

            if (trigger != null)
            {
                trigger.Server_UnUse(player);
            }
        }
Exemplo n.º 3
0
        public void Cmd_RequestUseTrigger(RequestUseTriggerMessage data)
        {
            DevdogLogger.LogVerbose("[UNet][Server] Client with netID " + netId + " requested to use trigger...", this);
            if (data.triggerIdentity == null)
            {
                return;
            }

            var trigger = data.triggerIdentity.GetComponent <ITrigger>();

            if (trigger != null)
            {
                var canUse = trigger.CanUse(player);
                if (canUse)
                {
                    trigger.Server_Use(player);

                    // NOTE: isHost check to avoid doing the same thing twice, which is a bit heavy and spammy to the console...
                    if (isHost == false)
                    {
                        TargetRpc_UseTrigger(connectionToClient, data.triggerIdentity);
                    }

//                    // TODO: Relevancy for players needs to be used here.
//                    // TODO: When this trigger is relevant for a player and it's being used by another player (or NPC), it should notify that player the collection is being used / unused (for visuals).
//                    foreach (var character in trigger.rangeHandler.GetCharactersInRange())
//                    {
//                        if (character == player)
//                        {
//                            continue;
//                        }
//
//                        Rpc_TriggerUsedByOtherClient(trigger.GetComponent<NetworkIdentity>());
//                    }
                }
            }
        }