Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UIText not always showing up #164

Open
t0n1zz opened this issue Jun 7, 2014 · 0 comments
Open

UIText not always showing up #164

t0n1zz opened this issue Jun 7, 2014 · 0 comments

Comments

@t0n1zz
Copy link

t0n1zz commented Jun 7, 2014

So i using uitext to showing pop up text that show amount of score player from each enemy that destroyed and it show up only in the beginning of the game after the enemies getting more and more the uitext start being weird, first the "+" disappear and after that it only show 0 and then not showing anything....

any idea why? or maybe my way of implementing it wrong?
i put this script in my enemies gameobject

bellow is the void for handle taking damage and showing pop up text when enemies dies

public void Damage(float damageCount)
{
    hp -= damageCount;
    healthMeter -= damageCount;
    if (healthMeter <= 0)
    {
        if (hp > 0)
        {
            healthMeter = 1;
        }
    }
    if(hp <= 0)
    {
        healthMeter = 0;
        SpecialEffectHelper.Instance.Explosion(transform.position);

        if (isEnemy)
        {
            int points = scorePoint * gameGUIScript.combo;
            var text = new UIText("spritefont", "spritefont.png");
            UITextInstance pointText = text.addTextInstance("+" + points,0,0);
            pointText.textScale = .7f;
            Color pointTextColor = pointText.color;
            pointTextColor.a = .3f;
            pointText.color = pointTextColor;
            pointText.positionFromTopRight(.06f, .08f);
            pointText.alphaTo(.5f, 0, Easing.Linear.easeIn);
        }
        Destroy(gameObject);
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant