private void EnsureCoordinatorInit()
 {
     if (coordinator == null)
     {
         coordinator = new InteractionCoordinator <PositionalHandApply>(this, WillInteract, ServerPerformInteraction);
     }
 }
Пример #2
0
 private void EnsureCoordinatorInit()
 {
     if (coordinator == null)
     {
         coordinator = new InteractionCoordinator <T2>(this, WillInteractT2, ServerPerformInteraction);
     }
 }
    /// <summary>
    /// Uses the coordinator to validate and attempt the interaction on the server side.
    /// </summary>
    /// <param name="info"></param>
    /// <param name="coordinator"></param>
    /// <typeparam name="T">type of interaction</typeparam>
    /// <returns>If validation succeeds and
    /// coordinator performs server side interaction, returns
    /// STOP_PROCESSING. Otherwise returns CONTINUE_PROCESSING.</returns>
    public static bool ServerProcessCoordinatedInteraction <T>(T info, InteractionCoordinator <T> coordinator)
        where T : Interaction
    {
        if (coordinator.ServerValidateAndPerform(info))
        {
            return(true);
        }

        return(false);
    }
 private void EnsureCoordinatorInit()
 {
     if (coordinatorMouseDrop == null)
     {
         coordinatorMouseDrop = new InteractionCoordinator <MouseDrop>(this, WillInteract, ServerPerformInteraction);
     }
     if (coordinatorHandApply == null)
     {
         coordinatorHandApply = new InteractionCoordinator <HandApply>(this, WillInteract, ServerPerformInteraction);
     }
 }
Пример #5
0
 private void EnsureCoordinatorInit()
 {
     if (coordinatorAimApply == null)
     {
         coordinatorAimApply = new InteractionCoordinator <AimApply>(this, WillInteract, ServerPerformInteraction);
     }
     if (coordinatorHandActivate == null)
     {
         coordinatorHandActivate = new InteractionCoordinator <HandActivate>(this, WillInteract, ServerPerformInteraction);
     }
 }
    /// <summary>
    /// Uses the coordinator to validate and attempt the interaction on the client side.
    /// </summary>
    /// <param name="info"></param>
    /// <param name="coordinator"></param>
    /// <typeparam name="T">type of interaction</typeparam>
    /// <returns>If validation succeeds and coordinator sends the interaciton msg, invokes
    /// onValidationSuccess and returns STOP_PROCESSING. Otherwise returns CONTINUE_PROCESSING.</returns>
    public static bool CoordinatedInteract <T>(T info, InteractionCoordinator <T> coordinator,
                                               Action <T> onValidationSuccess)
        where T : Interaction
    {
        var validated = coordinator.ClientValidateAndRequest(info);

        if (validated)
        {
            //success, so do client prediction if not server player
            if (!CustomNetworkManager.Instance._isServer)
            {
                onValidationSuccess.Invoke(info);
            }
        }

        return(validated);
    }
Пример #7
0
 protected void Start()
 {
     coordinator = new InteractionCoordinator <T5>(this, ValidatorsT5(), ServerPerformInteraction);
     //subclasses must remember to call base.Start() if they use Start
     base.Start();
 }