Example #1
0
    //    private static AudioManager audioMgr;
    //    public static AudioManager Audio{
    //        get { return audioMgr; }
    //    }
    void Awake()
    {
        gameMgr = GetComponent<CGameManager>();
        enemyMgr = GetComponent<CEnemyManager>();
        spriteMgr = GetComponent<CSpriteManager>();
        //		audioMgr = GetComponent<AudioManager>();

        DontDestroyOnLoad(gameObject);
    }
Example #2
0
    private void Awake()
    {
        if (_pInstance == null)
        {
            _pInstance = this;
        }
        else
        {
            Destroy(gameObject);
        }

        Screen.SetResolution(720, 1280, true);
    }
Example #3
0
    void GameMessageIn(string msg, int delay, ArcaletScene scene)
    {
        try {
            Debug.Log("@ GameMsg>> " + msg);
            string[]     cmds = msg.Split(':');
            CGameManager game = FindObjectOfType(typeof(CGameManager)) as CGameManager;
            if (game == null)
            {
                return;
            }

            switch (cmds[0])
            {
            case "bb_move":
                game.player_move(cmds[1]);
                break;

            case "bb_stop":
                game.player_stop(cmds[1]);
                break;

            case "bb_player":
                game.add_player(cmds[1]);
                break;

            case "bb_wball":
                game.bb_wball(cmds[1]);
                break;

            case "bb_death":
                game.handle_death_message(cmds[1]);
                break;

            case "bb_over":
                //game.
                break;

            default:
                break;
                //	case "dp_start": game.GameStart(cmds[1]); break;
                //	case "dp_player": game.SetRevalInfos(cmds[1]); break;
                //	case "dp_slot": game.FillSlot(cmds[1]); break;
                //	case "dp_gameover": game.DP_GameOver(cmds[1]); break;
                //	case "dp_draw": game.DP_Draw(cmds[1]); break;
                //	case "dp_timeup": game.DP_TiemUP(cmds[1]); break;
                //	case "dp_sync" : game.TimerSynchronization(cmds[1], delay); break;
            }
        }
        catch (Exception e) { Debug.LogWarning("GameMessageIn Exception:\r\n" + e.ToString()); }
    }
Example #4
0
    private void Awake()
    {
        if (instance == null)
        {
            instance    = this;
            _hudManager = FindObjectOfType <CHudManager>();
            highScore   = PlayerPrefs.GetInt("HighScore", 0);
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);
    }
Example #5
0
 public static Int32 ExitGame(String message)
 {
     try
     {
         Program.client.Disconnect();
         Process Process = Process.ThisProcess();
         zCOption.GetOption(Process).getSection("INTERNAL").getEntry("gameAbnormalExit").VarValue.Set("0");
         zCOption.GetOption(Process).Save("Gothic.INI");
         CGameManager.GameManager(Process).ExitGameVar = 1;
     }
     catch (Exception ex)
     {
         zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', ex.ToString(), 0, "hGame.cs", 0);
     }
     return(0);
 }
Example #6
0
    public static CGameManager instance = null; //static - the same variable is shared by all instances of the class that are created, and can be private, protected or public.
    #endregion

    private void Awake()
    {
        //Check if instance already exists
        if (instance == null)
        {
            //if not, set instance to this
            instance = this;
        }

        //If instance already exists and it's not this:
        else if (instance != this)
        {
            //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a CLoadListData
            Destroy(gameObject);
        }
    }
Example #7
0
    //대상 추적하기
    void SearchTarget()
    {
        MoveUnit();

        //추적할 대상이 없음
        CUnit enemy = CGameManager.GetInstance().GetEnemy(this);

        if (enemy == null || !enemy.IsLive())
        {
            if (mTarget == null)
            {
                SetStatus(UNIT_STATUS.US_MOVE);
            }
            else
            {
                if (mTarget.GetDistanceSq(this) > (mSight * mSight))
                {
                    mTarget = null;
                    SetStatus(UNIT_STATUS.US_MOVE);
                }
                else
                {
                    SetStatus(UNIT_STATUS.US_TRACE);
                }
            }

            return;
        }

        //대상이 있으면 추적으로 설정하기
        mTarget = enemy;

        if (mTarget.GetDistanceSq(this) > (mSight * mSight))
        {
            mTarget = null;
            SetStatus(UNIT_STATUS.US_MOVE);
        }
        else
        {
            mTargetPos = mTarget.GetPos();

            mMoveDirection = mTargetPos - GetPos();
            mMoveDirection.Normalize();

            SetStatus(UNIT_STATUS.US_MOVE_TARGET);
        }
    }
Example #8
0
    // Update is called once per frame
    void FixedUpdate()
    {
        if (is_TitleShow)
        {
            On_Title();
        }

        if (is_ButtonShow)
        {
            On_Button();
        }

        if (CGameManager.rewiredPlayer1.GetButtonDown("Select"))
        {
            CGameManager.PlaySoundFX(CGameManager.fxSounds.select);
            SceneManager.LoadScene("MainMenu");
        }
    }
    protected const float TAKE_BALL_SPACE = 10.0f;                              // AIがボールを取りに行く距離

    //----------------------------------------------------------------------
    // コンストラクタ
    //----------------------------------------------------------------------
    // @Param   none
    // @Return  none
    // @Date    2014/12/7  @Update 2014/12/7  @Author T.Takeuchi
    //----------------------------------------------------------------------
    protected void CGoalKeeperInit(int teamNo)
    {
        this.Init();

        // プレイヤーのデータをセット
        if (teamNo == 0)
        {
            CPlayerManager.SetPlayerData(this.m_playerData, CPlayerManager.AI_2);
        }
        else
        {
            CPlayerManager.SetPlayerData(this.m_playerData, CPlayerManager.AI_4);
        }
        m_pos = this.transform.localPosition;

        // 国の情報をセット / 国によってマテリアルを変更
        m_human = CHumanManager.GetWorldInstance(TeamData.teamNationality[teamNo]);
        if (teamNo == 0)
        {
            this.transform.FindChild("polySurface14").GetComponent <CGoalKeeper1Mesh>().ChangeMaterial(TeamData.teamNationality[0]);
        }
        else
        {
            this.transform.FindChild("polySurface14").GetComponent <CGoalKeeper2Mesh>().ChangeMaterial(TeamData.teamNationality[1]);
        }
        // CPU用の値をセット
        this.SetData();

        // サッカーボールの情報を取得
        this.soccerBallObject = GameObject.Find("SoccerBall");

        // プレイヤーのアニメーターをセット
        m_animator = this.gameObject.transform.parent.GetComponent <CPlayerAnimator>();

        // 向きをセット
        this.transform.LookAt(new Vector3(0.0f, 0.0f, 0.0f));

        // ホームポジションをセット
        this.HOME_POSITION = new Vector3(this.m_playerData.m_xPos, this.m_playerData.m_yPos, this.m_playerData.m_zPos);

        // ゲームマネージャをセット
        this.gameManager = GameObject.Find("GameManager").GetComponent <CGameManager>();
    }
