Inheritance: MonoBehaviour
        public static void LoadGame(SaveFile saveFile)
        {
            if (saveFile != null)
            {
                GalaxyController.ResetGalaxy();
                MerchantController.CreateNewMerchant();

                //Default (these should always load):
                saveFile.Load_PlanetarySystems();
                saveFile.Load_Player();

                switch (saveFile.GameState)
                {
                default:
                case SaveFile_GameState.Galaxy:
                    GameUIController.CreateGalaxyScreen();
                    break;

                case SaveFile_GameState.PlanetarySystem:
                    GameUIController.CreatePlanetarySystemScreen();
                    saveFile.Load_CurrentPlanetarySystem();
                    break;

                case SaveFile_GameState.Citadel:
                    GameUIController.CreateCitadelScreen();
                    break;
                }
            }
        }
Example #2
0
        void Start()
        {
            // PhotonNetwork.connectionState = new ConnectionState();
            //dbgDoConnect = false;
            roomOptions = new RoomOptions()
            {
                MaxPlayers = 10
            };

            roomOptions.CustomRoomPropertiesForLobby = new string[1] {
                "GPS"
            };

            if (MainMenuUI == null)
            {
                MainMenuUI = FindObjectOfType <MainMenuUIController> ();
            }
            if (GameUI == null)
            {
                GameUI = FindObjectOfType <GameUIController> ();
            }
            if (GameSetup == null)
            {
                GameSetup = FindObjectOfType <GameSetupController> ();
            }

            PhotonNetwork.Disconnect();

            IsHost       = false;
            GPSThreshold = 0.01f;
            StartCoroutine(StartLocationService());
        }
Example #3
0
 private void Awake()
 {
     playerData       = GameFacade.GetInstance().playerData;
     levelData        = GameFacade.GetInstance().levelData;
     gameUIController = GameFacade.GetInstance().GameUIController;
     gameStateData    = GameFacade.GetInstance().gameStateData;
 }
Example #4
0
    // Use this for initialization
    void Start()
    {
        _roomPrefabs.AddRange(Resources.LoadAll <Room>("RoomPrefabs"));

        if (_roomPrefabs.Count == 0)
        {
            Debug.LogError("No room prefabs found - make sure they are placed in \"Resources/RoomPrefabs\" have a root Room component.");
        }

        if (StartingRoom == null)
        {
            StartingRoom = FindObjectsOfType <Room>()?.FirstOrDefault(d => d.IsInitialisingRoom);
        }

        if (StartingRoom == null)
        {
            Debug.LogError("Generator could not find starting room, and one was not set - did you forget to set IsInitialisingRoom? Disabling.", gameObject);

            gameObject.SetActive(false);
            return;
        }

        _activeRoom = StartingRoom;
        _gameUI     = FindObjectOfType <GameUIController>();

        InitialGeneration();
        ShrinkRooms();
    }
Example #5
0
    private void Start()
    {
        gameUIController = FindObjectOfType <GameUIController>();
        dice             = FindObjectOfType <DetectDiceCount>();

        // player turn- get all tiles in game
        for (int i = 0; i < 247; i++)
        {
            allTilesInGame[i] = levelGameObj.transform.GetChild(i).gameObject;
        }
        selectedTileNum = 19;
        selectedTile    = allTilesInGame[selectedTileNum];

        // player sum 2
        previousDiePanel           = 0;
        selectedDiePanelIndexes[0] = 18;
        selectedDiePanelIndexes[1] = 19;
        selectedDiePanelIndexes[2] = 20;
        selectedDiePanelIndexes[3] = 32;
        selectedDiePanelIndexes[4] = 45;
        selectedDiePanelIndexes[5] = 58;

        canMove        = true;
        spawnTileIndex = 3;

        ChangeGameState(0);
    }
Example #6
0
 // Use this for initialization
 void Start()
 {
     ratAnim     = rat.GetComponent <Animator> ();
     guic        = GameObject.Find("Canvas/GameUI").GetComponent <GameUIController> ();
     cat         = GameObject.FindGameObjectWithTag("Player");
     ratLocation = cat.transform.Find("Body/RatLocation");
 }
