Esempio n. 1
0
File: Mob.cs Progetto: Bryan9815/SP4
    // when attacked
    public virtual void getHit(int damage)
    {
        //calculate how damage is taken here
        Hp -= damage;

        //HS
        Vector3 tempPos = gameObject.transform.position;

        scene = SceneManager.GetActiveScene();
        if (scene.name == "Tutorial")
        {
            tempPos.y += 1.0f;
        }
        else
        {
            tempPos.y += gameObject.GetComponent <Transform>().localScale.y / 2;
        }
        DamageTextManager.GenerateSprite(tempPos, damage);
    }
Esempio n. 2
0
File: Mob.cs Progetto: Bryan9815/SP4
    public virtual void getHit(int damage, bool careAboutTrigger)
    {
        //calculate how damage is taken here
        if (careAboutTrigger)
        {
            if (!isHit)
            {
                Hp -= damage;

                //HS
                Vector3 tempPos = gameObject.transform.position;
                tempPos.y += gameObject.GetComponent <Transform>().localScale.y / 2;
                DamageTextManager.GenerateSprite(tempPos, damage);
            }
        }
        else
        {
            getHit(damage);
        }
    }