Exemplo n.º 1
0
    public static PointsPopup Create(Vector3 position, string text, Color color)
    {
        Transform   damagePopupTransform = Instantiate(GameAssets.i.pfDamagePopup, position, Quaternion.identity);
        PointsPopup damagePopup          = damagePopupTransform.GetComponent <PointsPopup>();

        damagePopup.Setup(text, color);
        return(damagePopup);
    }
Exemplo n.º 2
0
    //detects collision with coins
    void OnTriggerEnter2D(Collider2D hitInfo)
    {
        if (hitInfo.gameObject.CompareTag("yellowCoin"))
        {
            soundMan.Play("CoinCollect");
            levelMan.AddCoinsScore(10);
            currentxp += 8;
            UpdatePowerupBar(currentxp / Powerxp);

            PointsPopup.Create(gameObject.transform.position, "+10¢", Color.yellow);
            Destroy(hitInfo.gameObject);
        }
        else if (hitInfo.gameObject.CompareTag("redCoin"))
        {
            soundMan.Play("CoinCollect");
            levelMan.AddCoinsScore(30);
            currentxp += 15;
            UpdatePowerupBar(currentxp / Powerxp);

            PointsPopup.Create(gameObject.transform.position, "+30¢", Color.yellow);
            Destroy(hitInfo.gameObject);
        }

        else if (hitInfo.gameObject.CompareTag("blueCoin"))
        {
            soundMan.Play("PowerReady");
            levelMan.AddCoinsScore(50);
            currentxp = 100;
            if (currentxp > Powerxp)
            {
                currentxp = 100;
            }
            UpdatePowerupBar(currentxp / Powerxp);

            PointsPopup.Create(gameObject.transform.position, "+50¢", Color.yellow);
            Destroy(hitInfo.gameObject);
        }

        else if (hitInfo.gameObject.CompareTag("healthCoin"))
        {
            soundMan.Play("Heal");
            health += 25;
            if (health > StartingHealth)
            {
                health = StartingHealth;
            }
            SetHealthBarSize(health / StartingHealth);
            PointsPopup.Create(gameObject.transform.position, "+25hp", Color.green);
            Destroy(hitInfo.gameObject);
        }
    }
Exemplo n.º 3
0
    void makePointsPopups()
    {
        //for( int i = 0; i < 3;i++) {
        Transform par = transform.parent.Find("pointsPanel");

        pointsAnim = par.GetComponent <Animator>();
        foreach (Transform hn in par)
        {
            //GameObject hn = (GameObject)Instantiate(pointsPopupRef, transform.position, Quaternion.identity);
            //hn.SetParent(transform.parent,false);
            //hn.GetComponent<MeshRenderer>().sortingLayerName = "UI";
            var p = new PointsPopup(hn.gameObject, hn.Find("num").GetComponent <Text>(), hn.Find("bonus").GetComponent <Text>(), hn.GetComponent <Animator>());
            popups.Add(p);
        }
    }
Exemplo n.º 4
0
    public void GiveHealth()
    {
        player.soundMan.Play("Heal");
        player.health += healthAmount;
        PointsPopup.Create(gameObject.transform.position, "+" + healthAmount.ToString() + "hp", Color.green);
        GameObject healthEffect = (GameObject)Instantiate(healthEffectRef);

        healthEffect.transform.position = new Vector3(transform.position.x, transform.position.y + .3f, transform.position.z);
        if (player.health >= player.StartingHealth)
        {
            player.health = player.StartingHealth;
        }
        player.SetHealthBarSize(player.health / player.StartingHealth);
        player.currentxp -= player.Powerxp / usage;
        if (player.currentxp < 0f)
        {
            player.currentxp = 0;
        }
        player.UpdatePowerupBar(player.currentxp / player.Powerxp);
        player.powered = false;
    }
Exemplo n.º 5
0
 void makePointsPopups()
 {
     //for( int i = 0; i < 3;i++) {
     Transform par = transform.parent.Find ("pointsPanel");
     pointsAnim = par.GetComponent<Animator>();
     foreach(Transform hn in par){
         //GameObject hn = (GameObject)Instantiate(pointsPopupRef, transform.position, Quaternion.identity);
         //hn.SetParent(transform.parent,false);
         //hn.GetComponent<MeshRenderer>().sortingLayerName = "UI";
         var p = new PointsPopup(hn.gameObject,hn.Find("num").GetComponent<Text>(),hn.Find("bonus").GetComponent<Text>(),hn.GetComponent<Animator>());
         popups.Add(p);
     }
 }