Esempio n. 1
0
    void OnTriggerEnter2D(Collider2D col)
    {
        targetdir = parentscript.gettargetdir();

        if (col.CompareTag("normal"))
        {
            hitbody      = col.transform;
            normalscript = hitbody.GetComponent <normalai>();
            //if (normalscript.checkincar())
            //{
            //    normalscript.hitincar(hitcoefficient * (1 - hitbody.GetComponent<normalai>().checkslowpercent()));
            //}
            //else {}
            hitvel = hitcoefficient * targetdir * (basepower + (maxhitcharge));
            normalscript.hit(hitvel);

            hitbody.GetComponent <health>().Hurt(damagecoefficient * (basedamage + (maxdamagecharge)));
            screenctrl.StopScreen(0.01f);
            return;
        }

        if (col.CompareTag("Player"))
        {
            hitbody      = col.transform;
            playerscript = hitbody.GetComponent <movementctrl>();

            hitvel = hitcoefficient * targetdir * (basepower + (maxhitcharge));
            playerscript.hit(hitvel);

            hitbody.GetComponent <health>().Hurt(damagecoefficient * (basedamage + (maxdamagecharge)));
            screenctrl.StopScreen(0.01f);
            return;
        }
    }