public void NewColl(string collName, dir CollDir, Vector3 AddForce = default(Vector3)) { try { hm.BlocckOrUnblockDir(CollDir, 1); ApplyForce += AddForce; } catch { } }
void OnCollisionStay2D(Collision2D coll) { if (coll.transform.tag == "Attack") { if (coll.transform.name.Contains("A" + id)) { return; } else { b++; if (b > 25) { b = 0; if (Random.Range(0, 15) > 13) { return; } } else { return; } } } else if (coll.transform.tag == "character_box") { return; } else if (coll.transform.tag == "SearchForPlayer") { return; } Vector3 dirc = (coll.gameObject.transform.position - gameObject.transform.position).normalized; if (dirc.y < -0.61f) { hm.BlocckOrUnblockDir(dir.buttom, k); } else if (Mathf.Abs(dirc.x) > Mathf.Abs(dirc.y)) { if (dirc.x > 0) { hm.BlocckOrUnblockDir(dir.right, k); } else { hm.BlocckOrUnblockDir(dir.left, k); } } else if (Mathf.Abs(dirc.x) < Mathf.Abs(dirc.y)) { if (dirc.y > 0) { hm.BlocckOrUnblockDir(dir.top, k); } else { hm.BlocckOrUnblockDir(dir.buttom, k); } } }