Example #10
0
    private void Awake()
    {
        if (Instance != null)
        {
            DestroyImmediate(gameObject);
            return;
        }
//		if(PlayerPrefs.GetInt(keyLevelNow) == 0) {
//			PlayerPrefs.SetInt(keyLevelNow, 1);
//		}
//		if(PlayerPrefs.GetInt(keyLevelMax) == 0) {
//			PlayerPrefs.SetInt(keyLevelMax, 1);
//		}
//		if(PlayerPrefs.GetInt(keyNumberLevel) == 0) {
//			PlayerPrefs.SetInt(keyNumberLevel, 10);
//		}
        Instance = this;
        DontDestroyOnLoad(gameObject);
    }
Example #11
0
    // Update is called once per frame
    void Update()
    {
        if (mTarget.GetStatus() == CUnit.UNIT_STATUS.US_DYING)
        {
            Destroy(gameObject);
            return;
        }

        Vector3 pos = mTarget.GetPos() * CGameScaller.GetInstance().GetScale();

        pos  -= CGameManager.GetInstance().GetPos();
        pos.z = 1.0f;

        pos   *= 1.0f / CUIManager.GetInstance().GetScaleFactor();
        pos.y += 25;

        SetPos(pos.x, pos.y);

        SetValue(mTarget.GetHpPercent());
    }
    private void Awake()
    {
        _startPanel  = GameObject.Find("StartPanel");
        _connectMsg  = GameObject.Find("ConnectMsg").GetComponent <Text>();
        _nameInput   = GameObject.Find("NameInputField").GetComponent <InputField>();
        _gameManager = FindObjectOfType <CGameManager>();
        _join        = GameObject.Find("JoinButton").GetComponent <Button>();

        if (!PhotonNetwork.connected)
        {
            if (PhotonNetwork.ConnectUsingSettings("v1.0"))
            {
                _connectMsg.text = "Attempting to connect server...";
            }
            else
            {
                _connectMsg.text = "Failed to connect server";
            }
        }
    }
Example #13
0
    //-----------------------------------------------------------------
    // Use this for initialization
    void Start()
    {
        mInstance  = this;
        mTransform = gameObject.transform;

        InitBulletList();

        mUnitRootTransform = mUnitRoot.transform;

        SpawnPlayer(107, 306);
        SpawnEnemy(959, 306);

        Camera camera = gameObject.GetComponent <Camera>();

        camera.orthographicSize = Screen.height / 2;

        mTileMap = mTilemapBg.GetComponent <Tilemap>();

        mMapManager = new CMapManager();
        mMapManager.Init(mTileMap);
    }
Example #14
0
            public static void ReadLoadWorld(PacketReader stream)
            {
                if (current != null)
                {
                    current.ForEachVob(v => v.Despawn());
                    current.Delete();
                }

                current = ScriptManager.Interface.CreateWorld();

                current.ID = 0;
                current.Create();

                current.ReadStream(stream);
                if (stream.ReadBit())
                {
                    current.Clock.ScriptObject.Start();
                }
                current.WeatherCtrl.ScriptObject.SetWeatherType(current.WeatherCtrl.WeatherType);
                current.WeatherCtrl.ScriptObject.SetNextWeight(current.WeatherCtrl.EndTime, current.WeatherCtrl.EndWeight);
                current.BarrierCtrl.ScriptObject.SetNextWeight(current.BarrierCtrl.EndTime, current.BarrierCtrl.EndWeight);

                Hooks.hGame.FirstRenderDone = false;
                current.ScriptObject.Load();

                var hero = oCNpc.GetPlayer();

                if (hero.Address != 0)
                {
                    hero.Disable();
                    GothicGlobals.Game.GetWorld().RemoveVob(hero);
                }

                PacketWriter confirmation = GameClient.SetupStream(ClientMessages.WorldLoadedMessage);

                GameClient.Send(confirmation, NetPriority.Immediate, NetReliability.Reliable);

                CGameManager.ApplySomeSettings();
            }
Example #15
0
    private bool DoAttack(Vector3 targetPos)
    {
        //공격가능한 상태가 아닌가?
        if (!CheckAttackable())
        {
            return(false);
        }

        mCurrentMovingDelay = mMovingDelay;

        Vector3 pos = GetPos();

        pos += mMoveDirection * 10;


        CGameManager.GetInstance().CreateEnemyBullet(pos.x, pos.y, targetPos.x, targetPos.y);

        SetStatus(UNIT_STATUS.US_ATTACK);
        mAttackDelay        = mAttackTime;
        mCurrentAttackSpeed = mAttackSpeed;
        return(true);
    }
Example #16
0
    private void Awake()
    {
        mgr = GameObject.FindGameObjectWithTag("MainManager").GetComponent <CGameManager>();
        mgr.enableTimeUpdate = false;
        mgr.defaultUiCtrl.gameObject.SetActive(false);

        if (name == CharacterNames.miho)
        {
            myDataInit(0.0f, 1.5f, 3.1f, 5.5f);
            PlayMihoSpine();
        }
        else if (name == CharacterNames.agni)
        {
            myDataInit(0.0f, 0.2f, 3.6f, 4.8f);
            PlayAgniSpine();
        }
        else if (name == CharacterNames.valkiri)
        {
            myDataInit(0.0f, 2.16f, 4.3f, 6.0f);
            PlayValkiriSpine();
        }
    }
