Exemplo n.º 1
0
    void Update()
    {
        if (isKilling)
        {
            return;
        }

        if (GameOver.instance.gameOver)
        {
            ccc.ClearDestination();
            return;
        }

        GameObject nearestYellingHost = FindObject.FindNearestYellingHost(transform.position);

        if (nearestYellingHost != null)
        {
            ccc.followObject = nearestYellingHost;
            ccc.isRunning    = true;
            TryKilling(nearestYellingHost);
            return;
        }

        GameObject nearestHost = FindObject.FindNearestAliveHost(transform.position);

        if (nearestHost != null)
        {
            ccc.followObject = nearestHost;
            ccc.isRunning    = false;
            TryKilling(nearestHost);
            return;
        }
    }
Exemplo n.º 2
0
    IEnumerator DrawAttentionCoroutine(Vector3 position)
    {
        ccc.followObject = null;
        ccc.destination  = position;
        ccc.isRunning    = true;

        float mouseClickedTime = Time.time;

        while ((position - transform.position).magnitude > 0.5f && Time.time - mouseClickedTime < 3)
        {
            yield return(null);
        }

        ccc.ClearDestination();
        ccc.isRunning = false;
        soundWaves.Play();
        isYelling = true;

        yield return(new WaitForSeconds(drawAttentionDuration));

        StopDrawingAttention();
    }