コード例 #1
0
    void RpcTransferPlayer(RoomTransfer.Directions direction)
    {
        var localPlayer = NetworkManager.singleton.client.connection.playerControllers[0].gameObject;

        switch (direction)
        {
        case RoomTransfer.Directions.Up: {
            localPlayer.transform.position = new Vector2(transform.position.x, transform.position.y + 4);
            Camera.main.transform.Translate(new Vector2(0, 12));
            break;
        }

        case RoomTransfer.Directions.Down: {
            localPlayer.transform.position = new Vector2(transform.position.x, transform.position.y - 4);
            Camera.main.transform.Translate(new Vector2(0, -12));
            break;
        }

        case RoomTransfer.Directions.Left: {
            localPlayer.transform.position = new Vector2(transform.position.x - 5, transform.position.y);
            Camera.main.transform.Translate(new Vector2(-21, 0));
            break;
        }

        case RoomTransfer.Directions.Rigth: {
            localPlayer.transform.position = new Vector2(transform.position.x + 5, transform.position.y);
            Camera.main.transform.Translate(new Vector2(21, 0));
            break;
        }

        default:
            break;
        }
    }
コード例 #2
0
 void CmdTransferPlayer(RoomTransfer.Directions direction)
 {
     RpcTransferPlayer(direction);
 }
コード例 #3
0
 public void TransferPlayer(RoomTransfer.Directions direction)
 {
     CmdTransferPlayer(direction);
 }