void OnTriggerStay(Collider other) { if (other.gameObject.layer == enemyLayer && other.tag == "Enemy") { CellScript enemy = other.GetComponent <CellScript>(); Vector3 enemyPos = enemy.GetCurrentLocation(); Vector3 normalizedForceVector = (transform.position - enemyPos).normalized; enemy.SetGravitating(true); enemy.ApplyForce(normalizedForceVector * gravitationForce); } else if (other.gameObject.layer == enemyBulletLayer) { BulletScript bullet = other.GetComponent <BulletScript>(); Vector3 bulletPos = bullet.transform.position; Vector3 normalizedForceVector = (transform.position - bulletPos).normalized; bullet.SetGravitating(true); bullet.ApplyForce(normalizedForceVector * gravitationForce); } }