本文整理汇总了C#中NetworkView类的典型用法代码示例。如果您正苦于以下问题:C# NetworkView类的具体用法?C# NetworkView怎么用?C# NetworkView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NetworkView类属于命名空间,在下文中一共展示了NetworkView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AllocateNetworkViewID
public void AllocateNetworkViewID(string _requestID, NetworkView _networkView)
{
if (mAllocateRequests.ContainsKey(_requestID))
{
Debug.Log("Request " + _requestID + " is incomplete. Please wait.");
return;
}
if (mAllocationCache.ContainsKey(_requestID))
{
_networkView.viewID = mAllocationCache[_requestID];
return;
}
if (Network.isServer)
{
_networkView.viewID = Network.AllocateViewID();
mAllocationCache.Add(_requestID, _networkView.viewID);
}
else if (Network.isClient)
{
mAllocateRequests.Add(_requestID, new WeakReference(_networkView));
networkView.RPC("NetworkViewAllocator_RequestViewID", RPCMode.Server, Network.player, _requestID);
}
else
{
Debug.Log("The connect is not established yet, try after connected to server.");
return;
}
}
示例2: CombatHandler
public CombatHandler(NetworkView nv)
{
_nv = nv;
//Get Memory for the list
_effectDictionary = new Dictionary<PlayerObject, List<DynamicEffect>>(SIZE);
}
示例3: Awake
void Awake()
{
cam = GetComponentInChildren<Camera>();
animator = (Animator)GetComponent<Animator> ();
networkView = GetComponent<NetworkView> ();
Respawn ();
}
示例4: Start
void Start()
{
m_animator = GetComponentInChildren<Animator>();
myNetworkView = GetComponent<NetworkView>();
myAudioSource = GetComponent<AudioSource>();
SetColliders( false );
}
示例5: Start
void Start()
{
tParent = transform.parent;
networkView = tParent.GetComponent <NetworkView>();
gameObject.SetActive(networkView.isMine);
gm = GameManager.Instance;
}
示例6: Awake
void Awake()
{
animationState = 0;
animator = (Animator)GetComponent<Animator> ();
animator.SetInteger ("State", animationState);
networkView = GetComponent<NetworkView> ();
}
示例7: Start
// Use this for initialization
void Start()
{
gameLogic = GameObject.Find("GameLogic").GetComponent<RPCUpdates>();
audio = GetComponent<AudioSource>();
sphere = GetComponent<Rigidbody> ();
nV = GetComponent<NetworkView>();
}
示例8: OnConnectedToServer
void OnConnectedToServer()
{
if (Server.g && Server.g.IsClient()) {
m_networkView = GetComponent<NetworkView>();
Server.g.SyncViewIds (m_networkView, "Avatar");
}
}
示例9: Find
/// <summary>
/// find a networkview based on a networkviewid that was serialized into an rpc
/// </summary>
/// <param name="message">uses deserialize, so the read location does advance</param>
/// <param name="view"></param>
/// <returns></returns>
public bool Find(ref NetIncomingMessage message, out NetworkView view)
{
var id = new NetworkViewId();
id.OnDeserialize(message);
return Find(id, out view);
}
示例10: OnTriggerStay
void OnTriggerStay(Collider coll)
{
if (coll.tag == "Player")
{
// GameObject hitPlayer = coll.gameObject;
nView = coll.GetComponent<NetworkView>();
nView.RPC("NetworkTakeDamageFromWeapon", nView.owner, 1);
}
if (coll.tag == "Boss")
{
// GameObject hitPlayer = coll.gameObject;
nView = coll.GetComponent<NetworkView>();
nView.RPC("NetworkTakeDamageFromWeapon", nView.owner, 1);
if (nView.isMine)
{
Sentry companion;
companion = nView.GetComponent<Sentry>();
companion.ClientTakeDamageFromWeapon(1);
}
else
{
nView.RPC("NetworkTakeDamageFromWeapon", nView.owner, 1);
}
}
}
示例11: Start
public void Start ()
{
//Initializes on start up to listen for messages
//make sure this game object has both UDPPackIO and OSC script attached
UDPPacketIO udp = (UDPPacketIO)GetComponent("UDPPacketIO");
udp.init(RemoteIP, SendToPort, ListenerPort);
handler = (Osc)GetComponent("Osc");
handler.init(udp);
handler.SetAllMessageHandler(AllMessageHandler);
tornadoSlider = GameObject.Find("Tornado Slider").GetComponent<UnityEngine.UI.Slider>();
munchkinSlider = GameObject.Find("Munchkin Slider").GetComponent<UnityEngine.UI.Slider>();
poppySlider = GameObject.Find("Poppy Slider").GetComponent<UnityEngine.UI.Slider>();
monkeySlider = GameObject.Find("Monkey Slider").GetComponent<UnityEngine.UI.Slider>();
fireSlider = GameObject.Find("Fire Slider").GetComponent<UnityEngine.UI.Slider>();
transSpeedSlider = GameObject.Find("Transition Slider").GetComponent<UnityEngine.UI.Slider>();
nv = GameObject.Find("Network").GetComponent<NetworkView>();
Debug.Log("Osc Running");
}
示例12: Start
// Use this for initialization
void Start()
{
//myInputBox = GetComponentInChildren<UnityEngine.UI.InputField>();
//myChatBox = GetComponentInChildren<UnityEngine.UI.Text>();
myNetworkView = GetComponent<NetworkView>();
myNetworkManager = Camera.main.GetComponent<NetworkManager>();
}
示例13: addScopeNetView
public void addScopeNetView(NetworkView[] pNetworkViews)
{
foreach (var lNetworkView in pNetworkViews)
{
addScopeNetView(lNetworkView);
}
}
示例14: Awake
void Awake()
{
MyNetworkView = gameObject.GetComponent<NetworkView> ();
OnlineName = gameObject.name;
// maybe reload the last used name from PlayerPrefs or generate a random name
BroadcastNickName();
}
示例15: Buffer
public static void Buffer(NetworkView view, string func, RPCMode mode, params object[] args)
{
//first fix up the mode so no one accidentally passes in a buffered mode
if(mode == RPCMode.AllBuffered)
mode = RPCMode.All;
else if(mode == RPCMode.OthersBuffered)
mode = RPCMode.Others;
if(m_RPCs == null)
m_RPCs = new BufferedRPC[0];
BufferedRPC [] temp = new BufferedRPC[m_RPCs.Length+1];
if(m_RPCs.Length > 0)
m_RPCs.CopyTo(temp,0);
BufferedRPC tempRPC = new BufferedRPC();
tempRPC.func = func;
tempRPC.mode = mode;
if(args != null)
{
// for(int i = 0; i < args.Length; i++)
// Debug.Log(args[i].ToString() + ", ");
tempRPC.args = new object[args.Length];
args.CopyTo(tempRPC.args,0);
}
tempRPC.view = view;
temp[temp.Length-1] = tempRPC;
m_RPCs = temp;
view.RPC(func, mode, args);
}