protected virtual void Awake() { heroRendererMgr = new HeroRenderer(heroRenderers); heroRendererMgr.SetOcclude(false); dieAction = new System.Action(DieCallBack); rb = this.gameObject.GetComponent <Rigidbody>(); coll = GetComponent <Collider>(); maxShotLengthDiv = 1 / maxShotLength; neededUltAmountDiv = 1 / neededUltAmount; rotateYUpLimitBy360toQuarternion = 360 - rotateYUpLimit; anim = this.gameObject.GetComponent <Animator>(); SetActiveCtrls(); playerName = NetworkManager.instance.Names[photonView.ViewID / 1000]; if (photonView.IsMine) { heroRendererMgr.Show(false); InGameUIManager.Instance.SetTargetHero(this); Camera mainCam = Camera.main; mainCam.transform.SetParent(transform); mainCam.transform.SetPositionAndRotation(camPos.position, camPos.rotation); GameObject fpsCam = Resources.Load("hcp/FPSCamera") as GameObject; GameObject fpsCamIns = GameObject.Instantiate <GameObject>(fpsCam, mainCam.transform); if (fpsCam == null) { Debug.LogError("fpsCam 자체가 리소스에서 읽어오기 불가능."); } FPSCamPerHeroGO = GameObject.Instantiate <GameObject>(FPSCamPerHeroGO); if (FPSCamPerHeroGO == null) { Debug.LogError("fpsCam 히어로가 생성 불가능."); } FPSCamPerHeroGO.transform.SetParent(fpsCamIns.transform); FPSCamPerHeroGO.transform.SetPositionAndRotation(FPSCamPerHeroGO.transform.parent.position, FPSCamPerHeroGO.transform.parent.rotation); FPSCamPerHero = FPSCamPerHeroGO.GetComponent <FPSCameraPerHero>(); if (FPSCamPerHero == null) { Debug.LogError("영웅별 fps cam 이 어태치 되지 않았음."); } } else { rb.isKinematic = true; } }
protected virtual void Awake() { for (int i = 0; i < heroRenderers.Length; i++) { heroRenderers[i].material = new Material(heroRenderers[i].material); } for (int i = 0; i < heroRenderers.Length; i++) { heroRenderers[i].material.SetFloat("setOccludeVision", 0f); // heroRenderers[i].material.SetShaderPassEnabled("OccludePass", false); Debug.Log(heroRenderers[i].material.GetShaderPassEnabled("OccludePass")); } dieAction = new System.Action(DieCallBack); rb = this.gameObject.GetComponent <Rigidbody>(); coll = GetComponent <Collider>(); maxShotLengthDiv = 1 / maxShotLength; neededUltAmountDiv = 1 / neededUltAmount; rotateYUpLimitBy360toQuarternion = 360 - rotateYUpLimit; screenCenterPoint = new Vector3(Camera.main.pixelWidth / 2, Camera.main.pixelHeight / 2, Camera.main.nearClipPlane); anim = this.gameObject.GetComponent <Animator>(); SetActiveCtrls(); Debug.Log(photonView.ViewID + "네트워크 매니저에서 받아온 이름은 = " + NetworkManager.instance.Names[photonView.ViewID / 1000]); playerName = NetworkManager.instance.Names[photonView.ViewID / 1000]; if (photonView.IsMine) { for (int i = 0; i < heroRenderers.Length; i++) { heroRenderers[i].enabled = false; } InGameUIManager.Instance.SetTargetHero(this); Camera mainCam = Camera.main; mainCam.transform.SetParent(transform); mainCam.transform.SetPositionAndRotation(camPos.position, camPos.rotation); GameObject fpsCam = Resources.Load("hcp/FPSCamera") as GameObject; GameObject fpsCamIns = GameObject.Instantiate <GameObject>(fpsCam, mainCam.transform); if (fpsCam == null) { Debug.LogError("fpsCam 자체가 리소스에서 읽어오기 불가능."); } FPSCamPerHeroGO = GameObject.Instantiate <GameObject>(FPSCamPerHeroGO); if (FPSCamPerHeroGO == null) { Debug.LogError("fpsCam 히어로가 생성 불가능."); } Debug.Log("퍼히어로도 생성완료 " + FPSCamPerHeroGO.name); FPSCamPerHeroGO.transform.SetParent(fpsCamIns.transform); FPSCamPerHeroGO.transform.SetPositionAndRotation(FPSCamPerHeroGO.transform.parent.position, FPSCamPerHeroGO.transform.parent.rotation); FPSCamPerHero = FPSCamPerHeroGO.GetComponent <FPSCameraPerHero>(); if (FPSCamPerHero == null) { Debug.LogError("영웅별 fps cam 이 어태치 되지 않았음."); } } else { //내 것이 아님. rb.isKinematic = true; } }