private void Start() { _grumpy = FindObjectOfType <Grumpy>(); _grumpy.OnHitPipe += StopPipeCoroutines; CreateAndQueuePipes(); SpawnPipe(); }
void ShootRay() { /// NEW STUFF Vector3 center = new Vector3(bounds.center.x, bounds.center.y, 0); Vector2 dir = player.position - center; RaycastHit2D hit = Physics2D.Raycast(rayOrigin, dir, Mathf.Infinity, collisionMask); Debug.DrawRay(rayOrigin, dir * 15f, Color.red); if (hit.collider != null) { if (hit.transform.gameObject.layer == LayerMask.NameToLayer("Player")) { isSpooked = true; grumpy = Grumpy.Spooked; if (!aiHandler.neutralised) { aiHandler.behaviour = AiBehaviour.Agro; } } else { canSee = true; } } }
private void Start() { scoreCanvas.SetActive(true); gameOverCanvas.SetActive(false); Time.timeScale = 1; _score = 0; _scoreTextReference = scoreCanvas.GetComponentInChildren <Text>(); _grumpy = FindObjectOfType <Grumpy>(); _grumpy.OnUpdateScore += UpdateScore; _grumpy.OnHitPipe += HitPipe; }
IEnumerator StressToRelax() { yield return(new WaitForSeconds(stressedTime)); canSee = true; if (!aiHandler.neutralised) { aiHandler.behaviour = AiBehaviour.Patrol; } grumpy = Grumpy.Relaxed; StopCoroutine("Fire"); canShoot = true; }
IEnumerator SpookToStress() { spookedAnimation = true; yield return(new WaitForSeconds(spookedTime)); spookedAnimation = false; relaxing = true; if (!aiHandler.neutralised) { //aiHandler.behaviour = AiBehaviour.Patrol; } //grumpy = Grumpy.Stressed; grumpy = Grumpy.Angry; }
public override void Initialize() { _gameManager = FindObjectOfType <GameManager>(); _grumpy = gameObject.GetComponentInChildren <Grumpy>(); _gameManager.OnGameEnd += ResetGame; }