void Update() { RaycastHit hit; Ray forward = new Ray(transform.position, transform.forward); Ray backward = new Ray(transform.position, transform.forward * -1); if (Physics.Raycast(forward, out hit) || Physics.Raycast(backward, out hit)) { if (hit.transform.CompareTag("Enemy")) { direction *= -1; } else if (hit.transform.gameObject.CompareTag("Player") && !isCoolingDown) { isCoolingDown = true; FireComponent.numberOfCollectedParasites = 1; FireComponent.Fire(); Invoke("ResetCoolDown", 2 / difficultyMultipyer); } else if (hit.distance < 1.1f && Physics.Raycast(transform.position + Vector3.up * 0.2f, -transform.up, 0.25f)) { //JumpComponent.Jump(); } } MovmentComponent.Move(direction); RotationComponent.RotateTowards(target); MovmentComponent.thisUpdate(); }
private void Update() { MovmentComponent.thisUpdate(); HealthComponent.thisUpdate(); }