Пример #1
0
    // Use this for initialization
    void Start()
    {
        if (generate_terrain && Terrain.activeTerrain != null)
        {
            terrain = Terrain.activeTerrain;
            if (terrain.GetComponent <TerrainGenerator>() != null)
            {
                terrain.GetComponent <TerrainGenerator>().GenerateTerrain();
                if (generate_trees)
                {
                    ForestCreator forest = gameObject.GetComponent <ForestCreator>();                   //gameObject.AddComponent<ForestCreator>();
                    forest.SetTerrain(terrain);
                    forest.SetSpeciesNum(tree_species_num);
                }
            }
            else
            {
                Debug.LogError("ERROR: No TerrainGenerator component on active terrain.");
            }
        }

        if (generate_creatures)
        {
            // Generate species for new creatures
            for (int i = 0; i < creature_species_num; i++)
            {
                CreatureSpecies newSpecies = new CreatureSpecies();
                newSpecies.CreateNewSpecies();
                creature_species_list.Add(newSpecies);
            }
            // Generate creatures from new species

            // For now, just generate a single test creature
            GameObject testCreature = new GameObject("TestCreature");
            testCreature.transform.position = Vector3.zero;
            CreatureBase creatureScript = testCreature.AddComponent <CreatureBase>();
            creatureScript.species = creature_species_list[0];
        }
    }
Пример #2
0
    // ------------------------------------------------------------------------ //

    // Use this for initialization
    void Start()
    {
        this.tool_gui = this.GetComponent <ToolGUI>();

        // カメラのインスタンスを探しておく.
        this.main_camera = GameObject.FindGameObjectWithTag("MainCamera");

        this.tool_camera = this.main_camera.GetComponent <ToolCameraControl>();
        this.game_camera = this.main_camera.GetComponent <GameCameraControl>();
        this.car_camera  = this.main_camera.GetComponent <CarCamera>();

        this.tool_camera.enabled = true;
        this.game_camera.enabled = false;
        this.car_camera.enabled  = false;

        this.game_control = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameControl>();
        this.game_control.tool_control = this;

        //

        this.line_drawer      = (Instantiate(this.LineDrawerPrefab) as GameObject).GetComponent <LineDrawerControl>();
        this.line_drawer.root = this;

        this.waku_object = GameObject.Find("waku");

        //

        this.road_creator       = new RoadCreator();
        this.tunnel_creator     = new TunnelCreator();
        this.forest_creator     = new ForestCreator();
        this.buil_arranger      = new BuildingArranger();
        this.jump_slope_creator = new JumpSlopeCreator();

        this.junction_finder = new JunctionFinder();

        this.tunnel_creator.TunnelPrefab = this.TunnelPrefab;
        this.tunnel_creator.road_creator = this.road_creator;
        this.tunnel_creator.main_camera  = this.main_camera;
        this.tunnel_creator.tool_gui     = this.tool_gui;
        this.tunnel_creator.create();

        this.forest_creator.TreePrefab   = this.TreePrefab;
        this.forest_creator.road_creator = this.road_creator;
        this.forest_creator.main_camera  = this.main_camera;
        this.forest_creator.tool_gui     = this.tool_gui;
        this.forest_creator.create();

        this.buil_arranger.BuildingPrefabs = this.BuildingPrefabs;
        this.buil_arranger.road_creator    = this.road_creator;
        this.buil_arranger.main_camera     = this.main_camera;
        this.buil_arranger.tool_gui        = this.tool_gui;
        this.buil_arranger.create();

        this.jump_slope_creator.JumpSlopePrefab = this.JumpSlopePrefab;
        this.jump_slope_creator.road_creator    = this.road_creator;
        this.jump_slope_creator.main_camera     = this.main_camera;
        this.jump_slope_creator.tool_gui        = this.tool_gui;
        this.jump_slope_creator.create();

        this.junction_finder.create();

        //

        this.game_camera.road_creator = this.road_creator;

        this.step = STEP.EDIT;
    }