Example #1
0
    void Update()
    {
        if (Input.GetButtonDown("Fire1"))
        {
            GameObject closestHost = FindObject.FindNearestAliveHost(mousePositionWorldSpace);

            if (closestHost == null)
            {
                Debug.Log("no host found/all hosts busy");
            }
            else
            {
                closestHost.GetComponent <Host>().DrawAttention(mousePositionWorldSpace);
            }
        }

        if (Input.GetButtonDown("Fire2"))
        {
            GameObject[] hosts = GameObject.FindGameObjectsWithTag("Host");
            foreach (GameObject host in hosts)
            {
                host.GetComponent <Host>().StopDrawingAttention();
            }
        }
    }
Example #2
0
 public void EndGameIfNoHostsRemain()
 {
     if (FindObject.FindNearestAliveHost(Vector3.zero) == null)
     {
         EndGame();
     }
 }
Example #3
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;
        }
    }
Example #4
0
    void Update()
    {
        if (!isShut)
        {
            GameObject nearestHost = FindObject.FindNearestAliveHost(transform.position);
            if (nearestHost != null && (nearestHost.transform.position - transform.position).magnitude < trapRadius)
            {
                nearestHost.GetComponent <Host>().Die();
                SnapShut();
                return;
            }

            GameObject nearestMIB = FindObject.FindNearestAliveMIB(transform.position);
            if (nearestMIB != null && (nearestMIB.transform.position - transform.position).magnitude < trapRadius)
            {
                nearestMIB.GetComponent <MIB>().Die();
                SnapShut();
                return;
            }
        }
    }