private void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Fish") { rigidbody.bodyType = RigidbodyType2D.Static; transform.SetParent(other.transform, false); Rigidbody2D fishRB = other.gameObject.GetComponent <Rigidbody2D>(); fishRB.gravityScale = 1; FishLife fishLife = other.GetComponent <FishLife>(); fishLife.Die(); Mission.Instance.OnFishHunted(); Destroy(gameObject); } }
private void Awake() { fishLife = GetComponent <FishLife>(); speed = Random.Range(1, 5); }