コード例 #1
0
 /// <summary>
 ///
 /// </summary>
 public void Init()
 {
     if (!_inited)
     {
         _inited = true;
         GameSceneManager.GetInstance().SwitchSceneCompleteEvent += SwitchSceneComplete;
     }
 }
コード例 #2
0
    IEnumerator LoadSceneCoroutine()
    {
        isLoading = true;
        ShowOverlay();
        yield return(new WaitForSeconds(1));

        GameSceneManager.GetInstance().GoToNextStage();
    }
コード例 #3
0
        // Update is called once per frame
        void Update()
        {
            m_Runner.Update();

            if (Input.GetButton("Start"))
            {
                GameSceneManager.GetInstance().LoadPauseMenuScene();
            }
        }
コード例 #4
0
    void OnGUI()
    {
        float top = 30;

        if (GUI.Button(new Rect(30, top, 150, 30), "Go Back to level"))
        {
            GameSceneManager.GetInstance().Pop(true);
        }
    }
コード例 #5
0
    // Use this for initialization
    void Start()
    {
        m_Runner = new FSMRunner(gameObject);

        m_Runner.RegisterState <GameMaster_State_RunSingleTurn>();
        m_Runner.RegisterState <GameMaster_State_CheckGoal>();
        m_Runner.RegisterState <GameMaster_State_GameOver>();
        m_Runner.RegisterState <GameMaster_State_Victory>();
        m_Runner.RegisterState <GameMaster_State_Terminate>();
        m_Runner.RegisterState <GameMaster_State_DummyLoop>();

        GameMaster_State_Init stateInit = m_Runner.RegisterState <GameMaster_State_Init>();

        stateInit.m_FadeWidget = m_InitFadeWidget;
        stateInit.m_InitColor  = m_InitColor;

        GameMaster_State_PlayIntro statePlayIntro = m_Runner.RegisterState <GameMaster_State_PlayIntro>();

        statePlayIntro.m_IntroCutscene = m_IntroCutscene;

        m_Runner.StartState((int)GameMasterState.Init);

        m_Pawns          = new List <GameObject>();
        m_SceneParameter = GameSceneManager.GetInstance().GetParameter <CombatSceneParameter>();
        m_Settings       = GetComponent <Combat_Settings>();

        for (int prefabId = 0; prefabId < m_SceneParameter.m_EnemiesPawns.Count; prefabId++)
        {
            Transform prefab = m_SceneParameter.m_EnemiesPawns[prefabId];

            Vector3    position    = m_Settings.ComputePawnEnemyGlobalPosition(prefabId);
            Quaternion orientation = m_Settings.ComputePawnEnemyGlobalOrientation(prefabId);
            Transform  pawn        = (Transform)Instantiate(prefab, position, orientation);
            pawn.parent = gameObject.transform.root;
            m_Pawns.Add(pawn.gameObject);

            StickToGround.Apply(pawn.gameObject);
        }

        for (int prefabId = 0; prefabId < m_SceneParameter.m_PlayerPawns.Count; prefabId++)
        {
            Transform prefab = m_SceneParameter.m_PlayerPawns[prefabId];

            Vector3    position    = m_Settings.ComputePawnPlayerGlobalPosition(prefabId);
            Quaternion orientation = m_Settings.ComputePawnPlayerGlobalOrientation(prefabId);
            Transform  pawn        = (Transform)Instantiate(prefab, position, orientation);
            pawn.parent = gameObject.transform.root;
            m_Pawns.Add(pawn.gameObject);

            StickToGround.Apply(pawn.gameObject);
        }

        m_UIEffects.HideDamageEffect();
        m_UIEffects.HideGameOverEffect();
        m_UIEffects.HideVictoryEffect();
    }
コード例 #6
0
    public void Start()
    {
        DontDestroyOnLoad(this);

        var dataManager = DataManager.GetInstance();

        dataManager.LoadStageData();

        GameSceneManager.GetInstance().LoadScene(2);
    }
コード例 #7
0
ファイル: GameManager.cs プロジェクト: JivinBian/game_project
 private void InitManager()
 {
     LogManager.Init();
     CoroutineUtil.Init(_gameController);
     ResourceManager.GetInstance().Init();
     DataConfigManager.GetInstance().Init();
     TimeManager.GetInstance().Init();
     ObjectManager.GetInstance().Init();
     InteractiveManager.GetInstance().Init();
     GameSceneManager.GetInstance().Init();
 }
