コード例 #1
0
    // used to refresh number of keys needed to win the game
    // called whenever keys are added or removed from the block pooler
    public void RefreshWinObjective(Transform towerClicked)
    {
        int blocksInPlay = this.blockPooler.GetComponent <BlockPooler> ().GetBlocksInPlay();
        int winObjective = Mathf.Clamp(blocksInPlay, 1, GameConstants.maxTowerHeight);

        heightToWin = winObjective;
        foreach (GameObject girl in bestGirls)
        {
            WinCatcher girlWC = girl.GetComponent <WinCatcher> ();
            girlWC.CheckIfBestGirl(null);
        }
        blocksToWin.text = "Keys Needed To Win: " + winObjective;
    }
コード例 #2
0
 // used to transition from game to ending
 // takes a WinCatcher parameter from the best girl who won
 public void TransitionToEnding(WinCatcher bestGirl)
 {
     this.gamePhase = GamePhase.Ending;
     this.endingPanel.SetActive(true);
     this.gameArea.SetActive(false);
     // set best girl parameters based on who won
     if (bestGirl != null)
     {
         EndingHandler endingHandler = this.endingPanel.GetComponent <EndingHandler> ();
         endingHandler.SetBestGirlName(bestGirl.bestGirlName);
         endingHandler.SetBestGirlRemark(bestGirl.bestGirlRemark);
         endingHandler.SetBestGirlSprite(bestGirl.bestGirlSprite);
     }
 }
コード例 #3
0
    void Start()
    {
        // subscribe game phase to dialogue handler's finished event
        this.dialogHandler.DialogueFinishedEvent += this.TransitionToGame;

        // subscribe ending phase to each of the best girls' height to win reached events
        foreach (GameObject girl in this.bestGirls)
        {
            WinCatcher girlWC = girl.GetComponent <WinCatcher> ();
            girlWC.HeightToWinReachedEvent += this.TransitionToEnding;
        }

        BlockPooler blockPooler = this.blockPooler.GetComponent <BlockPooler> ();

        blockPooler.TowerGrowEvent += this.RefreshWinObjective;
        blockPooler.TowerChopEvent += this.RefreshWinObjective;
    }