Example #7
0
 public override void OnButtonClickEventHandler(string buttonName)
 {
     if (UIUtil.IsButtonClicked(buttonDisplayItemAdvance, buttonName))
     {
         Advance();
     }
     else if (UIUtil.IsButtonClicked(buttonOverviewAdvance, buttonName))
     {
         Advance();
     }
     else if (UIUtil.IsButtonClicked(buttonResultItemAdvance, buttonName))
     {
         Advance();
     }
     else if (UIUtil.IsButtonClicked(buttonResultsAdvance, buttonName))
     {
         Advance();
     }
     else if (UIUtil.IsButtonClicked(buttonResultsReplay, buttonName))
     {
         Reset();
         GameUIController.ShowGameModeTrainingModeChoiceQuiz();
     }
     else if (UIUtil.IsButtonClicked(buttonResultsModes, buttonName))
     {
         Reset();
         GameUIController.ShowGameMode();
     }
 }
Example #8
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
 }
Example #9
0
    public NrcGameStageObserver(NrcSceneLoader nrcSceneLoader)
    {
        _nrcSceneLoader   = nrcSceneLoader;
        _stageDataBase    = nrcSceneLoader.StageDataBase;
        _playerController = nrcSceneLoader.PlayerController;
        _gameUIController = nrcSceneLoader.GameUIController;
        _nowStageId       = 1;

        //スタート前カウントダウンが終了したときに呼ばれる
        _gameUIController.GameUIBeforeStarEffectService.GameUIBeforeStarEffectEndEvent += () =>
        {
            CharacterStart();
            _gameUIController.GameUICountDownService.StartAsync(_clearTime);
        };

        //ステージタイムリミット終了時に呼ばれる
        _gameUIController.GameUICountDownService.GameUICountDownEndEvent += () =>
        {
            CharacterPause();
            _gameUIController.GameUIStageClearEffectService.StartAsync();
        };

        //ステージクリア表示終了時に呼ばれる
        _gameUIController.GameUIStageClearEffectService.GameUIStageClearEffectEndEvent += () =>
        {
            CharacterPause();

            int lastStageNum = _stageDataBase.GetSize();
            if (lastStageNum == _nowStageId)
            {
                _gameUIController.GameUIGameClearEffectService.StartAsync();
            }
            else
            {
                NextStage();
            }
        };

        //EnemyTargetが全滅したときに呼ばれる
        NrcGameManager.NrcGameEnemyTargetService.EnemyTargetAllDeadEvent += () =>
        {
            CharacterPause();
            _gameUIController.Stop();
            _gameUIController.GameUIGameOverEffectService.StartAsync();
        };

        //ゲームオーバー表示終了時に呼ばれる
        _gameUIController.GameUIGameOverEffectService.GameUIGameOverEndEvent += () =>
        {
            CharacterPause();
            StageLoad(1);
        };

        _gameUIController.GameUIGameClearEffectService.GameUIGameClearEndEvent += () =>
        {        //ステージシーンの読み込み。
            {
                AsyncOperation ope = SceneManager.LoadSceneAsync("Title", LoadSceneMode.Single);
            }
        };
    }
Example #10
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            GameController.Update(gameTime);
            GameUIController.Update(gameTime);

            base.Update(gameTime);
        }
Example #11
0
    private void OnChangeLevel(Scene origin, Scene current)
    {
        if (current.name == "Game")
        {
            this.isGameRunning = true;

            gameUIController = GameObject.FindObjectOfType <GameUIController>();
            mapController    = GameObject.FindObjectOfType <MapController>();
            cameraBehavior   = GameObject.FindObjectOfType <CameraBehavior>();
            actionController = GameObject.FindObjectOfType <ActionController>();

            gameUIController.SetMapName(this.mapName);
            actionController.SetSpells(spellsSelected);
        }
        else if (current.name == "Menu")
        {
            menuUIController = GameObject.FindObjectOfType <MenuUIController>();
            menuUIController.UserStatusUpdate(usersInRoom);
            menuUIController.SetUserName(userName);
            if (userColor != null)
            {
                menuUIController.SetPlayerColor(userColor);
            }
        }
    }
