Ejemplo n.º 1
0
    public void Proceed()
    {
        Close();

        HUD.instance.HideAll();

        //update score
        GameData.instance.currentScore = mNewScore;

        if (GameStart.isStarted)
        {
            GameFlowController.ProgressAndLoadNextScene();
        }
        else
        {
            //this is for test in editor if we started the scene on the level
            int progressInd = GameData.instance.GetProgressFromCurrentScene();
            if (progressInd == -1)
            {
                if (string.IsNullOrEmpty(GameData.instance.endScene.name))
                {
                    M8.SceneManager.instance.LoadRoot();
                }
                else
                {
                    M8.SceneManager.instance.LoadScene(GameData.instance.endScene.name);
                }
            }
            else
            {
                M8.SceneManager.instance.LoadScene(GameData.instance.scenes[progressInd].name);
            }
        }
    }
 public static GameFlowController Instance()
 {
     if (_instance == null)
     {
         _instance = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameFlowController> ();
     }
     return(_instance);
 }
Ejemplo n.º 3
0
 void Start()
 {
     player     = LevelAccess.GetPlayerPos();
     visibility = player.GetComponent <PlayerVisibility>();
     //resetPlayerPosition = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerPos>();
     //resetEnemiesPosition = GameObject.FindGameObjectsWithTag("Enemy");
     gameFlowController = GameObject.FindGameObjectWithTag("GameFlowController").GetComponent <GameFlowController>();
 }
Ejemplo n.º 4
0
 void Start()
 {
     playerInRange = false;
     used          = false;
     Init();
     feedback           = GameObject.FindGameObjectWithTag("Feedback").GetComponent <Text>();
     gameFlowController = GameObject.FindGameObjectWithTag("GameFlowController").GetComponent <GameFlowController>();
 }
Ejemplo n.º 5
0
    private IEnumerator EndLevel()
    {
        yield return(new WaitForSeconds(.1f));

        GameFlowController gfc = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameFlowController>();

        gfc.OnLevelComplete();
    }
Ejemplo n.º 6
0
 protected void Start()
 {
     audioSource = GetComponent <AudioSource>();
     animation   = GetComponent <Animation>();
     onGameEnd.Register(OnGameEnd);
     cachedGameFlow = GameFlowController.Instance;
     restartButton.SetActive(false);
     continueButton.SetActive(true);
 }
Ejemplo n.º 7
0
 // Use this for initialization
 void Start()
 {
     targetRot = transform.rotation;
     bullets   = maxBullets;
     health    = maxHealth;
     inCover   = false;
     audio     = GetComponent <AudioSource>();
     mCon      = mController.GetComponent <MasterController>();
     flowCon   = mController.GetComponent <GameFlowController>();
 }
Ejemplo n.º 8
0
 // Start is called before the first frame update
 void Start()
 {
     slider      = transform.parent.Find("EnemyAnimator/Canvas/Slider").gameObject.GetComponent <Slider>();
     player      = LevelAccess.GetPlayerPos();
     patrol      = GetComponent <EnemyPatrol>();
     visibility  = player.GetComponent <PlayerVisibility>();
     catchAmount = 0f;
     caught      = false;
     outside     = true;
     slider.gameObject.SetActive(false);
     gfc = GameObject.FindGameObjectWithTag("GameFlowController").GetComponent <GameFlowController>();
 }
Ejemplo n.º 9
0
 public void ProgressBegin(string introScene)
 {
     if (LoLManager.instance.curProgress == 0)
     {
         M8.SceneManager.instance.LoadScene(introScene);
     }
     else
     {
         LoLMusicPlaylist.instance.PlayStartMusic();
         GameFlowController.LoadCurrentProgressScene();
     }
 }
Ejemplo n.º 10
0
    public bool endless = false; // this bool is whether the game is in endless mode or not (set by `SetScoreGoal`).

    void Start()
    {
        main = this;

        buildIndex = SceneManager.GetActiveScene().buildIndex;

        score          = ScorePackage.main.startingScore; // this gets the score from the previous scene ...
        ScoreText.text = "Score: " + score.ToString();    // ... and this updates the score text accordingly.
        SetScoreGoal();

        playerLifeCounter = 3;
    }
Ejemplo n.º 11
0
 // Use this for initialization
 void Start()
 {
     gc = GameObject.Find ("GameController").GetComponent<GameFlowController>();
     player = GameObject.Find("Player").transform;
     playerRender = GameObject.Find("Player");
     currLid = closeLid;
     worldJump = 0;
     isJumping = false;
     ParticleSystem[] systems = GameObject.Find("Player").GetComponentsInChildren<ParticleSystem>();
     foreach (ParticleSystem ps in systems){
         if (ps.tag == "Lightning"){
             thunder = ps;
         }
     }
     thunder.enableEmission = false;
 }
