// Use this for initialization
    void Start()
    {
        CamShakeCom          = gameObject.AddComponent <CameraShake>();
        PlayerCamera         = camera;
        camera.targetTexture = null;
        CameraTran           = transform;
        XkPlayerCtrl script = GetComponentInParent <XkPlayerCtrl>();

        switch (script.PlayerSt)
        {
        case PlayerTypeEnum.FeiJi:
            _InstanceFeiJi = this;
            PlayerSt       = PlayerTypeEnum.FeiJi;
            FeiJiCameraTan = transform;
            gameObject.SetActive(false);
            if (XkGameCtrl.GetInstance().m_CaiPiaoFlyData != null)
            {
                XkGameCtrl.GetInstance().m_CaiPiaoFlyData.m_CaiPiaoEndTrP1 = m_CaiPiaoEndTrP1;
                XkGameCtrl.GetInstance().m_CaiPiaoFlyData.m_CaiPiaoEndTrP2 = m_CaiPiaoEndTrP2;
                XkGameCtrl.GetInstance().m_CaiPiaoFlyData.m_CaiPiaoEndTrP3 = m_CaiPiaoEndTrP3;
            }
            break;

        case PlayerTypeEnum.TanKe:
            _InstanceTanKe = this;
            PlayerSt       = PlayerTypeEnum.TanKe;
            TanKeCameraTan = transform;
            gameObject.SetActive(false);
            break;

        case PlayerTypeEnum.CartoonCamera:
            _InstanceCartoon = this;
            PlayerSt         = PlayerTypeEnum.CartoonCamera;
            break;
        }

        CameraObj    = gameObject;
        PlayerScript = GetComponentInParent <XkPlayerCtrl>();
        if (PlayerScript != null)
        {
            PlayerScript.SetPlayerCamera(this);
        }

        GameObject obj = new GameObject();

        obj.name                   = "CameraParent";
        CameraParent               = obj.transform;
        CameraParent.parent        = CameraTran.parent;
        CameraParent.localPosition = CameraTran.localPosition;
        CameraParent.rotation      = CameraTran.rotation;
        CameraTran.parent          = null;
        CameraTran.rotation        = CameraParent.localRotation;
        SetEnableCamera(false);
        for (int i = 0; i < PlayerSpawnPoint.Length; i++)
        {
            PlayerSpawnPoint[i].gameObject.SetActive(false);
        }
    }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        PlayerCamera         = camera;
        camera.targetTexture = null;
        CameraTran           = transform;
        XkPlayerCtrl script = GetComponentInParent <XkPlayerCtrl>();

        switch (script.PlayerSt)
        {
        case PlayerTypeEnum.FeiJi:
            _InstanceFeiJi = this;
            PlayerSt       = PlayerTypeEnum.FeiJi;
            FeiJiCameraTan = transform;
            gameObject.SetActive(false);
            break;

        case PlayerTypeEnum.TanKe:
            _InstanceTanKe = this;
            PlayerSt       = PlayerTypeEnum.TanKe;
            TanKeCameraTan = transform;
            gameObject.SetActive(false);
            break;

        case PlayerTypeEnum.CartoonCamera:
            _InstanceCartoon = this;
            PlayerSt         = PlayerTypeEnum.CartoonCamera;
            break;
        }

        CameraObj    = gameObject;
        PlayerScript = GetComponentInParent <XkPlayerCtrl>();
        if (PlayerScript != null)
        {
            PlayerScript.SetPlayerCamera(this);
        }

        GameObject obj = new GameObject();

        obj.name                   = "CameraParent";
        CameraParent               = obj.transform;
        CameraParent.parent        = CameraTran.parent;
        CameraParent.localPosition = CameraTran.localPosition;
        CameraParent.rotation      = CameraTran.rotation;
        CameraTran.parent          = null;

        if (PlayerSt != PlayerTypeEnum.CartoonCamera)
        {
            SetEnableCamera(false);
        }
    }
Ejemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        CameraObj    = gameObject;
        PlayerCamera = GetComponent <Camera>();
        if (PlayerCamera != null)
        {
            PlayerCamera.targetTexture = null;
        }

        if (PlayerMainCamTmp != null && PlayerMainCamTmp.Length >= 2)
        {
            PlayerMainCameraTmp = new Camera[2];
            if (PlayerMainCamTmp[0] != null)
            {
                PlayerMainCameraTmp[0] = PlayerMainCamTmp[0].GetComponent <Camera>();
//			    if (XkGameCtrl.GetInstance().IsOpenVR) {
//				    PlayerMainCamTmp[0].SetActive(false);
//			    }
            }

            if (PlayerMainCamTmp[1] != null)
            {
                PlayerMainCameraTmp[1] = PlayerMainCamTmp[1].GetComponent <Camera>();
//			    if (XkGameCtrl.GetInstance().IsOpenVR) {
//				    PlayerMainCamTmp[1].SetActive(false);
//			    }
            }
        }

        CameraTran   = transform;
        PlayerScript = GetComponentInParent <XkPlayerCtrl>();
        switch (PlayerScript.PlayerSt)
        {
        case PlayerTypeEnum.FeiJi:
            _InstanceFeiJi = this;
            PlayerSt       = PlayerTypeEnum.FeiJi;
            FeiJiCameraTan = transform;
            if (!XkGameCtrl.IsTiaoGuoStartCartoon)
            {
                CameraObj.SetActive(false);
            }
//			else {
//				CameraObj.SetActive(XkGameCtrl.GetInstance().IsOpenVR);
//			}
            break;

        case PlayerTypeEnum.TanKe:
            _InstanceTanKe = this;
            PlayerSt       = PlayerTypeEnum.TanKe;
            TanKeCameraTan = transform;
            CameraObj.SetActive(false);
            break;

        case PlayerTypeEnum.CartoonCamera:
            _InstanceCartoon = this;
            PlayerSt         = PlayerTypeEnum.CartoonCamera;
            if (XkGameCtrl.IsTiaoGuoStartCartoon)
            {
                CameraObj.SetActive(false);
            }
            break;
        }

        if (PlayerSt != PlayerTypeEnum.CartoonCamera)
        {
            XkGameCtrl.GetInstance().ChangeAudioListParent();
        }

        if (PlayerScript != null)
        {
            PlayerScript.SetPlayerCamera(this);
        }

        GameObject obj = new GameObject();

        obj.name                   = "CameraParent";
        CameraParent               = obj.transform;
        CameraParent.parent        = CameraTran.parent;
        CameraParent.localPosition = CameraTran.localPosition;
        CameraParent.rotation      = CameraTran.rotation;
        CameraTran.parent          = null;

        if (PlayerSt != PlayerTypeEnum.CartoonCamera)
        {
            if (!XkGameCtrl.IsTiaoGuoStartCartoon)
            {
                SetEnableCamera(false);
            }

            if (XkGameCtrl.IsActivePlayerOne)
            {
                IndexPlayerNum = -1;
                TestChangePlayerCamera();
            }
            else
            {
                IndexPlayerNum = 0;
                TestChangePlayerCamera();
            }
        }
        XKGlobalData.GetInstance().PlayGuanKaBeiJingAudio();
    }