Example #12
0
    void Start()
    {
        #if UNITY_EDITOR
        if (GlobalPlayerVariables.save == null)
        {
            print("Loading fake debug save..");
            GlobalPlayerVariables.LoadFakeDebugSave();
        }
        #endif

        Cursor.lockState   = CursorLockMode.Locked;
        cameraController   = transform.GetComponent <CameraController>();
        healthController   = transform.GetComponent <HealthController>();
        movementController = transform.GetComponent <MovementController>();

        // not a direct component of player due to it needing to be attached to MainCamera, but managed as though it were.
        inventoryController = transform.GetComponentInChildren <PlayerInventoryController>();

        // ui components minus anything relating directly to the inventory (ammo, guns)
        uiController = transform.GetComponentInChildren <GameUIController>();
        colorOverlay = transform.GetComponentInChildren <UIColorOverlayController>();
        infoSection  = transform.GetComponentInChildren <UIInfoSectionController>();
        LoadPlayerState();
        uiController.SetValue("UI_HealthPos", (int)Mathf.Clamp(healthController.health, 0f, 999f) + "%");
        uiController.SetValue("UI_ArmorPos", (int)Mathf.Clamp(healthController.armor, 0f, 999f) + "%");
        inventoryController.UpdateGUI();
        //Application.targetFrameRate = 15;
    }
Example #13
0
    //================================================================================================================//

    private void Start()
    {
        levels = GetComponentsInChildren <Level>(true);

        #if !UNITY_EDITOR
        levelIndex = 0;
        #endif

        _instance = this;

        transform = gameObject.transform;

        _gameUiController = FindObjectOfType <GameUIController>();
        _gameManager      = FindObjectOfType <GameManager>();
        activeGarbage     = new List <Draggable>();

        foreach (var level in levels)
        {
            level.gameObject.SetActive(false);
        }

        waiting = true;

        StartLevel();
    }
Example #14
0
    //启动时调用
    void Start()
    {
        UIController    = GetComponent <GameUIController>();
        gm              = GetComponent <GameManager>(); //初始化GameManager静态实例gm
        mainCamera      = Camera.main;                  //获取摄像机
        stateMachineMap = new Dictionary <string, BaseGLStateMachine>();
        gameStateQueue  = new Queue <string>();

        playerCustomProperties = new ExitGames.Client.Photon.Hashtable {
            { "Score", 0 }, { "Death", 0 }
        };                                                                                                  //初始化玩家得分

        PhotonNetwork.player.SetCustomProperties(playerCustomProperties);

        //初始化队伍得分
        currentScoreOfAttackerTeam = 0;
        currentScoreOfDefenderTeam = 0;

        //初始化状态机映射和队列
        initStateMachineMapAndQueue();
        //将队列首的状态机设置为当前状态机
        curGLStatetMachine = stateMachineMap[gameStateQueue.Peek()];
        curGLStatetMachine.Enter();
        m_gameResult = GameResult.none;
        winTeam      = null;
#if (!UNITY_ANDROID)
        UIController.setCursorState(lockCursor);
#endif
    }
Example #15
0
    protected virtual IEnumerator Start()
    {
        while (GameManager.Instance == null)
        {
            yield return(null);
        }

        gameManager = GameManager.Instance;

        while (GameUIController.Instance == null)
        {
            yield return(null);
        }

        uiManager = GameUIController.Instance;

        while (EmojiController.Instance == null)
        {
            yield return(null);
        }

        emojiController = EmojiController.Instance;

        while (ChatController.Instance == null)
        {
            yield return(null);
        }

        chatController = ChatController.Instance;

        //if (isClient)
        //{
        gameManager.AddPlayer(this);
        //}
    }
