예제 #1
0
 void Start()
 {
     rb          = GetComponent <Rigidbody2D> ();
     target      = GameObject.FindObjectOfType <PlayerLvl3>();
     direction   = (target.transform.position - transform.position).normalized * speed;
     rb.velocity = new Vector2(direction.x, direction.y);
     Destroy(gameObject, 5f);
 }
예제 #2
0
    void OnTriggerEnter2D(Collider2D info)
    {
        PlayerLvl3 player = info.GetComponent <PlayerLvl3>();

        if (player != null)
        {
            //Debug.Log("HIT!!!");
            player.GettingHit(damage);
            DestroyBullet();
        }
    }