private void Start() { selfHealth = transform.root.GetComponent <HealthSinglePlayer>(); currentHealth = selfHealth.CurrentHealth(); shootingRangeMode = ai.shootingRangeMode; ai.AddDetectionObject(this); }
private void Update() { if (shootingRangeMode) { return; } if (playerDetected) { detectionTimer = memoryTime; ai.SetPlayerPosition(playerPosition); ai.SetPlayerDetected(true); } else if (detectionTimer >= 0) { ai.SetPlayerPosition(playerPosition); ai.SetPlayerDetected(true); } else { ai.SetPlayerDetected(false); } currentHealth = selfHealth.CurrentHealth(); detectionTimer -= Time.deltaTime; }