Beispiel #1
0
    private void OnTriggerEnter(Collider other)
    {
        Ene enemy = other.GetComponent <Ene>();

        if (enemy != null)
        {
            enemy.Damaging(damage);
        }
        Destroy(gameObject);
    }
Beispiel #2
0
    void Shot()
    {
        RaycastHit2D hitInformation = Physics2D.Raycast(fireSpot.position, fireSpot.right);

        if (hitInformation)
        {
            Ene enemy = hitInformation.transform.GetComponent <Ene>();
            if (enemy != null)
            {
                enemy.Damaging(dama);
            }

            Instantiate(imaEff, hitInformation.point, Quaternion.identity);
        }
    }