Example #16
0
    public override void AnimateIn()
    {
        // base.AnimateIn();

        GameController.ChangeGameStates(AppContentStateMeta.appContentStateGameTrainingChoiceQuiz);
        GameUIController.ShowGameModeTrainingModeChoiceQuiz();
    }
Example #17
0
    public void Die()
    {
        //Finding objects
        mainCamera   = GameObject.FindGameObjectWithTag("MainCamera");
        eventHandler = GameObject.FindGameObjectWithTag("EventHandler");

        //Get objects Components
        CameraFollow     camFollow        = mainCamera.GetComponent <CameraFollow>();
        GameUIController gameUIControl    = eventHandler.GetComponent <GameUIController>();
        CoinSystem       coinSystem       = eventHandler.GetComponent <CoinSystem>();
        CollectingSystem collectingSystem = GetComponent <CollectingSystem>();
        GenerateTerrain  generateTerrain  = eventHandler.GetComponent <GenerateTerrain>();

        //Set Variables
        camFollow.isGameStarted = false;
        //Save score and Collected Coins
        coinSystem.SaveCoins(collectingSystem.collectedCoins);
        switch (generateTerrain.gameMode)
        {
        case "DeathRun":
            gameUIControl.SaveDeathRunScore();
            break;

        case "TimeTrial":
            gameUIControl.SaveTimeTrialScore();
            break;
        }

        Destroy(this.gameObject);
    }
    public override void OnButtonClickEventHandler(string buttonName)
    {
        //LogUtil.Log("OnButtonClickEventHandler: " + buttonName);

        if (UIUtil.IsButtonClicked(buttonSettingsAudio, buttonName))
        {
            GameUIController.ShowSettingsAudio();
        }
        else if (UIUtil.IsButtonClicked(buttonSettingsControls, buttonName))
        {
            GameUIController.ShowSettingsControls();
        }
        else if (UIUtil.IsButtonClicked(buttonSettingsProfile, buttonName))
        {
            GameUIController.ShowSettingsProfile();
        }
        else if (UIUtil.IsButtonClicked(buttonSettingsHelp, buttonName))
        {
            GameUIController.ShowSettingsHelp();
        }
        else if (UIUtil.IsButtonClicked(buttonSettingsCredits, buttonName))
        {
            GameUIController.ShowSettingsCredits();
        }
    }
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
    public override void OnButtonClickEventHandler(string buttonName)
    {
        bool loadCharacter = false;

        /*
         * if (UIUtil.IsButtonClicked(buttonPlayerUCFObject, buttonName)) {
         *
         *  GameProfileCustomItem customItem = GameProfileCharacters.currentCustom;
         *
         *  // SET CUSTOM VALUES FOR THIS PLAYER
         *
         *  customItem = GameCustomController.UpdateTexturePresetObject(
         *      customItem, GameController.CurrentGamePlayerController.gameObject,
         *      AppContentAssetTexturePresets.Instance.GetByCode("fiestabowl"));
         *
         *  customItem = GameCustomController.UpdateColorPresetObject(
         *      customItem, GameController.CurrentGamePlayerController.gameObject,
         *      AppColorPresets.Instance.GetByCode("game-college-ucf-knights"));
         *
         *  GameCustomController.SaveCustomItem(customItem);
         *
         *  loadCharacter = true;
         * }
         * else if (UIUtil.IsButtonClicked(buttonPlayerBUObject, buttonName)) {
         *
         *  GameProfileCustomItem customItem = GameProfileCharacters.currentCustom;
         *
         *  // SET CUSTOM VALUES FOR THIS PLAYER
         *
         *  customItem = GameCustomController.UpdateTexturePresetObject(
         *      customItem, GameController.CurrentGamePlayerController.gameObject,
         *      AppContentAssetTexturePresets.Instance.GetByCode("fiestabowl"));
         *
         *  customItem = GameCustomController.UpdateColorPresetObject(
         *      customItem, GameController.CurrentGamePlayerController.gameObject,
         *      AppColorPresets.Instance.GetByCode("game-college-baylor-bears"));
         *
         *  GameCustomController.SaveCustomItem(customItem);
         *
         *  loadCharacter = true;
         * }
         * else
         */

        if (UIUtil.IsButtonClicked(buttonPlayerDefaultObject, buttonName))
        {
            loadCharacter = true;
        }

        if (loadCharacter)
        {
            LogUtil.Log("Player Clicked: " + buttonName);

            GameController.LoadCurrentProfileCharacter();
#if ENABLE_FEATURE_GAME_MODE
            GameUIController.ShowGameMode();
#endif
        }
    }
 private void Awake()
 {
     Input.multiTouchEnabled = true;
     gameStateData           = GameFacade.GetInstance().gameStateData;
     audioController         = GameFacade.GetInstance().AudioController;
     enemyController         = GameFacade.GetInstance().EnemyController;
     gameUIController        = GameFacade.GetInstance().GameUIController;
 }
 // Use this for initialization
 void Start()
 {
     rat      = GameObject.FindGameObjectWithTag("Rat");
     ratAnim  = rat.GetComponent <Animator>();
     guic     = GameObject.Find("Canvas/GameUI").GetComponent <GameUIController>();
     cat      = GameObject.FindGameObjectWithTag("Player");
     ventilGC = GameObject.Find("VentilationGame").GetComponent <VentilationGameController>();
 }
