Exemplo n.º 1
0
 void AnimateCircle()
 {
     if (NewGameManager.GameOver())
     {
         return;
     }
     lineWidth = radius / 10;
 }
Exemplo n.º 2
0
    // Update is called once per frame
    void FixedUpdate()
    {
        if (NewGameManager.GameOver())
        {
            return;
        }

        HandleInput();

        DrawRing();
    }
Exemplo n.º 3
0
    public void GetCaughtAndThrown(Vector2 throwVector)
    {
        if (m_Launching || NewGameManager.GameOver())
        {
            return;
        }

        rb.velocity = Vector2.zero;
        rb.AddForce(throwVector * rb.mass, ForceMode2D.Impulse);
        rb.gravityScale = defaultGravity;
        EventManager.TriggerEvent("BallSlapped");
    }
Exemplo n.º 4
0
    void CheckBounds()
    {
        Vector3 converted = Camera.main.WorldToScreenPoint(transform.position);

        if (converted.y < 0 || converted.y > Screen.height || converted.x < 0 || converted.x > Screen.width)
        {
            if (!NewGameManager.GameOver() && !dead)
            {
                KillThisBall();
                dead = true;
            }
        }
    }
Exemplo n.º 5
0
    IEnumerator WaitForDrag()
    {
        while (!handDragged)
        {
            if (NewBallManager._ballCount != 1 && !NewGameManager.GameOver())
            {
                yield return(new WaitForSeconds(Random.Range(.2f, .5f)));

                EventManager.TriggerEvent("SpawnBall");
            }

            yield return(new WaitForEndOfFrame());
        }
    }
Exemplo n.º 6
0
    public void GetCaught()
    {
        if (m_Launching || NewGameManager.GameOver())
        {
            return;
        }

        m_IsHeld         = true;
        framesSinceCatch = 0;

        rb.gravityScale = 0;
        rb.velocity     = Vector2.zero;
        EventManager.TriggerEvent("BallCaught");

        GetComponentInChildren <SpriteCircleEffectSpawner>().SpawnRing(transform.position);
    }
Exemplo n.º 7
0
    public void GetThrown(Vector2 throwVector)
    {
        if (m_Launching || NewGameManager.GameOver())
        {
            return;
        }

        m_IsHeld    = false;
        rb.velocity = Vector2.zero;
        rb.AddForce(throwVector * rb.mass, ForceMode2D.Impulse);
        rb.gravityScale = defaultGravity;

        m_BallThrown = true;
        EventManager.TriggerEvent("BallThrown");

        NewBallManager.GetInstance().UpdateEndgame(this);
    }
Exemplo n.º 8
0
    IEnumerator FirstBall()
    {
        yield return(new WaitForSeconds(1.5f));

        while (!ballCaught)
        {
            if (NewBallManager._ballCount < 1 && !NewGameManager.GameOver())
            {
                yield return(new WaitForSeconds(Random.Range(.2f, .5f)));

                EventManager.TriggerEvent("SpawnBall");
            }

            yield return(new WaitForEndOfFrame());
        }

        yield return(null);
    }