void FixedUpdate() { if (attackRadius.enabled) { frameCounter++; if (frameCounter > 3) { attackRadius.enabled = false; frameCounter = 0; } } if (player.IsHoming()) { if (Vector3.Distance(player.transform.position, destination) <= 1.0f) { player.SetHoming(false, false); characterModel.LookAt(new Vector3(destination.x + direction.x, characterModel.position.y, destination.z + direction.z)); player.GetComponent <Rigidbody>().velocity = new Vector3(player.GetComponent <Rigidbody>().velocity.x / 3.0f, player.groundJumpPower * 1.1f, player.GetComponent <Rigidbody>().velocity.z / 3.0f); enemy.GetComponent <Rigidbody>().velocity = new Vector3(player.GetComponent <Rigidbody>().velocity.x, -player.groundJumpPower * 4.0f, player.GetComponent <Rigidbody>().velocity.z); if (enemy) { enemy.Kill(); enemy = null; } } else { player.GetComponent <Rigidbody>().velocity = direction; } } }