public override void OnCollisionEnter(Collision col)
    {
        if (col.gameObject.tag.Contains("Cow"))
        {
            Attack(HeroStats.GetCowLevel());
        }
        if (col.gameObject.tag.Contains("Chicken"))
        {
            Attack(HeroStats.GetChickenLevel());
        }
        if (col.gameObject.tag.Contains("Pig"))
        {
            Attack(HeroStats.GetPigLevel());
        }
        if (col.gameObject.tag.Contains("Duck"))
        {
            Attack(HeroStats.GetDuckLevel());
        }
        if (col.gameObject.tag.Contains("Sheep"))
        {
            Attack(HeroStats.GetSheepLevel());
        }

        if (col.gameObject.tag.Contains("Enemy"))
        {
            col.gameObject.GetComponent <EnemyBehaviour>().GetDamage(weaponDamage);
        }
    }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        healthBar.fillAmount = (float)HeroStats.GetCurrentHP() / HeroStats.GetMaxHP();
        health.text          = "Punkty życia: " + HeroStats.GetCurrentHP().ToString() + " / " + HeroStats.GetMaxHP().ToString();
        strength.text        = "Siła: " + HeroStats.GetStrength().ToString();
        attackSpeed.text     = "Szybkość ataku: " + HeroStats.GetAttackSpeed().ToString();
        level.text           = "Poziom: " + HeroStats.GetLevel().ToString();
        exp.text             = "Exp: " + HeroStats.GetExp().ToString();
        expNextLevel.text    = "Exp do następnego poziomu: " + HeroStats.GetNextLevel().ToString();
        chickenLevel.text    = "Poziom walki - kurczak: " + HeroStats.GetChickenLevel().ToString();
        cowLevel.text        = "Poziom walki - krowa: " + HeroStats.GetCowLevel().ToString();
        pigLevel.text        = "Poziom walki - świnia: " + HeroStats.GetPigLevel().ToString();
        duckLevel.text       = "Poziom walki - kaczka: " + HeroStats.GetDuckLevel().ToString();
        sheepLevel.text      = "Poziom walki - owca: " + HeroStats.GetSheepLevel().ToString();
        killedChicken.text   = "Kura: " + HeroStats.GetKilledAllChicken().ToString();
        killedCow.text       = "Krowa: " + HeroStats.GetKilledAllCow().ToString();
        killedPig.text       = "Świnia: " + HeroStats.GetKilledAllPig().ToString();
        killedDuck.text      = "Kaczka: " + HeroStats.GetKilledAllDuck().ToString();
        killedSheep.text     = "Owca: " + HeroStats.GetKilledAllSheep().ToString();

        InputUI();

        if (isUIActive)
        {
            backround.SetActive(true);
        }
        else
        {
            backround.SetActive(false);
        }

        if (isUIStatsActive)
        {
            killedChicken.enabled = true;
            killedCow.enabled     = true;
            killedDuck.enabled    = true;
            killedPig.enabled     = true;
            killedSheep.enabled   = true;
        }
        else
        {
            killedChicken.enabled = false;
            killedCow.enabled     = false;
            killedDuck.enabled    = false;
            killedPig.enabled     = false;
            killedSheep.enabled   = false;
        }
    }