コード例 #8
0
 public void Enter()
 {
     GameSceneManager.GetInstance().LoadScene(2);
     GameSceneManager.GetInstance().SceneLoadProgressEvent += (p) =>
     {
         LogManager.Debug("load scene progress:" + p);
     };
     GameSceneManager.GetInstance().SwitchSceneCompleteEvent += (p) =>
     {
         ObjectManager.GetInstance().Test();
     };
 }
コード例 #9
0
        public override void OnEnter()
        {
            foreach (GameObject obj in GameTurnManager.GetInstance().m_PlayerPawns)
            {
                PawnBehavior   bhv   = obj.GetComponent <PawnBehavior>();
                PawnStatistics stats = obj.GetComponent <PawnStatistics>();
                GameStateManager.GetInstance().GetCharacter(bhv.m_CharacterId).SaveFrom(stats);
            }

            GameSceneManager.GetInstance().Pop(true);

            LevelMaster.GetInstance().ComeBackFromBattle();
        }
コード例 #10
0
        private void SwitchSceneComplete(SceneInfo pInfo)
        {
            GameObject pGameObject = ResourceManager.GetInstance().LoadFromResource("GameSystem/FingerGestures", null, true) as GameObject;

            _fingerGestures = pGameObject.GetComponent <FingerGestures>();
            GameObject.DontDestroyOnLoad(pGameObject);
            GameSceneManager.GetInstance().SwitchSceneCompleteEvent -= SwitchSceneComplete;
            _fingerGestures.gameObject.GetComponent <ScreenRaycaster>().Cameras = new Camera[] { Camera.main };
            _swipeRecognizer = _fingerGestures.gameObject.GetComponent <SwipeRecognizer>();
            _pinchRecognizer = _fingerGestures.gameObject.GetComponent <PinchRecognizer>();
            (_fingerGestures.gameObject.GetComponent <DragRecognizer>()).OnGesture += OnDrag;
            _swipeRecognizer.OnGesture += OnSwip;
            _pinchRecognizer.OnGesture += OnPinch;
        }
コード例 #11
0
            public override void OnEnter()
            {
                CombatSceneParameter param = new CombatSceneParameter();

                param.m_EnemiesPawns.AddRange(m_Behavior.m_EnemyCombatSettings.m_PawnsPrefab);

                Transform prefabPawnPlayer   = Resources.Load <Transform>("Prefabs/Pawns/Pawn_Player");
                Transform prefabPawnSidekick = Resources.Load <Transform>("Prefabs/Pawns/Pawn_Sidekick");

                param.m_PlayerPawns.Add(prefabPawnPlayer);
                param.m_PlayerPawns.Add(prefabPawnSidekick);

                GameSceneManager.GetInstance().LoadCombatScene("Level_01_Combat_01", param);

                m_Runner.SetImmediateCurrentState((int)LevelMasterState.Nothing);
            }
コード例 #12
0
        void Update()
        {
            if (!m_InputCooldown.IsCooldownElapsed())
            {
                return;
            }

            if (Input.GetButton("RB"))
            {
                ++m_SelectedTabId;
                if (m_SelectedTabId >= m_Tabs.Length)
                {
                    m_SelectedTabId = 0;
                }

                UpdateSelectedTab(m_Tabs[m_SelectedTabId]);
                m_InputCooldown.StartCooldown();
            }
            else if (Input.GetButton("LB"))
            {
                --m_SelectedTabId;
                if (m_SelectedTabId < 0)
                {
                    m_SelectedTabId = m_Tabs.Length - 1;
                }

                UpdateSelectedTab(m_Tabs[m_SelectedTabId]);
                m_InputCooldown.StartCooldown();
            }
            else if (Input.GetButtonDown("Start"))
            {
                m_StartButtonDown = true;
            }
            else if (Input.GetButtonUp("Start"))
            {
                if (m_StartButtonDown)
                {
                    GameSceneManager.GetInstance().Pop(true);
                }
            }
        }
コード例 #13
0
        /////////////////////////////////////////////////////////////////////////////////////////////////
        ///
        public void Test()
        {
            var tPlayerData = new PlayerData(DataConfigManager.GetInstance(), 1)
            {
                Guid     = 1,
                HP       = 30,
                MP       = 30,
                Position = new Vector3(0, 0, 0)
            };

            CreatePlayer(tPlayerData);

            for (int i = 0; i < 0; i++)
            {
                tPlayerData = new PlayerData(DataConfigManager.GetInstance(), 1)
                {
                    Guid     = (uint)(2 + i),
                    HP       = 30,
                    MP       = 30,
                    Position = new Vector3(10f * (float)Math.Cos(i * 1f), 0, 10f * (float)Math.Sin(i * 1f))
                };
                CreatePlayer(tPlayerData);
            }

            GameSceneManager.GetInstance().SetCameraObject(Self);
            var tNPCData = new NPCData(DataConfigManager.GetInstance(), 1)
            {
                Guid     = 1,
                Position = new Vector3(15, 0, 15)
            };

            CreatNPC(tNPCData);
            tNPCData = new NPCData(DataConfigManager.GetInstance(), 1)
            {
                Guid     = 2,
                Position = new Vector3(0, 0, 0)
            };
            CreatNPC(tNPCData);
        }
