// Use this for initialization
    void Start()
    {
        controller = gameObject.GetComponent<ControllerGUI>();
        opts = gameObject.GetComponent<OptionsGUI>();

        GameObject npcsGameObject = GameObject.Find("NPCs");
        Transform[] npcs = npcsGameObject.GetComponentsInChildren<Transform>();
        foreach (Transform npc in npcs) {
            try {
                if(npc.gameObject.name.StartsWith("My")) {
                    npcsList.Add(npc.gameObject.name, npc.gameObject);
                }
            } catch {}
        }

        targetBehavior = GameObject.Find("TargetBehavior");
        webService = null;
    }
Example #2
0
    // Use this for initialization
    void Start()
    {
        // Read dynamically the movement graph from the corresponding file, create
        // the CompositionGraph and add it to the graphs maintained by A* Pathfinding
        //string filename = Application.dataPath + "/Composition/CompositionGraphs/" + gameObject.name + "Graph.tgf";
        string filename = Application.dataPath + "/Composition/PathfindingGraphs/" + gameObject.name + "Graph.tgf";
        graph = new CompositionGraph(filename);
        graph.name = gameObject.name + " Graph";
        // Debug.Log ("Scanning " + gameObject.name + "...");
        AstarPath.active.astarData.AddGraph(graph);
        graph.Scan();

        // Fetch all the waypoints of the A* graph related to the GameObject
        pathNodes = graph.GetPathNodes();

        // Initialize some useful scripts
        seeker = GetComponent<Seeker>();
        motor = GetComponent<CharacterController>();
        controller = GameObject.Find("GUI").GetComponent<ControllerGUI>();
        myCamera = transform.Find("Camera").gameObject;
        halo = GameObject.Find("Halo");
        haloStart = GameObject.Find ("HaloStart");
        lineRenderer = GameObject.Find ("LineRenderer");

        // Put the NPC in the right starting position
        transform.position = pathNodes[0].transform.position;
        currentPathNode = pathNodes[0].gameObject;
    }
Example #3
0
 private void MakeGui()
 {
     guiController = Instantiate(guiControllerPrefab);
     guiController.transform.SetParent(baseMapObject.transform, false);
 }