/
TnetJoinRandomChannel.cs
50 lines (40 loc) · 1.27 KB
/
TnetJoinRandomChannel.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// (c) Copyright HutongGames, LLC 2010-2018. All rights reserved.
using System;
using UnityEngine;
using TNet;
using System.IO;
using UnityTools = TNet.UnityTools;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("Tnet Networking")]
public class TnetJoinRandomChannel : FsmStateAction
{
[RequiredField]
[Tooltip("Level that will be loaded first.")]
public FsmString levelname;
[RequiredField]
[Tooltip("ID of the channel. Every player joining this channel will see one another.")]
public FsmInt channelid;
[RequiredField]
[Tooltip("Whether the channel will remain active even when the last player leaves.")]
public FsmBool persistent;
[RequiredField]
[Tooltip("Maximum number of players that can be in this channel at once.")]
public FsmInt playerLimit;
[RequiredField]
[Tooltip("Leave Curret Channel")]
public FsmBool leavecurrentchannel;
public override void Reset()
{
channelid = 0;
levelname = "level 1";
persistent = false;
playerLimit = 5;
leavecurrentchannel = true;
}
public override void OnEnter()
{
TNManager.JoinRandomChannel(levelname.Value,persistent.Value,playerLimit.Value,null,leavecurrentchannel.Value);
}
}
}