纳金网

标题: 【Unity】Photon多人场景 [打印本页]

作者: .    时间: 2013-1-16 20:48
标题: 【Unity】Photon多人场景
免费范例Photon AngryBots:简单步骤制作多人游戏场景 我们开始吧:下载这个:http://u3d.as/content/exit-games/photon-angry-bots-demo/2i9导入到一个新项目你需要注册一个免费帐号http://cloud.exitgames.com。然后从你的帐号,应用控制面板创建新应用获得应用ID将ID粘贴到Unity(窗口>hoton unity networking>设置>你的应用ID_______)*注意:你需要删除ID字符间的空格,否则也许无法生效。 步骤:打开场景“2_AngryBots_MP”另存为新场景"2_MyGameScene_MP"删除“Environment(static)”,“Environment(semi-static)”,“Environment(sounds)”,“Environment(dynamic)”,“MoodBoxes”,“Misc”。创建plane平面,0,0,0 尺寸:100,1,100(现在角色不会掉落了)在0,0,0(使用这个作为spawnpoint)创建box箱子(或空的游戏对象),设置标签为spawnpoint主摄像机,禁止脚本:Quality Manager主摄像机,禁止脚本:ReflectionFx(减少出错的几率...)脚步声出现一些错误(需要检查接触的材料?) “NullReferenceException: Object reference not set to an instance of an objectMaterialImpactManager.GetPlayerFootstepSound (UnityEngine.PhysicMaterial mat) (at Assets/Scripts/Managers/MaterialImpactManager.js:28)” 临时解决办法:打开“FootstepHandler.js”,注释掉下列代码:// sound = MaterialImpactManager.GetPlayerFootstepSound (physicMaterial);//audioSource.pitch = Random.Range (0.98, 1.02);//audioSource.PlayOneShot (sound, Random.Range (0.8, 1.2));//sound = MaterialImpactManager.GetMechFootstepSound (physicMaterial);//sound = MaterialImpactManager.GetSpiderFootstepSound (physicMaterial); 9. 错误:NullReferenceException: Object reference not set to an instance of an objectMaterialImpactManager.GetMaterialImpact (UnityEngine.PhysicMaterial mat) (at Assets/Scripts/Managers/MaterialImpactManager.js:48)MaterialImpactManager.GetBulletHitSound (UnityEngine.PhysicMaterial mat) (at Assets/Scripts/Managers/MaterialImpactManager.js:43)AutoFire.Update () (at Assets/Scripts/Weapons/AutoFire.js:56) 临时解决办法:打开“AutoFire.js”,注释掉下列代码:// Ricochet sound//var sound : AudioClip = MaterialImpactManager.GetBulletHitSound (hitInfo.collider.sharedMaterial);//AudioSource.PlayClipAtPoint (sound, hitInfo.point, hitSoundVolume); 10. 现在设置摄像机...打开“PlayerMoveController.js”找到下列代码:var cameraTargetPosition : Vector3 = character.position + initOffsetToPlayer + cameraAdjustmentVector * cameraPreview; 注释掉,添加新代码(设置摄像机位于角色的上方)var cameraTargetPosition : Vector3 = character.position + new Vector3(0,15,0); 11. 注意:如果你想测试游戏,在创建设置你需要设置所有的关卡到创建列表0_Preloader1_BeginScene2_MyGameScene _MP3_EndScene 清除加载画面打开场景“0_Preloader”删除所有标志打开场景“1_BeginScene”删除所有标志选择主摄像机,这里是主菜单:你可以设置“MainLogo”图片打开MainMenu.cs:你可以设置你的游戏和房间名完成 其他注意事项: 我的联网功能在关闭unity后就失效了,过了一会又好了……多尝试几次,重启几次unity,然后它会开始正常工作...(?)还没有找到从列表移除photon应用的办法很多unity photon教程的链接或demo貌似都失效了...O0?
【来源:互联网】
更多精彩教程,尽在web3D纳金网http://www.narkii.com/college/




欢迎光临 纳金网 (http://go.narkii.com/club/) Powered by Discuz! X2.5