• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Networking.NetworkInstanceId类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中UnityEngine.Networking.NetworkInstanceId的典型用法代码示例。如果您正苦于以下问题:C# NetworkInstanceId类的具体用法?C# NetworkInstanceId怎么用?C# NetworkInstanceId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NetworkInstanceId类属于UnityEngine.Networking命名空间,在下文中一共展示了NetworkInstanceId类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
        }
开发者ID:CalvoR,项目名称:2016_3A_Unity_Calvo_GodVSMan,代码行数:32,代码来源:Inventory.cs


示例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;

    }
开发者ID:Alx666,项目名称:ProjectPhoenix,代码行数:7,代码来源:IKControllerHumanoid.cs


示例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;
 }
开发者ID:gcoope,项目名称:HeroesAndVillains,代码行数:7,代码来源:PlayerInfoPacket.cs


示例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++;
     }
 }
开发者ID:raftelti,项目名称:flamewars,代码行数:8,代码来源:Player.cs


示例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;
 }
开发者ID:cristinaNiculescu,项目名称:towerBattle,代码行数:8,代码来源:UnitConstruction.cs


示例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");
 }
开发者ID:Geor23,项目名称:Planets,代码行数:8,代码来源:RoundEvents.cs


示例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);
 }
开发者ID:tylerbonnell,项目名称:Platformer-Bullet-Hell,代码行数:9,代码来源:GhostMode.cs


示例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"]++;
        }
    }
开发者ID:tylerbonnell,项目名称:Platformer-Bullet-Hell,代码行数:10,代码来源:GameManager.cs


示例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;
 }
开发者ID:MasakiWang,项目名称:Team-Trainning-2015-08,代码行数:9,代码来源:PlayerData.cs


示例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);
 }
开发者ID:cwp10,项目名称:MyFPSGameProject,代码行数:10,代码来源:Grenade.cs


示例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;
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:10,代码来源:NetworkScene.cs


示例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);
 }
开发者ID:CalvoR,项目名称:2016_3A_Unity_Calvo_GodVSMan,代码行数:10,代码来源:gvmPlayerControler.cs


示例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;
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:10,代码来源:NetworkScene.cs


示例15: CmdShoot

 private void CmdShoot(NetworkInstanceId id)
 {
     GameObject player = NetworkServer.FindLocalObject(id);
     var healthScript = player.GetComponent<NetworkHealth>();
     if (healthScript == null)
     {
         Debug.LogError("no hleathscript attached to player");
         return;
     }
     healthScript.GetShot(damage);
 }
开发者ID:Velantine,项目名称:Testgroud,代码行数:11,代码来源:Bullet.cs


示例16: FindLocalObject

 internal GameObject FindLocalObject(NetworkInstanceId netId)
 {
     if (this.m_LocalObjects.ContainsKey(netId))
     {
         NetworkIdentity identity = this.m_LocalObjects[netId];
         if (identity != null)
         {
             return identity.gameObject;
         }
     }
     return null;
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:12,代码来源:NetworkScene.cs


示例17: RpcChangeLightStatus

 public void RpcChangeLightStatus(NetworkInstanceId id, int status)
 {
     foreach (GameObject player in players)
     {
         if (player.GetComponent<NetworkIdentity>().netId == id)
         {
             FlashlightScript theirLight = player.GetComponentInChildren<FlashlightScript>();
             if (theirLight != null)
                 theirLight.changeStatus(status);
         }
     }
 }
开发者ID:dgarrick,项目名称:RunForIt,代码行数:12,代码来源:TransportLayer.cs


示例18: RpcSyncPlayer

    public void RpcSyncPlayer(NetworkInstanceId[] hId)
    {
        for (int i = 0; i < hId.Count(); i++)
        {
            Actor hActor = ClientScene.FindLocalObject(hId[i]).GetComponent<Actor>();
            if (!scores.ContainsKey(hActor))
                scores.Add(hActor, 0);

            if(hActor.gameObject != Radar.Player)
                Radar.Add(hActor.gameObject);
        }
    }
开发者ID:Alx666,项目名称:ProjectPhoenix,代码行数:12,代码来源:GameManager.cs


示例19: CheckPlayerBombCount

    public static int CheckPlayerBombCount(NetworkInstanceId playerId)
    {
        int count = 0;
        foreach (var obj in ClientScene.objects)
        {
            Bomb bomb = obj.Value.GetComponent<Bomb>();
            if (bomb != null && bomb.PuttingPlayer.PlayerData.NetId == playerId)
                ++count;
        }

        return count;
    }
开发者ID:MasakiWang,项目名称:Team-Trainning-2015-08,代码行数:12,代码来源:BombMgr.cs


示例20: updateParentId

 protected void updateParentId(NetworkInstanceId id)
 {
     this.parentId = id;
     GameObject parentObject = ClientScene.FindLocalObject(id);
     if(parentObject != null) {
         transform.parent = parentObject.transform;
         if (setPositionAndRotation) {
             transform.localPosition = positionAndRotation.position;
             transform.localEulerAngles = positionAndRotation.rotation;
         }
     }
 }
开发者ID:autarch-design-team,项目名称:OpenCircuit,代码行数:12,代码来源:NetworkParenter.cs



注:本文中的UnityEngine.Networking.NetworkInstanceId类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Networking.NetworkWriter类代码示例发布时间:2022-05-26
下一篇:
C# Networking.NetworkConnection类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap