Beispiel #1
0
    private int GetScore(Bouncer.SIZE size)
    {
        switch (size)
        {
        case Bouncer.SIZE.LARGE:
            return(largeBouncerScore);

        case Bouncer.SIZE.MEDIUM:
            return(mediumBouncerScore);

        case Bouncer.SIZE.SMALL:
            return(smallBouncherScore);
        }

        return(0);
    }
Beispiel #2
0
    public float tweenDistFromBouncerSize(Bouncer.SIZE bouncerSize)
    {
        switch (bouncerSize)
        {
        case Bouncer.SIZE.SMALL:
            return(100f);

        case Bouncer.SIZE.MEDIUM:
            return(180f);

        case Bouncer.SIZE.LARGE:
            return(250f);

        default:
            return(100f);
        }
    }
Beispiel #3
0
    public void CreateScoreTextPopup(Vector3 position, int score, Color textColor, Bouncer.SIZE bouncerSize)
    {
        string  t            = string.Format("{0}!", score);
        Vector3 initialScale = Vector3.one;

        if (score == 0)
        {
            t            = ""; //GreyTexts[Random.Range(0, GreyTexts.Count)];
            initialScale = 0.8f * Vector3.one;
        }

        GameObject textPopupGO = (GameObject)Instantiate(textPopupPrefab, position, Quaternion.identity);

        textPopupGO.transform.SetParent(textPopupContainer.transform, true);
        textPopupGO.transform.localScale = initialScale;


        float textAngle = Random.Range(-35f, 35f);

        textPopupGO.transform.Rotate(new Vector3(0f, 0f, textAngle));

        Text textPopup = textPopupGO.GetComponent <Text> ();

        textPopup.text  = t;
        textPopup.color = textColor;


        //iTween.FadeTo(textPopupGO, iTween.Hash ("alpha", 0f, "time", 0.5f, "delay", 0.5f));
        float tweenDist = tweenDistFromBouncerSize(bouncerSize);

        iTween.ScaleTo(textPopupGO, iTween.Hash("scale", 2f * textPopupGO.transform.localScale, "time", 0.7f,
                                                "easetype", iTween.EaseType.easeOutCubic));
        iTween.MoveTo(textPopupGO, iTween.Hash(
                          "x", textPopupGO.transform.position.x - tweenDist * Mathf.Sin(textAngle * Mathf.Deg2Rad),
                          "y", textPopupGO.transform.position.y + tweenDist * Mathf.Cos(textAngle * Mathf.Deg2Rad),
                          "time", 1f,
                          "easetype", iTween.EaseType.easeOutCubic));


        Destroy(textPopupGO, 1.1f);
    }