本文整理汇总了C#中UnityEngine.Networking.NetworkInstanceId类的典型用法代码示例。如果您正苦于以下问题:C# NetworkInstanceId类的具体用法?C# NetworkInstanceId怎么用?C# NetworkInstanceId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NetworkInstanceId类属于UnityEngine.Networking命名空间,在下文中一共展示了NetworkInstanceId类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddItem
/// <summary>
/// Attribue un item à un slot déjà existant
/// </summary>
/// <param name="name"></param>
/// <param name="type"></param>
/// <param name="spritePath"></param>
public static void AddItem(Item itemToAdd, NetworkInstanceId _go)
{
itemToAdd.go = _go;
int slotId = 0;
InventorySlot currentSlot;
// Initialisation du numéro de slot à remplir
while (slotId < slots.Count())
{
if (slotId >= SLOTS_NBR)
{
return;
}
currentSlot = slots[slotId];
if (currentSlot.IsEmpty)
break;
else if (currentSlot.Item.Name.Equals(itemToAdd.Name) && currentSlot.Amount < 100)
{
currentSlot.Amount += 1; // Si un ojet du même type a été trouvé, on incrémente juste la quantité
return;
}
slotId++;
}
slots[slotId].FillSlot(itemToAdd);
}
示例2: RpcSetWeaponTarget
void RpcSetWeaponTarget(NetworkInstanceId target)
{
//Prende la transform del veicolo per settare la mira correttamente. Trovare un altro sistema!!!
targetIk.solver.target = ClientScene.FindLocalObject(target).transform.GetComponent<ControllerWheels>().CentralPoint.transform;
}
示例3: PlayerInfoPacket
public PlayerInfoPacket(string name, string team, NetworkInstanceId networkID, int score = 0)
{
this.playerName = name;
this.playerTeam = team;
this.networkID = networkID;
this.score = score;
}
示例4: StopDragging
public void StopDragging(NetworkInstanceId netId)
{
//draggingHelper = playerTransform.GetComponent<DraggingHelper>();
//draggingHelper.CmdSetDraggedBody(netId);
StopDragging();
}
开发者ID:cristi16,项目名称:Artefacts---Collaborative-evolution-of-three-dimensional-objects,代码行数:7,代码来源:Dragable.cs
示例5: CmdAddDeath
public void CmdAddDeath(NetworkInstanceId attacker)
{
deaths++;
var attackerObj = ClientScene.FindLocalObject(attacker);
if (attackerObj) {
attackerObj.GetComponent<Player>().kills++;
}
}
示例6: CmdUnspawnUnit
public void CmdUnspawnUnit(NetworkInstanceId objID)
{
GameObject unspawnedObj = NetworkServer.FindLocalObject(objID);
//NetworkServer.UnSpawn(unspawnedObj);
NetworkServer.Destroy(unspawnedObj);
//For the server we don't want to see it, but it will stil exists, because we need the reference to the old object due to buttons listeners.
unspawnedObj.GetComponent<MeshRenderer>().enabled = false;
}
示例7: registerKill
public void registerKill(NetworkInstanceId netId, int playerKilledId, int playerKillerId)
{
KillPlayer kp = new KillPlayer();
kp.netId = netId;
nm.client.Send(Msgs.killPlayer, kp);
pom.killPlayerLocal(playerKilledId, playerKillerId);
Debug.Log("Player " + playerKilledId + " died");
}
示例8: RpcPickUp
void RpcPickUp(NetworkInstanceId id)
{
if (pc == null)
pc = ClientScene.FindLocalObject (id).GetComponent<PlayerControls> ();
GetComponent<SpriteRenderer> ().enabled = false;
GetComponent<CircleCollider2D> ().enabled = false;
if (pc.isLocalPlayer)
MainGUI.GUI.SetPowerUpIcon (Icon);
}
示例9: LogKill
// Logs deaths in the scoreboard and kills where applicable
public static void LogKill(NetworkInstanceId killerId, NetworkInstanceId victimId)
{
PlayerStats[victimId]["deaths"]++;
// Not a suicide or environmental death, so log a kill
if (!killerId.IsEmpty () && killerId != victimId) {
PlayerStats[killerId]["kills"]++;
}
}
示例10: Reset
public void Reset()
{
Life = MAX_PLAYER_LIFE;
ExplosionRange = MIN_EXPLOSION_RANGE;
MaxBombsNum = MIN_BOMB_NUM;
Speed = MIN_SPEED * 2;
NetId = NetworkInstanceId.Invalid;
KickSkill = false;
}
示例11: CmdShoot
private void CmdShoot(NetworkInstanceId id, bool explosion)
{
GameObject player = NetworkServer.FindLocalObject(id);
var healthScript = player.GetComponent<NetworkHealth>();
if(healthScript == null) {
Debug.LogError("no healthScripts attached to player");
return;
}
healthScript.TakeDamage(damage, explosion);
}
示例12: GetNetworkIdentity
internal bool GetNetworkIdentity(NetworkInstanceId netId, out NetworkIdentity uv)
{
if (this.m_LocalObjects.ContainsKey(netId) && (this.m_LocalObjects[netId] != null))
{
uv = this.m_LocalObjects[netId];
return true;
}
uv = null;
return false;
}
示例13: CmdEquipItem
public void CmdEquipItem(NetworkInstanceId netId, int handIndex)
{
var go = NetworkServer.FindLocalObject(netId);
go.transform.SetParent(handIndex == -1 ? playerLeftHand : playerRightHand);
go.transform.position = Vector3.zero;
go.transform.localPosition = Vector3.zero;
go.transform.rotation = Quaternion.identity;
go.SetActive(true);
RpcEquipItem(netId, handIndex);
}
示例14: FindLocalObject
internal GameObject FindLocalObject(NetworkInstanceId netId)
{
if (this.m_LocalObjects.ContainsKey(netId))
{
NetworkIdentity localObject = this.m_LocalObjects[netId];
if ((Object) localObject != (Object) null)
return localObject.gameObject;
}
return (GameObject) null;
}
示例15: Deserialize
public override void Deserialize(NetworkReader reader)
{
this.netId = reader.ReadNetworkId();
this.payload = reader.ReadBytesAndSize();
this.teleport = reader.ReadBoolean();
this.time = (int) reader.ReadPackedUInt32();
}