コード例 #14
0
    public IEnumerator FadeInOut()
    {
        var   color = this.imgLogo.color;
        float alpha = color.a;

        while (true)
        {
            alpha             += 0.016f;
            color.a            = alpha;
            this.imgLogo.color = color;

            if (alpha >= 1)
            {
                alpha = 1;
                break;
            }
            yield return(null);
        }

        yield return(new WaitForSeconds(1.5f));

        while (true)
        {
            alpha             -= 0.016f;
            color.a            = alpha;
            this.imgLogo.color = color;

            if (alpha <= 0)
            {
                alpha = 0;
                break;
            }
            yield return(null);
        }

        GameSceneManager.GetInstance().LoadScene(3);
    }
コード例 #15
0
 public void Restart()
 {
     GameConfiguration.GetInstance().mouseSensivity = 1;
     GameSceneManager.GetInstance().ReturnToWelcome();
 }
コード例 #16
0
ファイル: SceneTitle.cs プロジェクト: hanayafld/ProjectCube
 private void LoadStageScene(int stageId)
 {
     GameSceneManager.GetInstance().LoadScene(4, stageId);
 }
コード例 #17
0
ファイル: SceneStage.cs プロジェクト: hanayafld/ProjectCube
    public void InitStage(int stageId)
    {
        this.stageId = stageId;
        Debug.LogFormat("불러온 스테이지 id : {0}", this.stageId);
        //stageNum에 맞는 스테이지 불러와서 실행

        #region Data
        var dataManager = DataManager.GetInstance();
        var stageData   = dataManager.dicStageData[this.stageId];
        #endregion

        #region Info
        var infoManager    = InfoManager.GetInstance();
        var userInfo       = infoManager.GetUserInfo();
        var userStageLevel = userInfo.stageLevel;
        #endregion

        #region Stage Reset
        this.cube.transform.position = new Vector3(0, 1, 0);
        this.SetStageMap(stageData.path);
        this.SetCamara(stageData.cameraX, stageData.cameraY, stageData.cameraZ);

        this.btnStart.gameObject.SetActive(true);
        this.buttons.SetActive(false);
        this.cube.isMoveWait = false;

        this.SetDefeat(stageData.maxMove, stageData.timeLimit);
        #endregion Stage Reset

        this.cube.onMoveCount = () =>
        {
            this.MoveCounting();
        };
        this.cube.onGameClear = () =>
        {
            if (this.isFaeiled == false)
            {
                this.isClear = true;
                this.objTxtMove.SetActive(false);
                this.objTxtTime.SetActive(false);
                this.StageClear(userStageLevel, stageData.stageLevel);
                this.txtTimeLimit.gameObject.SetActive(false);
                this.txtCurrentMove.gameObject.SetActive(false);
                this.txtMaxMove.gameObject.SetActive(false);
            }
        };
        this.cube.onGameFailed = () =>
        {
            if (this.isClear == false)
            {
                this.isFaeiled = true;
                this.objTxtMove.SetActive(false);
                this.objTxtTime.SetActive(false);
                this.StageFailed(userStageLevel, stageData.stageLevel);
                this.txtTimeLimit.gameObject.SetActive(false);
                this.txtCurrentMove.gameObject.SetActive(false);
                this.txtMaxMove.gameObject.SetActive(false);
            }
        };

        #region Button
        this.btnStart.onClick.AddListener(() =>
        {
            this.btnStart.gameObject.SetActive(false);
            this.buttons.SetActive(true);
            this.cube.isMoveWait = true;
            StartCoroutine(this.MoveCamera());
            StartCoroutine(this.Timer());
        });

        this.btnRegameKey.onClick.AddListener(() =>
        {
            Debug.Log("다시하기");
            GameSceneManager.GetInstance().LoadScene(4, this.stageId);
        });

        this.btnHomeKey.onClick.AddListener(() =>
        {
            Debug.Log("난이도 선택");
            GameSceneManager.GetInstance().LoadScene(3);
        });

        this.btnNextStage.onClick.AddListener(() =>
        {
            Debug.LogFormat("다음 단계 : {0}", this.stageId + 1);
            GameSceneManager.GetInstance().LoadScene(4, this.stageId + 1);
        });
        #endregion
    }
