コード例 #1
0
ファイル: PipeSpawner.cs プロジェクト: ehtnamuh/GrumpyBird
 private void Start()
 {
     _grumpy            = FindObjectOfType <Grumpy>();
     _grumpy.OnHitPipe += StopPipeCoroutines;
     CreateAndQueuePipes();
     SpawnPipe();
 }
コード例 #2
0
    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;
            }
        }
    }
コード例 #3
0
 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;
 }
コード例 #4
0
    IEnumerator StressToRelax()
    {
        yield return(new WaitForSeconds(stressedTime));

        canSee = true;
        if (!aiHandler.neutralised)
        {
            aiHandler.behaviour = AiBehaviour.Patrol;
        }
        grumpy = Grumpy.Relaxed;
        StopCoroutine("Fire");
        canShoot = true;
    }
コード例 #5
0
    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;
    }
コード例 #6
0
ファイル: PlayerAgent.cs プロジェクト: ehtnamuh/GrumpyBird
 public override void Initialize()
 {
     _gameManager            = FindObjectOfType <GameManager>();
     _grumpy                 = gameObject.GetComponentInChildren <Grumpy>();
     _gameManager.OnGameEnd += ResetGame;
 }