Exemplo n.º 1
0
    private void UpdateText()
    {
        BallSpawn ball = new BallSpawn();

        cubeCountText.text = "Cubes Left: " + cubeCount;
        ballCountText.text = "Balls Left: " + ballCount;
    }
Exemplo n.º 2
0
    private void SpawnBall(Vector2 levelCenter, Vector2 normalizedDirection)
    {
        _ball = Instantiate(ball, levelCenter, Quaternion.identity);
        _ball.GetComponent <Rigidbody2D>().velocity = normalizedDirection * ball.GetComponent <Ball>().ballSpeed;

        BallSpawn?.Invoke(_ball);
    }
Exemplo n.º 3
0
    private void Start()
    {
        cubeCount = cubes.childCount;

        StartCoroutine("UpdateCanvas");

        BallSpawn ball = new BallSpawn();

        ballCount = ball.BallCount;
    }
Exemplo n.º 4
0
 void Awake()
 {
     if (bs == null)
     {
         bs = this;
     }
     else if (bs != this)
     {
         Destroy(gameObject);
     }
 }
Exemplo n.º 5
0
    // Use this for initialization
    void Start()
    {
        ballTimer = gameObject.AddComponent <Timer>();
        ballTimer.AddTimerFinishedListener(HandleBallTimerFinished);
        ballTimer.Duration = ConfigurationUtils.BallLifeTime;
        ballTimer.Run();
        moveTimer = gameObject.AddComponent <Timer>();
        moveTimer.AddTimerFinishedListener(HandleMoveTimerFinished);
        moveTimer.Duration = 1;
        moveTimer.Run();
        speedUpTimer = gameObject.AddComponent <Timer>();
        speedUpTimer.AddTimerFinishedListener(HandleSpeedUpTimerFinished);
        speedUp = false;
        EventManager.AddSpeedUpEffectListener(HandleSpeedUpEffect);
        ballMiss = new BallMiss();
        EventManager.AddBallMissInvoker(this);

        ballSpawn = new BallSpawn();
        EventManager.AddBallSpawnInvoker(this);
    }