private void Start() { player = FindObjectOfType <Player>(); myCollider = GetComponent <Collider2D>(); myRigidBody = GetComponent <Rigidbody2D>(); myDeadly = GetComponent <Deadly>(); myFollower = GetComponent <Follower>(); }
void OnCollisionEnter2D(Collision2D col) { Deadly deadly = col.gameObject.GetComponent <Deadly>(); if (deadly == null) { return; } //Debug.Log("I collided with something that killed me!!"); //Do stuff with the game over... //There is a refence to the game logic script already... set_dead(); Destroy(col.gameObject); }