public override void UpdatePhysics() { //Check if touching player Collider2D[] cols = Physics2D.OverlapCircleAll((Vector2)transform.position, HitRadius + .5f); for (int i = 0; i < cols.Length; i++) { if (cols[i].tag != "Player") { continue; } EntityJetpack p = cols[i].GetComponent <EntityJetpack>(); p.RefillFuel(); //Kill ourselves //TakeDamage(1); } }
bool CheckForPlayer() { //Check if touching player Collider2D[] cols = Physics2D.OverlapCircleAll((Vector2)transform.position, Radius + .5f, playerMask); for (int i = 0; i < cols.Length; i++) { if (cols[i].tag != "Player") { continue; } EntityJetpack p = cols[i].GetComponent <EntityJetpack>(); if (!p.IsDead) { p.TakeDamage(Damage); return(true); } } return(false); }