예제 #1
0
    public void ActivePlayerCamera()
    {
        bool          isEnable = true;
        GameJiTaiType jiTai    = XkGameCtrl.GameJiTaiSt;

        if (XkGameCtrl.GameModeVal == GameMode.LianJi && Network.peerType != NetworkPeerType.Disconnected)
        {
            switch (jiTai)
            {
            case GameJiTaiType.FeiJiJiTai:
                if (PlayerSt == PlayerTypeEnum.TanKe)
                {
                    isEnable = false;
                }
                break;

            case GameJiTaiType.TanKeJiTai:
                if (PlayerSt == PlayerTypeEnum.FeiJi)
                {
                    isEnable = false;
                }
                break;
            }
        }
        isEnable = false;
        Debug.Log("ActivePlayerCamera -> player " + PlayerSt + ", isEnable " + isEnable + ", jiTai " + jiTai);
        if (PlayerCamera != null)
        {
            PlayerCamera.enabled = isEnable;
        }
    }
예제 #2
0
    public void SetCameraMapState()
    {
        CameraCom.enabled = !CameraCom.enabled;
        if (!CameraCom.enabled)
        {
            GameJiTaiType jiTai = XkGameCtrl.GameJiTaiSt;
            switch (jiTai)
            {
            case GameJiTaiType.FeiJiJiTai:
                XKPlayerCamera.GetInstanceTanKe().SetEnableCamera(false);
                break;

            case GameJiTaiType.TanKeJiTai:
                XKPlayerCamera.GetInstanceFeiJi().SetEnableCamera(false);
                break;
            }
        }
        else
        {
            GameJiTaiType jiTai = XkGameCtrl.GameJiTaiSt;
            switch (jiTai)
            {
            case GameJiTaiType.FeiJiJiTai:
                XKPlayerCamera.GetInstanceTanKe().SetEnableCamera(true);
                break;

            case GameJiTaiType.TanKeJiTai:
                XKPlayerCamera.GetInstanceFeiJi().SetEnableCamera(true);
                break;
            }
        }
    }
    public void SetEnableCamera(bool isEnable)
    {
        if (XkGameCtrl.GameModeVal == GameMode.LianJi && Network.peerType != NetworkPeerType.Disconnected)
        {
            GameJiTaiType jiTai = XkGameCtrl.GameJiTaiSt;
            switch (jiTai)
            {
            case GameJiTaiType.FeiJiJiTai:
                if (PlayerSt == PlayerTypeEnum.TanKe)
                {
                    isEnable = false;
                }
                break;

            case GameJiTaiType.TanKeJiTai:
                if (PlayerSt == PlayerTypeEnum.FeiJi)
                {
                    isEnable = false;
                }
                break;
            }
        }
        Debug.Log("SetEnableCamera -> player " + PlayerSt + ", isEnable " + isEnable);
        PlayerCamera.enabled = isEnable;
    }
    void InitPlayerDanYaoInfo()
    {
        HuoLiJQSprite.gameObject.SetActive(false);
        DaoDanSprite.gameObject.SetActive(false);

        GameJiTaiType jiTaiType = XkGameCtrl.GameJiTaiSt;

        switch (jiTaiType)
        {
        case GameJiTaiType.FeiJiJiTai:
            GaoBaoTextureCom.mainTexture = DanYaoFJ[0];
            DaoDanTextureCom.mainTexture = DanYaoFJ[2];
            break;

        case GameJiTaiType.TanKeJiTai:
            GaoBaoTextureCom.mainTexture = DanYaoTK[0];
            DaoDanTextureCom.mainTexture = DanYaoTK[2];
            break;
        }
        ShowJiQiangAmmoNum();

        if (Network.peerType == NetworkPeerType.Server)
        {
            gameObject.SetActive(false);
        }
    }
    public void ActivePlayerCamera()
    {
        bool          isEnable = true;
        GameJiTaiType jiTai    = XkGameCtrl.GameJiTaiSt;

        if (XkGameCtrl.GameModeVal == GameMode.LianJi && Network.peerType != NetworkPeerType.Disconnected)
        {
            switch (jiTai)
            {
            case GameJiTaiType.FeiJiJiTai:
                if (PlayerSt == PlayerTypeEnum.TanKe)
                {
                    isEnable = false;
                }
                break;

            case GameJiTaiType.TanKeJiTai:
                if (PlayerSt == PlayerTypeEnum.FeiJi)
                {
                    isEnable = false;
                }
                break;
            }
        }
        //Debug.Log("Unity:"+"ActivePlayerCamera -> player "+PlayerSt+", isEnable "+isEnable+", jiTai "+jiTai);
        PlayerCamera.enabled = isEnable;

        //if (isEnable)
        //{
        //    XkGameCtrl.TestDelayActivePlayerOne();
        //}
    }
    public void SetActiveCamera(bool isActive)
    {
        CameraObj.SetActive(isActive);
        if (XkGameCtrl.GameModeVal == GameMode.LianJi && !XKCameraMapCtrl.GetInstance().GetActiveCameraMap())
        {
            GameJiTaiType jiTai = XkGameCtrl.GameJiTaiSt;
            switch (jiTai)
            {
            case GameJiTaiType.FeiJiJiTai:
                if (PlayerSt == PlayerTypeEnum.TanKe)
                {
                    isActive = false;
                }
                break;

            case GameJiTaiType.TanKeJiTai:
                if (PlayerSt == PlayerTypeEnum.FeiJi)
                {
                    isActive = false;
                }
                break;
            }
        }

        if (isActive && !ScreenDanHeiCtrl.IsStartGame && PlayerSt != PlayerTypeEnum.CartoonCamera)
        {
            isActive = false;
        }
        //Debug.Log("Unity:"+"SetActiveCamera -> player "+PlayerSt+", isEnable "+isActive);
        PlayerCamera.enabled = isActive;
    }
    public void ShowDaoDanSprite()
    {
        if (Network.peerType == NetworkPeerType.Server)
        {
            return;
        }

        if (!gameObject.activeSelf)
        {
            return;
        }

        if (DaoDanSprite.gameObject.activeSelf)
        {
            return;
        }

        GameJiTaiType jiTaiType = XkGameCtrl.GameJiTaiSt;

        switch (PlayerSt)
        {
        case PlayerEnum.PlayerOne:
            if (jiTaiType == GameJiTaiType.FeiJiJiTai)
            {
                DaoDanSprite.spriteName = "1PDaoDan";
            }
            else if (jiTaiType == GameJiTaiType.TanKeJiTai)
            {
                DaoDanSprite.spriteName = "1PPaoDan";
            }
            break;

        case PlayerEnum.PlayerTwo:
            if (jiTaiType == GameJiTaiType.FeiJiJiTai)
            {
                DaoDanSprite.spriteName = "2PDaoDan";
            }
            else if (jiTaiType == GameJiTaiType.TanKeJiTai)
            {
                DaoDanSprite.spriteName = "2PPaoDan";
            }
            break;
        }
        DaoDanSprite.fillAmount = 0f;
        DaoDanSprite.gameObject.SetActive(true);
        StartCoroutine(ChangeDaoDanSpriteAmount());
    }
    void ShowGaoBaoAmmoNum()
    {
        if (AmmoGaoBao[1].enabled && !AmmoGaoBao[2].enabled)
        {
            return;
        }
        AmmoGaoBao[0].enabled = true;
        AmmoGaoBao[1].enabled = true;
        AmmoGaoBao[2].enabled = false;

        GameJiTaiType jiTaiType = XkGameCtrl.GameJiTaiSt;

        switch (jiTaiType)
        {
        case GameJiTaiType.FeiJiJiTai:
            GaoBaoTextureCom.mainTexture = DanYaoFJ[1];
            break;

        case GameJiTaiType.TanKeJiTai:
            GaoBaoTextureCom.mainTexture = DanYaoTK[1];
            break;
        }
    }
    // Use this for initialization
    void Start()
    {
        _Instance                 = this;
        Time.timeScale            = 1.0f;
        IsOpenSetPanel            = true;
        XkGameCtrl.IsLoadingLevel = false;

        XkGameCtrl.ResetIsLoadingLevel();
        if (pcvr.GetInstance() != null)
        {
            pcvr.GetInstance().CloseFangXiangPanPower(PlayerEnum.Null);
        }
        pcvr.CloseAllQiNangArray(1);
        pcvr.OpenPlayerGunZhenDong();
        if (GameMovieCtrl.IsActivePlayer)
        {
            if (GameTypeCtrl.AppTypeStatic == AppGameType.DanJiFeiJi ||
                GameTypeCtrl.AppTypeStatic == AppGameType.LianJiFeiJi)
            {
                GameJiTai = GameJiTaiType.FeiJiJiTai;
            }

            if (GameTypeCtrl.AppTypeStatic == AppGameType.DanJiTanKe ||
                GameTypeCtrl.AppTypeStatic == AppGameType.LianJiTanKe)
            {
                GameJiTai = GameJiTaiType.TanKeJiTai;
            }

            if (GameTypeCtrl.AppTypeStatic == AppGameType.LianJiServer ||
                GameTypeCtrl.AppTypeStatic == AppGameType.Null)
            {
                GameJiTai = GameJiTaiType.Null;
            }
        }
        GameOverCtrl.IsShowGameOver = false;
        pcvr.OpenDongGanState();
        pcvr.StartLightStateP1 = LedState.Mie;
        pcvr.StartLightStateP2 = LedState.Mie;
        XkGameCtrl.SetActivePlayerOne(false);
        XkGameCtrl.SetActivePlayerTwo(false);

        switch (GameJiTai)
        {
        case GameJiTaiType.TanKeJiTai:
            TanKeStarPos    = TankStarPosTmp;
            SetPanelStarPos = TanKeStarPos;
            break;

        case GameJiTaiType.FeiJiJiTai:
            FeiJiStarPos    = TankStarPosTmp;
            SetPanelStarPos = FeiJiStarPos;
            break;
        }
        StarObj = StarTran.gameObject;
        SetStarObjActive(true);

        InitHandleJson();
        InitStarImgPos();
        InitGameAudioValue();
        InitCoinStartLabel();
        InitGameDiffDuiGou();
        InitGameModeDuiGou();
        InitGunZDInfo();
        InitDianJiSpeedInfo();
        SetGameLanguageVal();

        InputEventCtrl.GetInstance().ClickSetEnterBtEvent       += ClickSetEnterBtEvent;
        InputEventCtrl.GetInstance().ClickSetMoveBtEvent        += ClickSetMoveBtEvent;
        InputEventCtrl.GetInstance().ClickFireBtOneEvent        += ClickFireBtOneEvent;
        InputEventCtrl.GetInstance().ClickFireBtTwoEvent        += ClickFireBtTwoEvent;
        InputEventCtrl.GetInstance().ClickStartBtOneEvent       += ClickStartBtEventP1;
        InputEventCtrl.GetInstance().ClickStartBtTwoEvent       += ClickStartBtEventP2;
        InputEventCtrl.GetInstance().ClickDaoDanBtOneEvent      += ClickDaoDanBtOneEvent;
        InputEventCtrl.GetInstance().ClickDaoDanBtTwoEvent      += ClickDaoDanBtTwoEvent;
        InputEventCtrl.GetInstance().ClickStopDongGanBtOneEvent += ClickStopDongGanBtOneEvent;
    }
    // Use this for initialization
    void Start()
    {
        _Instance = this;
        if (GameMovieCtrl.IsActivePlayer)
        {
            IsOpenVR = GameMovieCtrl.IsOpenVR;
        }

        if (IsOpenVR)
        {
            if (GameMovieCtrl.IsHaveDisplayTV)
            {
                VRCameraTr.gameObject.SetActive(false);
            }
            else
            {
                Transform trRoot = transform.root;
                trRoot.parent        = VRCameraTr;
                trRoot.localPosition = new Vector3(0f, 0f, 3f);
            }
        }
        else
        {
            VRCameraTr.gameObject.SetActive(false);
        }
        AudioListener.volume = 1f;
        Time.timeScale       = 1.0f;

        XkGameCtrl.ResetIsLoadingLevel();
//		if (pcvr.GetInstance() != null) {
//			pcvr.GetInstance().CloseFangXiangPanPower(PlayerEnum.Null);
//		}
        pcvr.CloseAllQiNangArray();
//		pcvr.OpenPlayerGunZhenDong();
        if (GameMovieCtrl.IsActivePlayer)
        {
            if (GameTypeCtrl.AppTypeStatic == AppGameType.DanJiFeiJi ||
                GameTypeCtrl.AppTypeStatic == AppGameType.LianJiFeiJi)
            {
                GameJiTai = GameJiTaiType.FeiJiJiTai;
            }

            if (GameTypeCtrl.AppTypeStatic == AppGameType.DanJiTanKe ||
                GameTypeCtrl.AppTypeStatic == AppGameType.LianJiTanKe)
            {
                GameJiTai = GameJiTaiType.TanKeJiTai;
            }

            if (GameTypeCtrl.AppTypeStatic == AppGameType.LianJiServer ||
                GameTypeCtrl.AppTypeStatic == AppGameType.Null)
            {
                //GameJiTai = GameJiTaiType.FeiJiJiTai;
                GameJiTai = GameJiTaiType.TanKeJiTai;
            }
        }
        GameOverCtrl.IsShowGameOver = false;
        pcvr.DongGanState           = 1;
        pcvr.StartLightStateP1      = LedState.Mie;
        pcvr.StartLightStateP2      = LedState.Mie;
        XkGameCtrl.SetActivePlayerOne(false);
        XkGameCtrl.SetActivePlayerTwo(false);

        switch (GameJiTai)
        {
        case GameJiTaiType.TanKeJiTai:
            TanKeStarPos    = TankStarPosTmp;
            SetPanelStarPos = TanKeStarPos;
            break;

        case GameJiTaiType.FeiJiJiTai:
            FeiJiStarPos    = TankStarPosTmp;
            SetPanelStarPos = FeiJiStarPos;
            break;
        }
        StarObj = StarTran.gameObject;
        SetStarObjActive(true);

        InitHandleJson();
        InitStarImgPos();
        InitGameAudioValue();
        InitCoinStartLabel();
        InitGameDiffDuiGou();
        InitGameModeDuiGou();
        InitGunZDInfo();
        SetGameLanguageVal();

        InputEventCtrl.GetInstance().ClickSetEnterBtEvent       += ClickSetEnterBtEvent;
        InputEventCtrl.GetInstance().ClickSetMoveBtEvent        += ClickSetMoveBtEvent;
        InputEventCtrl.GetInstance().ClickFireBtOneEvent        += ClickFireBtOneEvent;
        InputEventCtrl.GetInstance().ClickFireBtTwoEvent        += ClickFireBtTwoEvent;
        InputEventCtrl.GetInstance().ClickStartBtOneEvent       += ClickStartBtEventP1;
        InputEventCtrl.GetInstance().ClickStartBtTwoEvent       += ClickStartBtEventP2;
        InputEventCtrl.GetInstance().ClickDaoDanBtOneEvent      += ClickDaoDanBtOneEvent;
        InputEventCtrl.GetInstance().ClickDaoDanBtTwoEvent      += ClickDaoDanBtTwoEvent;
        InputEventCtrl.GetInstance().ClickStopDongGanBtOneEvent += ClickStopDongGanBtOneEvent;
    }