Ejemplo n.º 12
0
    public void Init(GameFlowController gameFlowController, Level level)
    {
        this.gameFlowController = gameFlowController;
        FindAndSetAllSubPanels();
        AddListenerToPausePanelButtons();
        this.activeLevel = level;
        if (this.activeLevel == null)
        {
            Debug.LogError("GuiManager activeLevel is null");
        }

        this.currentLevelNumber = gameFlowController.getSceneLevelNumber();
        if (this.currentLevelNumber == -1)
        {
            Debug.LogError("currentLevelNumber could not be loaded in GuiManager");
        }

        // Show Introduction just in the first level else show the enemytypes
        if (this.currentLevelNumber == 1)
        {
            ShowIntroduction();
        }

        if (this.currentLevelNumber == 2)
        {
            ShowEnemyVegan();
        }

        if (this.currentLevelNumber == 3)
        {
            ShowEnemyFattie();
        }

        if (this.currentLevelNumber == 4)
        {
            SetVisibilityAllPanels(false);
            SetVisibilityCursor(true);
            OnNextIntroductionSandwichButton();
        }

        if (this.currentLevelNumber == 5)
        {
            SetVisibilityAllPanels(false);
            SetVisibilityCursor(true);
            OnNextIntroductionSandwichButton();
        }
    }
Ejemplo n.º 13
0
    // Use this for initialization
    IEnumerator Start()
    {
        //wait for scene to load
        while (M8.SceneManager.instance.isLoading)
        {
            yield return(null);
        }

        //determine which stars to activate
        if (GameData.isInstantiated)
        {
            float score    = GameData.instance.currentScore;
            float maxScore = GameData.instance.scorePerLevel * 8.0f; //TODO: need actual level count

            int index = maxScore > 0f ? Mathf.RoundToInt((stars.Length - 1) * Mathf.Clamp01(score / maxScore)) : 0;
            if (index >= stars.Length)
            {
                index = stars.Length - 1;
            }

            stars[index].SetActive(true);
        }
        else
        {
            stars[Random.Range(0, stars.Length)].SetActive(true);
        }

        //play
        animator.Play(takePlay);

        do
        {
            yield return(null);
        } while(animator.isPlaying);

        //auto end
        if (autoEndDelay > 0f)
        {
            yield return(new WaitForSeconds(autoEndDelay));

            completeButton.interactable = false;

            GameFlowController.Complete();
        }
    }
Ejemplo n.º 14
0
    // Start is called before the first frame update
    void Start()
    {
        timer     = preCountDown;
        started   = false;
        finished  = false;
        score     = 0;
        highScore = PlayerPrefs.GetInt("high_score");

        if (!timerLabel)
        {
            Debug.LogError("No UI timer label!");
        }
        timerLabel.color = Color.yellow;
        if (!scoreLabel)
        {
            Debug.LogError("No score label!");
        }

        gameFlowController = EventSystem.current.gameObject.GetComponent <GameFlowController>();
    }
Ejemplo n.º 15
0
    IEnumerator Start()
    {
        if (!onlineMode)
        {
            using (WWW www = new WWW(url))
            {
                yield return(www);

                dataAsJson = www.text;
            }
            //yield return GetWWWJson();
            Debug.Log("get dataAsJson Over" + dataAsJson);
        }

        if (players.Count == 0)
        {
            PlayerInfo player = new PlayerInfo("本地主机", PlayerType.LOCAL);
            players.Add(player);
            players.Add(new PlayerInfo("电脑人", PlayerType.AI));
            players.Add(new PlayerInfo("恶魔人", PlayerType.AI));
        }
        GenerateChessBoards(players);
        InitShop();

        if (!onlineMode)
        {
            LocalInitEveryShop();
        }

        LocalPlayerController localPlayerCtrl = this.gameObject.GetComponent <LocalPlayerController> ();
        GameFlowController    flowCtrl        = GetComponent <GameFlowController> ();

        localPlayerCtrl.DataReady(this);
        flowCtrl.DataReady(this);
        Debug.Log("Data Controller Start over");
    }
