コード例 #1
0
    private void AlertNearestGuard(PlayerController player)
    {
        // Look for closest guard that can respond.
        AIGuard nearestAvailable = null;
        float   nearestDistance  = float.MaxValue;

        foreach (AIGuard guard in guards)
        {
            if (guard.CanRespond)
            {
                // TODO this is expensive! Might cause performance issues.
                // Maybe use Jobs to multithread this?
                float distance = guard.GetResponseDistance(player.transform.position);
                if (distance < nearestDistance)
                {
                    nearestAvailable = guard;
                    nearestDistance  = distance;
                }
            }
        }
        // If a guard can respond, tap that guard to investigate.
        if (nearestAvailable != null)
        {
            nearestAvailable.Alert(player.transform.position);
        }
    }
コード例 #2
0
ファイル: KeyRestock.cs プロジェクト: JSchoppe/Gallery-Thief
    private void OnTriggerEnter(Collider other)
    {
        // Restore keys for guards who walk through this region.
        AIGuard guard = other.GetComponent <AIGuard>();

        if (guard != null)
        {
            guard.RestoreKeys();
        }
    }
コード例 #3
0
    void PersonInfoBox(GameObject PersonSelected)
    {
        int boxX      = 10;
        int boxY      = 10;
        int boxWidth  = 150;
        int boxHeight = 130;

        Rect InfoBox = new Rect(boxX, boxY, boxWidth, boxHeight);
        //Rect MouseBox = new Rect(Input.mousePosition.x, (Screen.height-Input.mousePosition.y), 100, 20);
        //string MouseContent;


        //GUI.Box(MouseBox, MouseContent);

        Person  person  = PersonSelected.GetComponent <Person>();
        AIGuard aiguard = PersonSelected.GetComponent <AIGuard>();

        patroli = aiguard.Patroli;



        GUI.BeginGroup(InfoBox);
        GUI.Box(new Rect(0, 0, boxWidth, boxHeight), person.stats.Name);
        string routeText;

        if (patroli.ToString() == "0")
        {
            routeText = "No Route";
        }
        else
        {
            routeText = "Route " + patroli.ToString();
        }


        if (GUI.Button(new Rect(boxWidth / 2 - 50, 25, 100, 25), new GUIContent(routeText, Routes)))
        {
            if (patroli + 1 < route.patrol.Count + 1)
            {
                patroli++;
            }
            else
            {
                patroli = 0;
            }
            aiguard.Patroli = patroli;
        }
        //GUI.Label(new Rect(0, 20, boxWidth - 10, boxHeight - 130),"ID : " + person.stats.Id.ToString());
        //GUI.Label(new Rect(0, 20, boxWidth - 10, 20),"Level : " + person.stats.Level.ToString());
        GUI.Label(new Rect(0, 50, boxWidth - 10, 25), new GUIContent(" Health : " + person.stats.CurrentHealth.ToString(), Health));
        GUI.Label(new Rect(0, 70, boxWidth - 10, 25), new GUIContent("Strength : " + StatTag(person.stats.Strength), Strength));
        GUI.Label(new Rect(0, 90, boxWidth - 10, 25), new GUIContent("Speed : " + StatTag(person.stats.Speed), Speed));
        GUI.Label(new Rect(0, 110, boxWidth - 10, 25), new GUIContent("Smarts : " + StatTag(person.stats.Smarts), Smarts));
        //GUI.Label(new Rect(0, 140, boxWidth - 10, boxHeight - 50), "x: " + person.tech.CurrentCoord.x.ToString());
        //GUI.Label(new Rect(0, 160, boxWidth - 10, boxHeight - 50), "z: " + person.tech.CurrentCoord.z.ToString());
        //GUI.Label(new Rect(0, 180, boxWidth - 10, boxHeight - 50), "Mode: " + aiguard.mode.ToString());
        //GUI.Label(new Rect(0, 200, boxWidth - 10, boxHeight - 50), "State: " + person.tech.state.ToString());
        GUI.EndGroup();
        //design fabricates narrative
        if (new Rect(boxX, Screen.height - (boxY + boxHeight), boxWidth, boxHeight).Contains(Input.mousePosition))
        {
            clickInfoBox = true;
            //print("IN");
            //MouseContent = "BoxY" + (Screen.height - boxY);
        }
        else
        {
            clickInfoBox = false;
            //print("OUT");
            //MouseContent = ("x: " + Input.mousePosition.x.ToString() + " y: " + Input.mousePosition.y.ToString());
        }


        //GUI.Label(MouseBox, MouseContent);
    }
コード例 #4
0
 void GuardCommandMode(RaycastHit Rhit)
 {
     aiguard = PersonSelected.GetComponent <AIGuard>();
     aiguard.UserClick(Rhit);
 }
コード例 #5
0
ファイル: s_Clicker.cs プロジェクト: Jwho303/Night-Watch
 void GuardCommandMode(RaycastHit Rhit)
 {
     aiguard = PersonSelected.GetComponent<AIGuard>();
     aiguard.UserClick(Rhit);
 }