Example #1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        Rover_AI rover = collision.GetComponent <Rover_AI>();

        if (rover != null)
        {
            var spawnedbullet = GameObject.Instantiate(bounceOffBullet, transform.position, transform.rotation, null);
            GameObject.Destroy(gameObject);
        }
        Alien_Actions alien = collision.GetComponent <Alien_Actions>();

        if (alien != null)
        {
            alien.Damage(damage);
            GameObject.Destroy(gameObject);
        }
    }
Example #2
0
 // Start is called before the first frame update
 void Start()
 {
     alien = FindObjectOfType <Alien_Actions>();
     rb    = GetComponent <Rigidbody2D>();
 }