Ejemplo n.º 16
0
    IEnumerator DoGoNextPage()
    {
        animator.Play(takeInteractExit);

        bool isLastPage = mCurPageInd == pages.Length - 1;

        if (mCurPageInd < pages.Length)
        {
            var page = pages[mCurPageInd];

            if (page.animator)
            {
                page.animator.Play(page.takeExit);
                while (page.animator.isPlaying)
                {
                    yield return(null);
                }
            }

            //only deactivate if it's the last page or the next page has a different root
            if (isLastPage || page.root != pages[mCurPageInd + 1].root)
            {
                page.root.SetActive(false);
            }
        }

        if (!isLastPage)
        {
            mCurPageInd++;
            ShowCurrentPage();
        }
        else //proceed to gameplay
        {
            GameFlowController.LoadCurrentProgressScene();
        }
    }
Ejemplo n.º 17
0
 private void Awake()
 {
     Instance = this;
 }
 void Start()
 {
     //get GameFlowController (GUI)
     tmpGFC = cubeGUI.GetComponent<GameFlowController>();
 }
Ejemplo n.º 19
0
 public void ProgressStart()
 {
     GameFlowController.LoadCurrentProgressScene();
 }
Ejemplo n.º 20
0
    IEnumerator DoLaunch()
    {
        var ctrl = GameRocketLaunchController.instance;

        var waitSecond = new WaitForSeconds(1f);

        LoLMusicPlaylist.instance.Stop();

        AddConsoleText("launchSequence1"); //prep

        ctrl.StartPump();
        while (ctrl.isPumping)
        {
            yield return(null);
        }

        AddConsoleText("launchSequence2"); //ignitions start

        ctrl.StartIgnition();

        LoLManager.instance.PlaySound(soundRocketIgniteFirstPath, false, true);

        yield return(waitSecond);

        AddConsoleText("launchSequence3"); //start countdown

        yield return(waitSecond);

        //countdown
        LoLManager.instance.PlaySound(soundConsoleBeepPath, false, false);
        AddConsoleText("launchSequence4");
        yield return(waitSecond);

        LoLManager.instance.PlaySound(soundConsoleBeepPath, false, false);
        AddConsoleText("launchSequence5");
        yield return(waitSecond);

        LoLManager.instance.PlaySound(soundConsoleBeepPath, false, false);
        AddConsoleText("launchSequence6");
        yield return(waitSecond);

        LoLManager.instance.PlaySound(soundConsoleBeepPath, false, false);
        AddConsoleText("launchSequence7");
        yield return(waitSecond);

        LoLManager.instance.PlaySound(soundConsoleBeepPath, false, false);
        AddConsoleText("launchSequence8");
        yield return(waitSecond);

        LoLManager.instance.PlaySound(soundConsoleBeepPath, false, false);
        AddConsoleText("launchSequence9");
        yield return(waitSecond);

        AddConsoleText("launchSequence10"); //engines are go!

        ctrl.LiftOff();

        LoLManager.instance.StopSound(soundRocketIgniteFirstPath);
        LoLManager.instance.PlaySound(soundRocketIgniteSecondPath, false, true);

        yield return(waitSecond);

        LoLMusicPlaylist.instance.PlayStartMusic();

        AddConsoleText("launchSequence11"); //lift-off! we have a lift-off!

        //wait for launch to finish
        while (ctrl.isLiftingOff)
        {
            yield return(null);
        }

        LoLManager.instance.StopSound(soundRocketIgniteSecondPath);

        AddConsoleText("launchSequence12");

        yield return(new WaitForSeconds(2.0f));

        //go to ending
        if (GameStart.isStarted)
        {
            GameFlowController.ProgressAndLoadNextScene();
        }
        else
        {
            var endScene = GameData.instance.endScene;
            endScene.Load();
        }
    }
Ejemplo n.º 21
0
 public void Complete()
 {
     GameFlowController.Complete();
 }
Ejemplo n.º 22
0
 public void Progress()
 {
     GameFlowController.ProgressAndLoadNextScene();
 }
 private void Awake()
 {
     flowController = FindObjectOfType <GameFlowController>();
     playButton.onClick.AddListener(OnPlay);
     quitButton.onClick.AddListener(OnQuit);
 }
Ejemplo n.º 24
0
 private void Awake()
 {
     flowController = FindObjectOfType <GameFlowController>();
 }
Ejemplo n.º 25
0
 protected void Start()
 {
     cachedGameFlow = GameFlowController.Instance;
     onBlowStatusChanged.Register(OnBlowStatusChange);
     Countdown.Instantiate(3, "GO!", 1.0f, () => { isGamePaused = false; Debug.Log("GO!!!"); });
 }
Ejemplo n.º 26
0
 bool BothReady()
 {
     return
         (GameFlowController.Instance().nameSelectorPlayer1.IsReady&&
          GameFlowController.Instance().nameSelectorPlayer2.IsReady);
 }
Ejemplo n.º 27
0
 void Continue()
 {
     GameFlowController.Instance().PrepareGame();
 }