Example #17
0
    //----------------------------------------
    private void SetMoveRandomTargetPos()
    {
        if (GetStatus() == UNIT_STATUS.US_MOVE_TARGET)
        {
            return;
        }

        Vector3 unitPos = GetPos();
        Vector3 pos     = unitPos;

        pos.x += ((2.0f * Random.value) - 1.0f) * 500.0f;
        pos.y += ((2.0f * Random.value) - 1.0f) * 500.0f;

        CGameManager.GetInstance().GetMapManager().ValidatePos(ref pos);

        mTargetPos = pos;

        mMoveDirection = mTargetPos - unitPos;
        mMoveDirection.Normalize();
        mSpeedScale = 1.5f;
        SetStatus(UNIT_STATUS.US_MOVE_TARGET);
    }
Example #18
0
    public void Start()
    {
        CGameManager.OnInitAudioSystem(false);
        curIdx = 0;
        OnImage(curIdx);
        timer    = 0.0f;
        Input_on = true;

        int        ran  = Random.Range(0, bgObjs.Length);
        GameObject temp = (GameObject)Instantiate(bgObjs[ran].map);

        temp.transform.localPosition = bgObjs[ran].position;

        temp = (GameObject)Instantiate(bgObjs[ran].uiName);
        temp.transform.parent        = mapCanvas.transform;
        temp.transform.localPosition = bgObjs[ran].position; //Vector2.zero;
        temp.transform.localScale    = Vector3.one;

        if (bgObjs[ran].particle != null) // 나중에 지우기 조건 연상 비용 큼..
        {
            temp = (GameObject)Instantiate(bgObjs[ran].particle);
        }
    }
Example #19
0
 public override void FixedUpdateGOF()
 {
     if (!enableInput)
     {
         axisTimer += Time.fixedDeltaTime;
         if (axisTimer > axisWaitingTime)
         {
             enableInput = true;
         }
     }
     else
     {
         if (CGameManager.rewiredPlayer1.GetAxis("Move Vertical") < 0)
         {
             CGameManager.PlaySoundFX(CGameManager.fxSounds.move);
             curIdx++;
             if (curIdx >= buttonImgs.Length)
             {
                 curIdx = 0;
             }
             OnImage(curIdx, ref buttonImgs);
             ReseMyEnableTime();
         }
         else if (CGameManager.rewiredPlayer1.GetAxis("Move Vertical") > 0)
         {
             CGameManager.PlaySoundFX(CGameManager.fxSounds.move);
             curIdx--;
             if (curIdx < 0)
             {
                 curIdx = buttonImgs.Length - 1;
             }
             OnImage(curIdx, ref buttonImgs);
             ReseMyEnableTime();
         }
     }
     PauseMenuSelect();
 }
Example #20
0
    private void PlayWithEffects(BasicMoveInfo basicMove, bool stun)
    {
        if (basicMove == null)
        {
            Debug.Log("ㅇㅅㅇ");
        }

        if (CSceneManager.Instance.MyRandom(basicMove.soundPlayRandomValue))
        {
            CGameManager.PlaySoundFX(basicMove.soundEffects);
        }

        if (basicMove.hitEffect.prefab != null)
        {
            if (stun)
            {
                GameObject stunnedParticle = (GameObject)Instantiate(basicMove.hitEffect.prefab);
                stunnedParticle.transform.parent = GetOwnerPartObject(basicMove.hitEffect.bodyPart).transform;
                Vector3 newPos = new Vector3(-0.4f, 0, 0);
                newPos.z += basicMove.hitEffect.positionOffSet.z;
                stunnedParticle.transform.localPosition = newPos;
                stunnedParticle.transform.localRotation = Quaternion.Euler(new Vector3(0, -90, 0));
                stunnedParticle.transform.localScale    = new Vector3(0.5f, 0.5f, 0.5f);

                Destroy(stunnedParticle, CSceneManager.Instance.hurtOptions.strongStunnedMaxTime);
            }
            else
            {
                GameObject temp   = (GameObject)Instantiate(basicMove.hitEffect.prefab);
                Vector3    newPos = playerScript.myHitScript.GetPosition(basicMove.hitEffect.bodyPart);
                newPos.x += basicMove.hitEffect.positionOffSet.x * playerScript.mirror;
                newPos.y += basicMove.hitEffect.positionOffSet.y;
                newPos.z += basicMove.hitEffect.positionOffSet.z;
                temp.transform.position = newPos;
            }
        }
    }
 public void Initialize()
 {
     this.bProfileLeftHandFlag = ApplicationDataManager.instance.GetPlayerHandednessIsLefty();
     this._rangeMarkersSlider.GetComponent <EventTrigger>().triggers[0].callback.AddListener((BaseEventData arg0) => this._rangeMarkersSlider.@value           = (this._rangeMarkersSlider.@value < 1f ? 1f : 0f));
     this._centerlineSlider.GetComponent <EventTrigger>().triggers[0].callback.AddListener((BaseEventData arg0) => this._centerlineSlider.@value               = (this._centerlineSlider.@value < 1f ? 1f : 0f));
     this._dispersionCirclesSlider.GetComponent <EventTrigger>().triggers[0].callback.AddListener((BaseEventData arg0) => this._dispersionCirclesSlider.@value = (this._dispersionCirclesSlider.@value < 1f ? 1f : 0f));
     this._mainDistanceSlider.GetComponent <EventTrigger>().triggers[0].callback.AddListener((BaseEventData arg0) => this._mainDistanceSlider.@value           = (this._mainDistanceSlider.@value < 1f ? 1f : 0f));
     this._shotDispersionSlider.GetComponent <EventTrigger>().triggers[0].callback.AddListener((BaseEventData arg0) => this._shotDispersionSlider.@value       = (this._shotDispersionSlider.@value < 1f ? 1f : 0f));
     this._handnessSlider.GetComponent <EventTrigger>().triggers[0].callback.AddListener((BaseEventData arg0) => this._handnessSlider.@value = (this._handnessSlider.@value < 1f ? 1f : 0f));
     this._shotSpinSlider.GetComponent <EventTrigger>().triggers[0].callback.AddListener((BaseEventData arg0) => this._shotSpinSlider.@value = (this._shotSpinSlider.@value < 1f ? 1f : 0f));
     this._gameManager = CGameManager.instance;
     this._cameraAngleDropdown.options = (
         from option in this._cameraAngles
         select new Dropdown.OptionData(option)).ToList <Dropdown.OptionData>();
     this._tracersDropdown.options = (
         from option in this._tracers
         select new Dropdown.OptionData(option)).ToList <Dropdown.OptionData>();
     this._conditionsDropdown.options = (
         from option in this._groundConditions
         select new Dropdown.OptionData(option)).ToList <Dropdown.OptionData>();
     this._windDirectionDropdown.options = (
         from option in this._windDirections
         select new Dropdown.OptionData(option)).ToList <Dropdown.OptionData>();
     this._windSpeedDropdown.options = (
         from option in this._windSpeeds
         select new Dropdown.OptionData(option)).ToList <Dropdown.OptionData>();
     this._humidityDropdown.options = (
         from option in this._humidity
         select new Dropdown.OptionData(option)).ToList <Dropdown.OptionData>();
     this.LoadDefaults();
     this.TryLoadSessionSettingsFromPlayerPrefs();
     this.SetFromCurrentSettings();
     this.BlockCertainItemsDependingOnGameMode();
     this.SetMembershipFlags();
     this.SetCameraInternal(false);
     this._initialized = true;
 }
 //키 디스플레이
 public override void CheckKeyDisplayPanelInput()
 {
     if ((gameMgr.P1_Left.player.GetButtonDown("Select") ||
          gameMgr.P2_Right.player.GetButtonDown("Select")) && Input_on)
     {
         CGameManager.PlaySoundFX(CGameManager.fxSounds.select);
         bgPause.SetActive(false);
         keyDisplayPanel.SetActive(false);
         isKeyDisplayPanelOn = false;
         is_viewKeyDisplay   = !is_viewKeyDisplay;
         CSceneManager.Instance.trainingRoomOptions.isView = !is_viewKeyDisplay;
         InputResetData();
     }
     else if ((gameMgr.P1_Left.player.GetAxisRaw("Move Horizontal") > 0 ||
               gameMgr.P1_Left.player.GetAxisRaw("Move Horizontal") < 0 ||
               gameMgr.P2_Right.player.GetAxisRaw("Move Horizontal") > 0 ||
               gameMgr.P2_Right.player.GetAxisRaw("Move Horizontal") < 0) &&
              enableAxisInput)
     {
         CGameManager.PlaySoundFX(CGameManager.fxSounds.move);
         ResetKeyDisplayDatas();
         ResetMyEnableTime();
     }
 }