Example #23
0
    public override void OnBeginScene()
    {
        mGameUIController = new GameUIController(FindObjectOfType <GameUIView>(), FindObjectOfType <GamePersistentData>());

        IMenuContext menuContext = FindObjectOfType <MenuContext>();

        menuContext.Hide();
    }
        public void Visit()
        {
            CreatePlanets();

            GalaxyController.RemoveVisistable(this);            //Remove this from visitable things.
            PlanetarySystemController.SetPlanetarySystem(this); //Set the current planetary system.
            GameUIController.CreatePlanetarySystemScreen();     //Create the UI.
        }
Example #25
0
 void Awake()
 {
     mapCtrl = GetComponent<MapController>();
     wispCtrl = GetComponent<WispController>();
     unitCtrl = GetComponent<UnitController>();
     camCtrl = GetComponent<CameraController>();
     gameUICtrl = GetComponent<GameUIController>();
     spLib = GetComponent<SpriteLibrary>();
 }
    private void Start()
    {
        if (Instance != null)
        {
            return;
        }

        Instance = this;
    }
Example #27
0
    // Start is called before the first frame update
    void Start()
    {
        eraserCol    = gameObject.GetComponent <CircleCollider2D>();
        sR           = gameObject.GetComponent <SpriteRenderer>();
        uiController = GameObject.Find("SceneManager").GetComponent <GameUIController>();

        sR.enabled        = false;
        eraserCol.enabled = false;
    }
Example #28
0
 // Start is called before the first frame update
 void Start()
 {
     Cursor.visible  = false;
     player          = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>();
     uiController    = GameObject.FindGameObjectWithTag("UIController").GetComponent <GameUIController>();
     doors           = FindObjectsOfType <Door>();
     pushPullObjects = FindObjectsOfType <PushPullObject>();
     kickObjects     = FindObjectsOfType <KickObject>();
 }
Example #29
0
    void InitInstance()
    {
        if (Instance != null)
        {
            Debug.Log("More than one GameUIController created!");
        }

        Instance = this;
    }
    private void Awake()
    {
        if (instance != null)
        {
            return;
        }

        instance = this;
    }
Example #31
0
    public void getScore()
    {
        GameObject       myObject   = GameObject.FindWithTag("GameUI");
        GameUIController controller = myObject.GetComponent <GameUIController>();

        score = controller.GetCurrentScore();
        myObject.SetActive(false);
        Destroy(myObject);
    }
    // Use this for initialization
    void Awake()
    {
        if (gameUIController != null && gameUIController != this) {
                        Destroy (this.gameObject);
                        return;
                } else {
                        gameUIController = this;
                }

                DontDestroyOnLoad (this.gameObject);
    }