Exemplo n.º 1
0
    void Awake()
    {
        terrainManager = GameObject.Find("Map").GetComponent <TerrainManager>();
        // Create A* path manager and GO
        pathManager = utils.PrefabManager.Create("AStartPathManager").GetComponent <AStarPathManager>();
        pathManager.transform.parent = transform;

        soldiersPaths = new Dictionary <SoldierController, SoldierPathManager>();
        // Instantiate cursor if not found
        GameObject cursor_go;

        if ((cursor_go = GameObject.Find("Cursor")) == null)
        {
            var prefab_class = Resources.Load("Prefabs/Cursor", typeof(GameObject));
            cursor_go      = (GameObject)Instantiate(prefab_class);
            cursor_go.name = prefab_class.name;
            // Save it
            cursor = cursor_go.GetComponent <GameCursor>();
        }
        // Instantiate hover
        if ((hover = GameObject.Find("Hover")) == null)
        {
            var prefab_class = Resources.Load("Prefabs/Hover", typeof(GameObject));
            hover      = (GameObject)Instantiate(prefab_class);
            hover.name = prefab_class.name;
        }
        // Create path visulizer child GO and get main component
        var path_visualizer_go = utils.PrefabManager.Create("PathVisualizer");

        path_visualizer_go.transform.parent = transform;
        pathVisualizer = path_visualizer_go.GetComponent <PathVisualizer>();

        charDefManager    = new ja2.CharacterDefinitionManager("Data");
        clothManager      = new ja2.ClothManager("Data");
        charEntityManager = new ja2.CharacterEntityManager(charDefManager, clothManager);
    }
Exemplo n.º 2
0
    void Awake()
    {
        terrainManager = GameObject.Find("Map").GetComponent<TerrainManager>();
        // Create A* path manager and GO
        pathManager = utils.PrefabManager.Create("AStartPathManager").GetComponent<AStarPathManager>();
        pathManager.transform.parent = transform;

        soldiersPaths = new Dictionary<SoldierController, SoldierPathManager>();
        // Instantiate cursor if not found
        GameObject cursor_go;
        if ((cursor_go = GameObject.Find("Cursor")) == null)
        {
            var prefab_class = Resources.Load("Prefabs/Cursor", typeof(GameObject));
            cursor_go = (GameObject)Instantiate(prefab_class);
            cursor_go.name = prefab_class.name;
            // Save it
            cursor = cursor_go.GetComponent<GameCursor>();
        }
        // Instantiate hover
        if ((hover = GameObject.Find("Hover")) == null)
        {
            var prefab_class = Resources.Load("Prefabs/Hover", typeof(GameObject));
            hover = (GameObject)Instantiate(prefab_class);
            hover.name = prefab_class.name;
        }
        // Create path visulizer child GO and get main component
        var path_visualizer_go = utils.PrefabManager.Create("PathVisualizer");
        path_visualizer_go.transform.parent = transform;
        pathVisualizer = path_visualizer_go.GetComponent<PathVisualizer>();

        charDefManager = new ja2.CharacterDefinitionManager("Data");
        clothManager = new ja2.ClothManager("Data");
        charEntityManager = new ja2.CharacterEntityManager(charDefManager, clothManager);
    }