private IEnumerator CaptureByLightHouse() { _circleImage.enabled = true; while (_captureTimer < _captureTime) { _captureTimer += Time.deltaTime; _circleImage.fillAmount = _captureTimer / _captureTime; GameController.Instance.SetCirclePosition(_circleImage, gameObject.transform.position); //new idea yield return(null); } _myAgent.CalculatePath(); _myAgent.Path.RemoveAt(0); PathVisibility(true); NextGridElement(); if (_isSuper) { //PowerUpController.Instance.GetPowerUp(transform.position); PowerUpController.Instance.SpawnPowerUp(transform.position); _isSuper = false; _renderer.sprite = Sprites[0]; } Captured = true; yield return(new WaitForSeconds(1f)); StartCoroutine("UncaptureByLightHouse"); }
protected void SetCourseOnTarget() { RandomTargetElement(); _myAgent.CalculatePath(); NextGridElement(); }