Example #23
0
    private void Start()
    {
        CGameManager.rewiredPlayer1 = ReInput.players.GetPlayer(0);
        CGameManager.rewiredPlayer1.controllers.maps.SetMapsEnabled(true, Rewired.ControllerType.Joystick, 0);
        CGameManager.rewiredPlayer1.controllers.maps.SetMapsEnabled(true, Rewired.ControllerType.Keyboard, 0);

        CGameManager.rewiredPlayer2 = ReInput.players.GetPlayer(1);
        CGameManager.rewiredPlayer2.controllers.maps.SetMapsEnabled(true, Rewired.ControllerType.Joystick, 0);
        CGameManager.rewiredPlayer2.controllers.maps.SetMapsEnabled(true, Rewired.ControllerType.Keyboard, 0);

        Sequence initBackground = DOTween.Sequence();

        initBackground.Insert(0.0f, background.transform.DOMoveY(-300, 0.0f));

        backgroundScroll = DOTween.Sequence();
        backgroundScroll.Insert(0.0f, background.transform.DOMoveY(950, 50).SetEase(Ease.Linear));
        backgroundScroll.Insert(50, background.transform.DOMoveY(-300, 50).SetEase(Ease.Linear));

        backgroundScroll.SetLoops(-1, LoopType.Restart);

        CGameManager.fxSounds = new FxSoundData();
        CGameManager.OnInitSoundFx(soundData);
        CGameManager.OnInitAudioSystem(false);
    }
