예제 #1
0
파일: Paddle.cs 프로젝트: Niller/Pong
    protected virtual void OnMoveInput(MoveInputSignal data)
    {
        if (data.Arg1 != Index)
        {
            return;
        }

        Position = new Vector2(Mathf.Clamp(Position.x + data.Arg2 * data.Arg3, -1f + Length, 1f - Length), Position.y);
        SignalBus.Invoke(new PaddlePositionChangedSignal(this));
    }
예제 #2
0
    protected override void OnMoveInput(MoveInputSignal data)
    {
        if (!_pongMultiplayerManager.IsHost && Index == 0)
        {
            return;
        }

        base.OnMoveInput(data);

        if (data.Arg1 != Index)
        {
            return;
        }

        if (_pongMultiplayerManager.IsHost && Index == 1)
        {
            _networkGameManager.CallSyncPaddle(this);
        }
    }