Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        bigPicture = GameObject.Find("BigPicture");
        helpText = GameObject.Find("HelpText");
        driverState = GameDriverState.Start;
        pc = GameObject.Find("PulseController").GetComponent<PulseController>();
        tm = GameObject.Find("TypeMaster").GetComponent<TypeMaster>();
        gameState = GameObject.Find("GameState").GetComponent<GameState>();

        if (gameState.gameConfig != null)
        {
            bigPicture.GetComponent<Renderer>().material.SetTexture("_MainTex", gameState.gameConfig.bigTexture);
            GameObject heart = bigPicture.transform.Find("Heart").gameObject;
            heart.transform.localPosition = gameState.gameConfig.heartOffset;
            float n = gameState.gameConfig.heartScale;
            heart.transform.localScale = new Vector3(n, n, n);
        }
    }
Ejemplo n.º 2
0
 // Update is called once per frame
 void Update()
 {
     switch(driverState)
     {
         case GameDriverState.Start:
             if(Input.GetKeyDown(KeyCode.Space))
             {
                 driverState = GameDriverState.Run;
                 Destroy(helpText);
                 pc.isRunning = true;
                 tm.isRunning = true;
                 gameStart = Time.time;
             }
             break;
         case GameDriverState.Run:
             if (Time.time > gameStart + gameDuration)
             {
                 Debug.Log("No more new beats");
                 pc.makeNewBeats = false;
                 if (!pc.HasBeats())
                 {
                     Debug.Log("It's over!");
                     GameWon();
                 }
             }
             break;
     }
 }
Ejemplo n.º 3
0
 public void GameWon()
 {
     driverState = GameDriverState.Success;
 }
Ejemplo n.º 4
0
 public void GameOver()
 {
     driverState = GameDriverState.Fail;
 }