Example #24
0
    private void FixedUpdate()
    {
        if (gameMgr != null && gameMgr.P1_Left != null && gameMgr.P2_Right != null)
        {
            bool bothReady = (gameMgr.P1_Left.ready && gameMgr.P2_Right.ready);

            if (bothReady)
            {
                if (gameMgr.enableTimeUpdate)
                {
                    gameMgr.defaultUiCtrl.FixedUpdateGOF();
                }
                if (gameMgr.defaultUiCtrl.isPaused)
                {
                    return;
                }

                cameraControl.FixedUpdateGOF();
                if (gameMgr.defaultUiCtrl.OnGetCurrentPlayTime() <= 0 && gameMgr.defaultUiCtrl.OnGetRunning())
                {
                    float p1Life = gameMgr.P1_Left.myCharacterInfo.currentLifePoints / (float)gameMgr.P1_Left.myCharacterInfo.maxLifePoints;
                    float p2Life = gameMgr.P2_Right.myCharacterInfo.currentLifePoints / (float)gameMgr.P2_Right.myCharacterInfo.maxLifePoints;
                    lockMovement = true;
                    lockInputs   = true;

                    gameMgr.defaultUiCtrl.OnSetRunning(false);
                    gameMgr.defaultUiCtrl.OnTimeOverView(true);
                    CGameManager.PlaySoundFX(CSceneManager.Instance.announcerSounds.timeOver);

                    if (p1Life > p2Life)
                    {
                        gameMgr.P2_Right.EndRound(3f);
                    }
                    else if (p1Life == p2Life)
                    {
                        gameMgr.P1_Left.NewRound(3f);
                    }
                    else
                    {
                        gameMgr.P1_Left.EndRound(3f);
                    }
                }

                if (gameMgr.P1_Left.moveSetScript != null && gameMgr.P1_Left.moveSetScript.MecanimControl != null)
                {
                    gameMgr.P1_Left.moveSetScript.MecanimControl.FixedUpdateGOF();
                    if (gameMgr.P1_Left.projectiles.Count > 0)
                    {
                        // item => item.IsDestroyed()는      delegate( item ) { item.IsDestroyed(); }
                        // 무명 함수의 첫번째 인자
                        gameMgr.P1_Left.projectiles.RemoveAll(item => item.IsDestroyed() || item == null);

                        foreach (ProjectileMoveScript projectileMoveScript in gameMgr.P1_Left.projectiles)
                        {
                            if (projectileMoveScript != null)
                            {
                                projectileMoveScript.FixedUpdateGOF();
                            }
                        }
                    }
                    gameMgr.P1_Left.FixedUpdateGOF();
                }

                if (gameMgr.P2_Right.moveSetScript != null && gameMgr.P2_Right.moveSetScript.MecanimControl != null)
                {
                    gameMgr.P2_Right.moveSetScript.MecanimControl.FixedUpdateGOF();
                    // projectile update
                    if (gameMgr.P2_Right.projectiles.Count > 0)
                    {
                        gameMgr.P2_Right.projectiles.RemoveAll(item => item.IsDestroyed() || item == null);

                        foreach (ProjectileMoveScript projectileMoveScript in gameMgr.P2_Right.projectiles)
                        {
                            if (projectileMoveScript != null)
                            {
                                projectileMoveScript.FixedUpdateGOF();
                            }
                        }
                    }
                    gameMgr.P2_Right.FixedUpdateGOF();
                }
            }
        }
    }
 public void Awake()
 {
     CGameManager._inst = this;
 }
 //메뉴 돌아가기
 public override void CheckBackToMenuPanelInput()
 {
     if ((gameMgr.P1_Left.player.GetButtonDown("Select") ||
          gameMgr.P2_Right.player.GetButtonDown("Select")) && enableBtnInput)
     {
         CGameManager.PlaySoundFX(CGameManager.fxSounds.select);
         //메인메뉴
         if (isMainMenu && isYesOrNo)
         {
             CSceneManager.Instance.ResetRoundCast();
             SceneManager.LoadScene("MainMenu");
         }
         //캐맵선택
         else if (!isMainMenu && isYesOrNo)
         {
             CSceneManager.Instance.ResetRoundCast();
             SceneManager.LoadScene("SelectMenu");
         }
         else if (!isYesOrNo)
         {
             bgPause.SetActive(false);
             backToMenuPanel.SetActive(false);
             isBackToMenuPanelOn = false;
             InputResetData();
         }
     }
     else if ((gameMgr.P1_Left.player.GetAxisRaw("Move Vertical") < 0 ||
               gameMgr.P2_Right.player.GetAxisRaw("Move Vertical") < 0) && enableAxisInput)
     {
         CGameManager.PlaySoundFX(CGameManager.fxSounds.move);
         if (isYesOrNo)
         {
             backToMenuYes.SetActive(false);
             backToMenuNo.SetActive(true);
             isYesOrNo = false;
         }
         else if (!isYesOrNo)
         {
             backToMenuYes.SetActive(true);
             backToMenuNo.SetActive(false);
             isYesOrNo = true;
         }
         ResetMyEnableTime();
     }
     else if ((gameMgr.P1_Left.player.GetAxisRaw("Move Vertical") > 0 ||
               gameMgr.P2_Right.player.GetAxisRaw("Move Vertical") > 0) && enableAxisInput)
     {
         CGameManager.PlaySoundFX(CGameManager.fxSounds.move);
         if (isYesOrNo)
         {
             backToMenuYes.SetActive(false);
             backToMenuNo.SetActive(true);
             isYesOrNo = false;
         }
         else if (!isYesOrNo)
         {
             backToMenuYes.SetActive(true);
             backToMenuNo.SetActive(false);
             isYesOrNo = true;
         }
         ResetMyEnableTime();
     }
 }
    //커맨드
    public override void CheckCommandPanelInput()
    {
        if ((gameMgr.P1_Left.player.GetButtonDown("Select") || gameMgr.P2_Right.player.GetButtonDown("Select")) &&
            Input_on)
        {
            CGameManager.PlaySoundFX(CGameManager.fxSounds.select);
            bgPause.SetActive(false);
            commandPanel.SetActive(false);
            isCommandPanelOn = false;
            InputResetData();
        }
        else if ((gameMgr.P1_Left.player.GetAxisRaw("Move Horizontal") > 0 ||
                  gameMgr.P2_Right.player.GetAxisRaw("Move Horizontal") > 0) && enableAxisInput)
        {
            CGameManager.PlaySoundFX(CGameManager.fxSounds.move);
            if (is1PCommandView)
            {
                commandNameP2.transform.position = new Vector3(Screen.width * -2, commandNameP2.transform.position.y, commandNameP2.transform.position.z);

                Sequence PlayCommandPanelMov = DOTween.Sequence();
                PlayCommandPanelMov.Insert(0, commandNameP2.transform.DOMoveX(Screen.width / 2, 0.4f));
                PlayCommandPanelMov.Insert(0, commandNameP1.transform.DOMoveX(Screen.width * 2, 0.4f));

                is1PCommandView = false;
            }
            else// if (!is_1pCommandView)
            {
                commandNameP1.transform.position = new Vector3(Screen.width * -2, commandNameP1.transform.position.y, commandNameP1.transform.position.z);

                Sequence PlayCommandPanelMov = DOTween.Sequence();
                PlayCommandPanelMov.Insert(0, commandNameP1.transform.DOMoveX(Screen.width / 2, 0.4f));
                PlayCommandPanelMov.Insert(0, commandNameP2.transform.DOMoveX(Screen.width * 2, 0.4f));

                is1PCommandView = true;
            }
            ResetMyEnableTime();
        }
        else if ((gameMgr.P1_Left.player.GetAxisRaw("Move Horizontal") < 0 ||
                  gameMgr.P2_Right.player.GetAxisRaw("Move Horizontal") < 0) && enableAxisInput)
        {
            CGameManager.PlaySoundFX(CGameManager.fxSounds.move);
            if (is1PCommandView)
            {
                commandNameP2.transform.position = new Vector3(Screen.width * 2, commandNameP2.transform.position.y, commandNameP2.transform.position.z);

                Sequence PlayCommandPanelMov = DOTween.Sequence();
                PlayCommandPanelMov.Insert(0, commandNameP2.transform.DOMoveX(Screen.width / 2, 0.4f));
                PlayCommandPanelMov.Insert(0, commandNameP1.transform.DOMoveX(Screen.width * -2, 0.4f));

                is1PCommandView = false;
            }
            else// if (!is_1pCommandView)
            {
                commandNameP1.transform.position = new Vector3(Screen.width * 2, commandNameP1.transform.position.y, commandNameP1.transform.position.z);

                Sequence PlayCommandPanelMov = DOTween.Sequence();
                PlayCommandPanelMov.Insert(0, commandNameP1.transform.DOMoveX(Screen.width / 2, 0.4f));
                PlayCommandPanelMov.Insert(0, commandNameP2.transform.DOMoveX(Screen.width * -2, 0.4f));

                is1PCommandView = true;
            }
            ResetMyEnableTime();
        }
    }
    //사운드
    public override void CheckSoundOptionPanelInput()
    {
        if ((gameMgr.P1_Left.player.GetButtonDown("Select") ||
             gameMgr.P2_Right.player.GetButtonDown("Select")) && Input_on)
        {
            CGameManager.PlaySoundFX(CGameManager.fxSounds.select);
            bgPause.SetActive(false);
            SoundOptionPanel.SetActive(false);
            isSoundOptionPanelOn = false;
            InputResetData();
        }
        //효과음배경음 버튼선택
        else if ((gameMgr.P1_Left.player.GetAxisRaw("Move Vertical") > 0 ||
                  gameMgr.P2_Right.player.GetAxisRaw("Move Vertical") > 0) && enableAxisInput)
        {
            CGameManager.PlaySoundFX(CGameManager.fxSounds.move);
            if (is_bgmButtonOn)
            {
                is_bgmOptionOn = false;
                is_sfxOptionOn = true;
                is_bgmButtonOn = false;
            }
            else
            {
                is_bgmOptionOn = true;
                is_sfxOptionOn = false;
                is_bgmButtonOn = true;
            }

            bgmButton.SetActive(is_bgmButtonOn);
            sfxButton.SetActive(!is_bgmButtonOn);
            ResetMyEnableTime();
        }
        else if ((gameMgr.P1_Left.player.GetAxisRaw("Move Vertical") < 0 ||
                  gameMgr.P2_Right.player.GetAxisRaw("Move Vertical") < 0) && enableAxisInput)
        {
            CGameManager.PlaySoundFX(CGameManager.fxSounds.move);
            if (is_bgmButtonOn)
            {
                is_bgmOptionOn = false;
                is_sfxOptionOn = true;
                is_bgmButtonOn = false;
            }
            else
            {
                is_bgmOptionOn = true;
                is_sfxOptionOn = false;
                is_bgmButtonOn = true;
            }

            bgmButton.SetActive(is_bgmButtonOn);
            sfxButton.SetActive(!is_bgmButtonOn);
            ResetMyEnableTime();
        }
        //효과음 배경음 음량조절
        else if ((gameMgr.P1_Left.player.GetAxisRaw("Move Horizontal") > 0 ||
                  gameMgr.P2_Right.player.GetAxisRaw("Move Horizontal") > 0) && enableAxisInput /* && (is_bgmOptionOn || is_sfxOptionOn)*/)
        {
            CGameManager.PlaySoundFX(CGameManager.fxSounds.move);
            if (is_bgmOptionOn)
            {
                bgmVol += 0.1f;
                if (bgmVol >= 1)
                {
                    bgmVol = 1;
                }
                CGameManager.SetBgmVolume(bgmVol);
                Bgm_Slider.value = bgmVol;
            }
            else if (is_sfxOptionOn)
            {
                sfxVol += 0.1f;
                if (sfxVol >= 1)
                {
                    sfxVol = 1;
                }
                CGameManager.SetSoundFXVolume(sfxVol);
                Sfx_Slider.value = sfxVol;
            }
            ResetMyEnableTime();
        }
        else if ((gameMgr.P1_Left.player.GetAxisRaw("Move Horizontal") < 0 ||
                  gameMgr.P2_Right.player.GetAxisRaw("Move Horizontal") < 0) && enableAxisInput /* && (is_bgmOptionOn || is_sfxOptionOn)*/)
        {
            CGameManager.PlaySoundFX(CGameManager.fxSounds.move);
            if (is_bgmOptionOn)
            {
                bgmVol -= 0.1f;
                if (bgmVol <= 0)
                {
                    bgmVol = 0;
                }
                CGameManager.SetBgmVolume(bgmVol);
                Bgm_Slider.value = bgmVol;
            }
            else if (is_sfxOptionOn)
            {
                sfxVol -= 0.1f;
                if (sfxVol <= 0)
                {
                    sfxVol = 0;
                }
                CGameManager.SetSoundFXVolume(sfxVol);
                Sfx_Slider.value = sfxVol;
            }
            ResetMyEnableTime();
        }
    }
    //컨트롤러
    public override void CheckControllSetPanelInput()
    {
        if ((gameMgr.P1_Left.player.GetButtonDown("Select") ||
             gameMgr.P2_Right.player.GetButtonDown("Select")) && Input_on)
        {
            CGameManager.PlaySoundFX(CGameManager.fxSounds.select);
            //1p 컨트롤러 활성화
            if (setController_playernum == 1)
            {
                gameMgr.P1_Left.player.controllers.maps.SetMapsEnabled(CGameManager.is_usedGamepadP1, Rewired.ControllerType.Joystick, 0);
                gameMgr.P1_Left.player.controllers.maps.SetMapsEnabled(!CGameManager.is_usedGamepadP1, Rewired.ControllerType.Keyboard, 0);
            }
            //2p 컨트롤러 활성화
            else if (setController_playernum == 2)
            {
                gameMgr.P2_Right.player.controllers.maps.SetMapsEnabled(CGameManager.is_usedGamepadP2, Rewired.ControllerType.Joystick, 0);
                gameMgr.P2_Right.player.controllers.maps.SetMapsEnabled(!CGameManager.is_usedGamepadP2, Rewired.ControllerType.Keyboard, 0);
            }

            bgPause.SetActive(false);
            controllSetPanel.SetActive(false);
            isControllSetPanelOn    = false;
            setController_playernum = 0;
            InputResetData();
        }
        else if ((gameMgr.P1_Left.player.GetAxisRaw("Move Horizontal") < 0 ||
                  gameMgr.P2_Right.player.GetAxisRaw("Move Horizontal") < 0) && enableAxisInput)
        {
            CGameManager.PlaySoundFX(CGameManager.fxSounds.move);
            //1p 버튼
            if (setController_playernum == 1 && CGameManager.is_usedGamepadP1)
            {
                CGameManager.is_usedGamepadP1 = false;
                controllSet_keyboard.transform.localPosition = new Vector3(110, controllSet_keyboard.transform.localPosition.y, controllSet_keyboard.transform.localPosition.z);

                controllSet_gamepad.transform.DOLocalMoveX(-110, 0.2f);
                controllSet_keyboard.transform.DOLocalMoveX(0, 0.2f);
            }
            else if (setController_playernum == 1 && !CGameManager.is_usedGamepadP1)
            {
                CGameManager.is_usedGamepadP1 = true;
                controllSet_gamepad.transform.localPosition = new Vector3(110, controllSet_gamepad.transform.localPosition.y, controllSet_gamepad.transform.localPosition.z);

                controllSet_keyboard.transform.DOLocalMoveX(-110, 0.2f);
                controllSet_gamepad.transform.DOLocalMoveX(0, 0.2f);
            }
            if (setController_playernum == 2 && CGameManager.is_usedGamepadP2)
            {
                CGameManager.is_usedGamepadP2 = false;
                controllSet_keyboard.transform.localPosition = new Vector3(110, controllSet_keyboard.transform.localPosition.y, controllSet_keyboard.transform.localPosition.z);

                controllSet_gamepad.transform.DOLocalMoveX(-110, 0.2f);
                controllSet_keyboard.transform.DOLocalMoveX(0, 0.2f);
            }
            else if (setController_playernum == 2 && !CGameManager.is_usedGamepadP2)
            {
                CGameManager.is_usedGamepadP2 = true;
                controllSet_gamepad.transform.localPosition = new Vector3(110, controllSet_gamepad.transform.localPosition.y, controllSet_gamepad.transform.localPosition.z);

                controllSet_keyboard.transform.DOLocalMoveX(-110, 0.2f);
                controllSet_gamepad.transform.DOLocalMoveX(0, 0.2f);
            }

            ResetMyEnableTime();
        }
        else if ((gameMgr.P1_Left.player.GetAxisRaw("Move Horizontal") > 0 ||
                  gameMgr.P2_Right.player.GetAxisRaw("Move Horizontal") > 0) && enableAxisInput)
        {
            CGameManager.PlaySoundFX(CGameManager.fxSounds.move);
            if (setController_playernum == 1 && CGameManager.is_usedGamepadP1)
            {
                CGameManager.is_usedGamepadP1 = false;
                controllSet_keyboard.transform.localPosition = new Vector3(-110, controllSet_keyboard.transform.localPosition.y, controllSet_keyboard.transform.localPosition.z);

                controllSet_gamepad.transform.DOLocalMoveX(110, 0.2f);
                controllSet_keyboard.transform.DOLocalMoveX(0, 0.2f);
            }
            else if (setController_playernum == 1 && !CGameManager.is_usedGamepadP1)
            {
                CGameManager.is_usedGamepadP1 = true;
                controllSet_gamepad.transform.localPosition = new Vector3(-110, controllSet_gamepad.transform.localPosition.y, controllSet_gamepad.transform.localPosition.z);

                controllSet_keyboard.transform.DOLocalMoveX(110, 0.2f);
                controllSet_gamepad.transform.DOLocalMoveX(0, 0.2f);
            }
            if (setController_playernum == 2 && CGameManager.is_usedGamepadP2)
            {
                CGameManager.is_usedGamepadP2 = false;
                controllSet_keyboard.transform.localPosition = new Vector3(-110, controllSet_keyboard.transform.localPosition.y, controllSet_keyboard.transform.localPosition.z);

                controllSet_gamepad.transform.DOLocalMoveX(110, 0.2f);
                controllSet_keyboard.transform.DOLocalMoveX(0, 0.2f);
            }
            else if (setController_playernum == 2 && !CGameManager.is_usedGamepadP2)
            {
                CGameManager.is_usedGamepadP2 = true;
                controllSet_gamepad.transform.localPosition = new Vector3(-110, controllSet_gamepad.transform.localPosition.y, controllSet_gamepad.transform.localPosition.z);

                controllSet_keyboard.transform.DOLocalMoveX(110, 0.2f);
                controllSet_gamepad.transform.DOLocalMoveX(0, 0.2f);
            }

            ResetMyEnableTime();
        }
    }
    public override void PauseMenuSelect()
    {
        if (!isCommandPanelOn && !isControllSetPanelOn && !isKeyDisplayPanelOn && !isSoundOptionPanelOn && !isBackToMenuPanelOn)
        {
            if ((gameMgr.P1_Left.player.GetButtonDown("Select") ||
                 gameMgr.P2_Right.player.GetButtonDown("Select")) && enableBtnInput)
            {
                CGameManager.PlaySoundFX(CGameManager.fxSounds.select);
                switch (curIdx)
                {
                case 0:         ///캐릭터 맵선택
                {
                    bgPause.SetActive(true);
                    backToMenuPanel.SetActive(true);
                    isMainMenu = false;
                    backToMenuYes.SetActive(true);
                    backToMenuNo.SetActive(false);
                    isYesOrNo = true;

                    isBackToMenuPanelOn = true;
                    ResetMyEnableTime();
                }
                break;

                case 3:         ///키 디스플레이
                {
                    bgPause.SetActive(true);
                    keyDisplayPanel.SetActive(true);
                    isKeyDisplayPanelOn = true;

                    ResetKeyDisplayDatas();
                }
                break;

                case 4:         ///커맨드리스트
                {
                    bgPause.SetActive(true);
                    commandPanel.SetActive(true);
                    isCommandPanelOn = true;
                }
                break;

                case 5:         ///사운드설정
                {
                    bgPause.SetActive(true);

                    bgmVol           = CGameManager.bgmVolume;
                    Bgm_Slider.value = bgmVol;
                    sfxVol           = CGameManager.soundFXVolume;
                    Sfx_Slider.value = sfxVol;
                    is_bgmOptionOn   = true;
                    SoundOptionPanel.SetActive(true);
                    isSoundOptionPanelOn = true;
                }
                break;

                case 6:         ///메인메뉴
                {
                    bgPause.SetActive(true);
                    backToMenuPanel.SetActive(true);
                    isMainMenu = true;
                    backToMenuYes.SetActive(true);
                    backToMenuNo.SetActive(false);
                    isYesOrNo = true;

                    isBackToMenuPanelOn = true;
                    ResetMyEnableTime();
                }
                break;
                }
                //1p 2p 조작설정
                if (gameMgr.P1_Left.player.GetButtonDown("Select") && Input_on)
                {
                    CGameManager.PlaySoundFX(CGameManager.fxSounds.select);
                    if (curIdx == 1)     ///플레이어1 조작설정
                    {
                        bgPause.SetActive(true);
                        if (CGameManager.is_usedGamepadP1)
                        {
                            controllSet_gamepad.transform.localPosition  = new Vector3(0, controllSet_gamepad.transform.localPosition.y, controllSet_gamepad.transform.localPosition.z);
                            controllSet_keyboard.transform.localPosition = new Vector3(110, controllSet_keyboard.transform.localPosition.y, controllSet_keyboard.transform.localPosition.z);
                        }
                        if (!CGameManager.is_usedGamepadP1)
                        {
                            controllSet_gamepad.transform.localPosition  = new Vector3(110, controllSet_gamepad.transform.localPosition.y, controllSet_gamepad.transform.localPosition.z);
                            controllSet_keyboard.transform.localPosition = new Vector3(0, controllSet_keyboard.transform.localPosition.y, controllSet_keyboard.transform.localPosition.z);
                        }

                        controllSetPanel.SetActive(true);
                        isControllSetPanelOn    = true;
                        setController_playernum = 1;
                        InputResetData();
                    }
                }
                if (gameMgr.P2_Right.player.GetButtonDown("Select") && enableBtnInput)
                {
                    CGameManager.PlaySoundFX(CGameManager.fxSounds.select);
                    if (curIdx == 2)     ///플레이어1 조작설정
                    {
                        bgPause.SetActive(true);
                        if (CGameManager.is_usedGamepadP2)
                        {
                            controllSet_gamepad.transform.localPosition  = new Vector3(0, controllSet_gamepad.transform.localPosition.y, controllSet_gamepad.transform.localPosition.z);
                            controllSet_keyboard.transform.localPosition = new Vector3(110, controllSet_keyboard.transform.localPosition.y, controllSet_keyboard.transform.localPosition.z);
                        }
                        if (!CGameManager.is_usedGamepadP2)
                        {
                            controllSet_gamepad.transform.localPosition  = new Vector3(110, controllSet_gamepad.transform.localPosition.y, controllSet_gamepad.transform.localPosition.z);
                            controllSet_keyboard.transform.localPosition = new Vector3(0, controllSet_keyboard.transform.localPosition.y, controllSet_keyboard.transform.localPosition.z);
                        }

                        controllSetPanel.SetActive(true);
                        isControllSetPanelOn    = true;
                        setController_playernum = 2;
                        InputResetData();
                    }
                }
                ResetMyEnableTime();
                return;
            }
        }

        else
        {
            if (isCommandPanelOn)
            {
                CheckCommandPanelInput();
            }
            else if (isKeyDisplayPanelOn)
            {
                CheckKeyDisplayPanelInput();
            }
            else if (isControllSetPanelOn)
            {
                CheckControllSetPanelInput();
            }
            else if (isSoundOptionPanelOn)
            {
                CheckSoundOptionPanelInput();
            }
            else if (isBackToMenuPanelOn)
            {
                CheckBackToMenuPanelInput();
            }
        }
    }
    public override void FixedUpdateGOF()
    {
        base.FixedUpdateGOF();

        if (!enableAxisInput)
        {
            axisTimer += Time.fixedDeltaTime;
            if (axisTimer > axisWaitingTime)
            {
                enableAxisInput = true;
            }
        }

        if (!enableBtnInput)
        {
            btnTimer += Time.fixedDeltaTime;
            if (btnTimer > btnWaitingTime)
            {
                enableBtnInput = true;
            }
        }

        if (!pausePlayer1)
        {
            controllOff1p.SetActive(true);
        }
        else if (!pausePlayer2)
        {
            controllOff2p.SetActive(true);
        }

        if (!isCommandPanelOn &&
            !isControllSetPanelOn &&
            !isKeyDisplayPanelOn &&
            !isSoundOptionPanelOn &&
            !isBackToMenuPanelOn &&
            enableAxisInput && (!gameMgr.P1_Left.isDead && !gameMgr.P2_Right.isDead))
        {
            if ((gameMgr.P1_Left.player.GetAxisRaw("Move Vertical") < 0 && pausePlayer1) ||
                (gameMgr.P2_Right.player.GetAxisRaw("Move Vertical") < 0 && pausePlayer2))
            {
                CGameManager.PlaySoundFX(CGameManager.fxSounds.move);
                curIdx++;
                if (curIdx >= buttonImgs.Length)
                {
                    curIdx = 0;
                }
                if (!CGameManager.isPcMode && (curIdx == 1 || curIdx == 2))
                {
                    curIdx = 3;
                }
                if (pausePlayer1 && curIdx == 2)
                {
                    curIdx = 3;
                }
                else if (pausePlayer2 && curIdx == 1)
                {
                    curIdx = 2;
                }
                OnImage(curIdx, ref buttonImgs);
                ResetMyEnableTime();
            }
            else if ((gameMgr.P1_Left.player.GetAxisRaw("Move Vertical") > 0 && pausePlayer1) ||
                     (gameMgr.P2_Right.player.GetAxisRaw("Move Vertical") > 0 && pausePlayer2))
            {
                CGameManager.PlaySoundFX(CGameManager.fxSounds.move);
                curIdx--;
                if (curIdx < 0)
                {
                    curIdx = buttonImgs.Length - 1;
                }
                if (!CGameManager.isPcMode && (curIdx == 1 || curIdx == 2))
                {
                    curIdx = 0;
                }
                if (pausePlayer1 && curIdx == 2)
                {
                    curIdx = 0;
                }
                else if (pausePlayer2 && curIdx == 1)
                {
                    curIdx = 0;
                }
                OnImage(curIdx, ref buttonImgs);
                ResetMyEnableTime();
            }
        }
        PauseMenuSelect();
    }
Example #32
0
 // Private Methods:
 void Awake()
 {
     if (!m_instance) {
         m_instance = this;
     }
 }