コード例 #18
0
    // Update is called once per frame
    void Update()
    {
        if (PlayerPrefs.GetInt("exhibition") == 1)
        {
            if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name != "MainMenu")
            {
                if (Input.mousePosition == lastMousePos)
                {
                    idleTime += Time.deltaTime;
                    DebugCanvas.Inst.SetRestartText(60 - idleTime);
                    if (idleTime >= 60)
                    {
                        DebugCanvas.Inst.Restart();
                    }
                }
                else
                {
                    idleTime     = 0;
                    lastMousePos = Input.mousePosition;
                }
            }
        }

        if (Input.GetKeyDown(KeyCode.RightArrow))
        {
            GameSceneManager.GetInstance().GoToNextStage();
        }
        if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            GameSceneManager.GetInstance().GoToPrevStage();
        }

        if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            GameSceneManager.GetInstance().ReloadScene();
        }

        if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            GameSceneManager.GetInstance().ReturnToWelcome();
        }

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            #if UNITY_EDITOR
            UnityEditor.EditorApplication.isPlaying = false;
            #else
            Application.Quit();
            #endif
        }

        if (GameStateManager.GetInstance().GetGameState() == GameStateManager.GameState.VictoryWaintInput)
        {
            if (Input.GetMouseButtonDown(0))
            {
                GameSceneManager.GetInstance().GoToNextStage();
            }
            return;
        }



        if (GameStateManager.GetInstance().GetGameState() != GameStateManager.GameState.GamePlay &&
            GameStateManager.GetInstance().GetGameState() != GameStateManager.GameState.TitleWaitInput)
        {
            return;
        }
#if (UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR
        if (Input.touchCount > 0)
        {
            if (Input.touchCount > 3)
            {
                int checkMoveFinger = 0;
                foreach (var touch in Input.touches)
                {
                    if (touch.phase == TouchPhase.Began)
                    {
                        if (!dragTouchs.ContainsKey(touch.fingerId))
                        {
                            dragTouchs.Add(touch.fingerId, touch.position);
                        }
                        else
                        {
                            dragTouchs[touch.fingerId] = touch.position;
                        }
                    }
                    if (touch.phase == TouchPhase.Moved)
                    {
                        if (!dragTouchs.ContainsKey(touch.fingerId))
                        {
                            continue;
                        }
                        if (dragTouchs[touch.fingerId].y > touch.position.y)
                        {
                            checkMoveFinger++;
                        }
                    }
                }
                if (checkMoveFinger > 3)
                {
                    StartCoroutine(SpawnHeapOfMoney());
                    dragTouchs.Clear();
                }
            }
            else if (Input.touchCount == 1)
            {
                if (Input.GetTouch(0).phase == TouchPhase.Moved || Input.GetTouch(0).phase == TouchPhase.Stationary)
                {
                    currentInput = InputState.Hold;
                }
                if (Input.GetTouch(0).phase == TouchPhase.Began)
                {
                    currentInput = InputState.Down;
                    startPos     = Input.GetTouch(0).position;
                }
            }
        }
        else
        {
            currentInput = InputState.Up;
        }
#else
        if (Input.GetMouseButtonDown(0))
        {
            currentInput = InputState.Down;
            startPos     = Input.mousePosition;
        }
        else if (Input.GetMouseButton(0))
        {
            currentInput = InputState.Hold;
        }
        if (!Input.GetMouseButton(0))
        {
            currentInput = InputState.Up;
        }
#endif
        if (currentInput == InputState.Down)
        {
            dragTime   = 0;
            cacheTrail = CloneTrail();
        }
        if (currentInput == InputState.Hold)
        {
            dragTime += Time.deltaTime;
        }


        //trail renderer
        if (Input.GetMouseButton(0) && dragTime < trailDragDuration)
        {
            if (cacheTrail)
            {
                Vector3 touchPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
                touchPos.z = -1.96f;                 //hardcoded trail z pos
                cacheTrail.transform.position = touchPos;
            }
        }



        if (Input.GetKeyDown(KeyCode.Return))
        {
            StartCoroutine(SpawnHeapOfMoney());
        }
    }
コード例 #19
0
 void Awake()
 {
     GameSceneManager.GetInstance().PushCurrentRoot();
 }