示例#1
0
    void UpdateNodePosition()
    {
        float   pos_y        = Random.Range(0.0f + spawn_y_offset, 1.0f - spawn_y_offset);
        Vector3 camera_spawn = new Vector3(0.5f, pos_y, spawn_distance);

        camera_spawn = Camera.main.ViewportToWorldPoint(camera_spawn);

        Vector3 position = new Vector3(NodeList[current_node_index].transform.position.x + node_x_offset * 3, camera_spawn.y, NodeList[current_node_index].transform.position.z);

        if (NodeList[previus_node_index].GetComponentInChildren <EvolutionNode>() != null)
        {
            NodeList[previus_node_index].GetComponentInChildren <EvolutionNode>().used = false;
        }
        NodeList[previus_node_index].GetComponent <NodeClass>().CloneParameters(NodeLoader.GetNode(node_lvl_count).GetComponent <NodeClass>());
        if (NodeList[previus_node_index].GetComponent <NodeClass>().evolution_active&& !evolution_controller.IsFullEvolved())
        {
            NodeList[previus_node_index].GetComponentInChildren <EvolutionNode>().enabled = true;
            NodeList[previus_node_index].GetComponentInChildren <MeshRenderer>().enabled  = true;
            NodeList[previus_node_index].GetComponentInChildren <Collider>().enabled      = true;
        }

        NodeList[previus_node_index].transform.position = position;

        NodeList[previus_node_index].GetComponent <NodeClass>().CreateObstacles();
    }