示例#1
0
 void Start()
 {
     global_settings    = global_manager.GetComponent <GlobalSettings>();
     terrain_define     = global_settings.terrain_define;
     terrain_nodes_list = terrain_define.terrain_nodes_list;
     //TerrainCreator terrain_creator = GameObject.Find ("terrain").GetComponent<TerrainCreator>();
     //terrain_nodes_list = terrain_creator.terrain_nodes_list;
     terrain_size = terrain_define.terrain_size;
 }
示例#2
0
    // Use this for initialization
    void Start()
    {
        //Debug.Log (global_manager);
        GlobalSettings global_settings     = global_manager.GetComponent <GlobalSettings>();
        Transform      terrain             = global_settings.terrain;
        float          beacon_max_distance = global_settings.beacon_max_distance;

        // on_or_off: on creates nodes, off: does not create nodes but still looks adds nodes to the TerrainNodeList
        if (on_or_off)
        {
            terrain_size = 0;
            // when world starts, create a grid 20x20
            for (int x = -10; x <= 10; x++)
            {
                for (int z = -10; z <= 10; z++)
                {
                    terrain_size++;
                    Transform cube = (Transform)Instantiate(cube_prefab, new Vector3(x, Random.Range(-0.1f, 0.1f), z), Quaternion.identity);
                    cube.SetParent(terrain);
                    cube.name = "cube_" + terrain_size.ToString();
                }
            }
            // when world starts, create a grid 20x20
            for (int x = -10; x <= 10; x++)
            {
                for (int y = 1; y <= 10; y++)
                {
                    terrain_size++;
                    Transform cube = (Transform)Instantiate(cube_prefab, new Vector3(x, y, Random.Range(10.9f, 11.1f)), Quaternion.identity);
                    cube.SetParent(terrain);
                    cube.name = "cube_" + terrain_size.ToString();
                }
            }

            // when world starts, create a grid 20x20
            for (int y = 1; y <= 10; y++)
            {
                for (int z = -10; z <= 10; z++)
                {
                    terrain_size++;
                    Transform cube = (Transform)Instantiate(cube_prefab, new Vector3(Random.Range(-10.9f, -11.1f), y, z), Quaternion.identity);
                    cube.SetParent(terrain);
                    cube.name = "cube_" + terrain_size.ToString();
                }
            }
        }

        // Finds and creates a TerrainNodeList
        terrain_size = 0;
        foreach (Transform cube in terrain)
        {
            terrain_transforms_list.Add(cube);
            terrain_size++;
        }
        terrain_nodes_list = new TerrainNodeList(terrain_transforms_list, beacon_max_distance);
    }
示例#3
0
    public void Awake()
    {
        network_id         = 0; // will be set by PlayerNetworkSetup
        global_settings    = global_manager.GetComponent <GlobalSettings>();
        terrain_define     = global_settings.terrain_define;
        terrain_nodes_list = terrain_define.terrain_nodes_list;
        pathfinder         = global_settings.pathfinder;
        cam_editor         = cam.GetComponent <CameraPerspectiveEditor>();
        //cam_controler = cam.transform.parent.transform;

        /*
         * if (apple_ios || google_android) {
         *      node_shader = "TheGrid/NodeShaderMobil";
         * } else if (windows_pc || apple_mac) {
         *      node_shader = "TheGrid/NodeShaderDesktop";
         * }
         */
    }
示例#4
0
    // Use this for initialization
    void Start()
    {
        GlobalSettings global_settings     = global_manager.GetComponent <GlobalSettings>();
        Transform      terrain_folder      = global_settings.terrain;
        float          beacon_max_distance = global_settings.beacon_max_distance;

        // Finds and creates a TerrainNodeList
        terrain_size = 0;
        foreach (Transform cube in GetAllChildren(terrain_folder))
        {
            terrain_transforms_list.Add(cube);
            terrain_size++;
        }
        //Debug.Log(terrain_transforms_list);
        terrain_nodes_list = new TerrainNodeList(terrain_transforms_list, beacon_max_distance);
        //Debug.Log (terrain_nodes_list);

        // set the global
        //global_settings.terrain_nodes_list = terrain_nodes_list;
    }
示例#5
0
    // Use this for initialization
    void Start()
    {
        // global_settings contains information about the scene
        global_settings = global_manager.GetComponent <GlobalSettings>();
        terrain_define  = global_settings.terrain_define;

        // player_info contains information about the player
        player_info  = player_manager.GetComponent <PlayerInfo>();
        player_input = player_manager.GetComponent <PlayerInput>();

        // player
        player = player_info.player;

        // terrain
        terrain_nodes_list = terrain_define.terrain_nodes_list;
        pathfinder         = global_settings.pathfinder;
        //Debug.Log(terrain_nodes_list);
        path_to_follow = new TerrainNode[1] {
            terrain_nodes_list.FindClosestTerrainNodeToPoint(new Vector3(0.0f, 0.0f, 0.0f))
        };
    }