// Use this for initialization void Start() { // if (Network.peerType != NetworkPeerType.Server) { // if (GameMovieCtrl.IsActivePlayer // || (!XkGameCtrl.GetInstance().IsCartoonShootTest/* && !XkGameCtrl.GetInstance().IsServerCameraTest*/)) { // gameObject.SetActive(false); // } // return; // } bool isOutputError = false; if (AiPathScript == null) { isOutputError = true; Debug.LogWarning("AiPathScript is null"); } else { if (AiPathScript.transform.childCount < 2) { isOutputError = true; Debug.LogWarning("AiPathScript.childCount was wrong"); } else { Transform tranMark = AiPathScript.transform.GetChild(0); transform.position = tranMark.position; transform.rotation = tranMark.rotation; } } // Rigidbody rig = GetComponent<Rigidbody>(); // if (rig == null) { // isOutputError = true; // Debug.LogError("PSZiYouMoveCamera cannot find Rigidbody"); // } // // BoxCollider box = GetComponent<BoxCollider>(); // if (box == null) { // isOutputError = true; // Debug.LogError("PSZiYouMoveCamera cannot find BoxCollider"); // } if (RealCamTran == null) { isOutputError = true; Debug.LogWarning("RealCamTran is null"); } else if (XkGameCtrl.GetInstance().IsCartoonShootTest) { RealCamera = RealCamTran.GetComponent <Camera>(); if (RealCamera == null) { isOutputError = true; Debug.LogWarning("PSZiYouMoveCamera cannot find RealCamera"); } else { RealCamera.tag = "MainCamera"; ZiYouCamera = RealCamTran.GetComponent <PSZiYouCameraCtrl>(); if (ZiYouCamera == null) { isOutputError = true; Debug.LogWarning("PSZiYouMoveCamera cannot find PSZiYouCameraCtrl"); } } RealCamTran.gameObject.SetActive(false); } else { RealCamera = RealCamTran.GetComponent <Camera>(); if (RealCamera != null) { RealCamera.enabled = false; } RealCamera = XkGameCtrl.ServerCameraObj.GetComponent <Camera>(); if (RealCamera == null) { isOutputError = true; Debug.LogWarning("PSZiYouMoveCamera cannot find RealCamera"); } else { RealCamera.tag = "MainCamera"; ZiYouCamera = RealCamTran.GetComponent <PSZiYouCameraCtrl>(); if (ZiYouCamera == null) { isOutputError = true; Debug.LogWarning("PSZiYouMoveCamera cannot find PSZiYouCameraCtrl"); } } RealCamTran.gameObject.SetActive(false); } if (isOutputError) { GameObject obj = null; obj.name = "null"; } gameObject.SetActive(false); }