Esempio n. 1
0
 void Awake()
 {
     ballManager     = BallManager.GetInstance();
     rb              = GetComponent <Rigidbody2D> ();
     ballArtManager  = GetComponent <BallArtManager> ();
     ballInfo        = GetComponent <BallInfo> ();
     rb.gravityScale = 0;
 }
Esempio n. 2
0
    IEnumerator GameOverProcedure()
    {
        Hand.instance.HandleGameOver();
        yield return(StartCoroutine(BallManager.GetInstance().HandleGameOver()));

        yield return(new WaitForSeconds(.5f));

        yield return(StartCoroutine(ScoreManager.GetInstance().HandleGameOver()));

//		AdManager.GetInstance().CheckAd();
//		yield return StartCoroutine(ReplayManager.GetInstance().PlayReplay());
        ReturnToMainMenu();
    }
Esempio n. 3
0
 // Use this for initialization
 void Start()
 {
     if (!firstBall)
     {
         launching       = true;
         rb.gravityScale = 1;
     }
     else
     {
         BallManager.GetInstance().balls.Add(gameObject);
         rb.gravityScale = 0;
     }
 }
Esempio n. 4
0
    public IEnumerator PlayReplay()
    {
        Debug.Log("Playing replay");

        int frameCountToNow  = Time.frameCount;
        int replayFrameCount = Time.frameCount - frameCountToNow;

        int[] frames = new int[] {
            InputStorage [InputStorage.Count - 1].ballFrameCount,
            InputStorage [InputStorage.Count - 1].frameCountDown,
            InputStorage [InputStorage.Count - 1].frameCountUp
        };

        int framesToPlay = Mathf.Max(frames);

        int replayIndex = 0;

        while (replayFrameCount < framesToPlay)
        {
            if (InputStorage [replayIndex].frameCountDown == replayFrameCount)
            {
                Vector2 pos = InputStorage [replayFrameCount].positionDown;
//				Hand.instance.ReplayFingerDown (pos);
                replayIndex++;
            }

            if (InputStorage [replayIndex].frameCountUp == replayFrameCount)
            {
                Vector2 dir = InputStorage [replayFrameCount].positionUp - InputStorage [replayFrameCount].positionDown;
//				Hand.instance.ReplayFingerUp (dir);
                replayIndex++;
            }

            if (InputStorage [replayIndex].ballFrameCount == replayFrameCount)
            {
//				Debug.Log (InputStorage [replayIndex].ballFrameCount);
//				Debug.Log (InputStorage [replayFrameCount].ballLaunchLocation);
//				Debug.Log (InputStorage [replayFrameCount].firstBall);
                BallManager.GetInstance().LaunchBall(InputStorage [replayFrameCount].ballLaunchLocation, InputStorage [replayFrameCount].firstBall);
                replayIndex++;
            }

            replayFrameCount++;

            Debug.Log(replayIndex);
            Debug.Log(replayFrameCount);
        }
        yield return(0);
    }
Esempio n. 5
0
    public void IncreaseScore()
    {
        // AudioManager.PlayScore ();
        score++;
        if (!ScoreAnimation.flashingScore)
        {
            scoreDisplay.text = score.ToString();
        }

        if (score == 5 ||
            score == 15 ||
            score % 25 == 0)
        {
            BallManager.GetInstance().LaunchBall();
            StartCoroutine(ScoreAnimation.GetInstance().FlashScore());
        }
    }
Esempio n. 6
0
    void SetState(GameState newState)
    {
        state = newState;

//		ButtonManager.GetInstance().UpdateButtons();

        switch (state)
        {
        case GameState.mainMenu:
            UIManager.GetInstance().ScoreActive(false);
            BallManager.GetInstance().SpawnFirstBall();
            break;

        case GameState.gameOn:
            UIManager.GetInstance().ScoreActive(true);
            UIManager.GetInstance().EnableUI(false);
            break;

        case GameState.gameOver:
            StartCoroutine("GameOverProcedure");

            break;
        }
    }
Esempio n. 7
0
    void Explode()
    {
        BallManager.GetInstance().RemoveBall(gameObject);
        // Do a cool explosion
//		Destroy (gameObject);
    }