// 아이템 획득 처리. void GetItemOnNetwork(NetworkViewID viewId) { // 픽업 플래그. if (isPickedUp) { return; } isPickedUp = true; // 픽업한 Player를 찾는다. NetworkView player = NetworkView.Find(viewId); if (player == null) { return; } // 픽업한 Player에게 아이템을 준다. if (player.isMine) { player.SendMessage("GetItem", kind); } else { player.networkView.RPC("GetItem", player.owner, kind); } Network.Destroy(gameObject); Network.RemoveRPCs(networkView.viewID); }
// アイテム取得処理. void GetItemOnNetwork(NetworkViewID viewId) { // 拾われたフラグ. if (isPickedUp) return; isPickedUp = true; // 拾ったPlayerを探す. NetworkView player = NetworkView.Find(viewId); if (player == null) return; // 拾ったPlayerにアイテムを与える. if (player.isMine) player.SendMessage("GetItem",kind); else player.GetComponent<NetworkView>().RPC("GetItem",player.owner,kind); Network.Destroy(gameObject); Network.RemoveRPCs(GetComponent<NetworkView>().viewID); }