Пример #1
0
    // Use this for initialization
    void Start()
    {
        GameObject data_object = GameObject.FindGameObjectWithTag("Data");

        ds = data_object.GetComponent <Data_Script>();

        max_interact_reach = ds.max_interact_reach;

        rb  = GetComponent <Rigidbody2D>();
        cam = Camera.main;
        death_text.enabled = false;
    }
Пример #2
0
    Random.State world_rand_state; // Stores the randomizer state when finishing generating a level. This stops the random movement of the enemies from affecting the world gen in later levels

    // Use this for initialization
    void Start()
    {
        GameObject data_object = GameObject.FindGameObjectWithTag("Data");

        ds         = data_object.GetComponent <Data_Script>();
        world_size = ds.world_size;
        world_type = ds.world_gen_type;

        Random.InitState(ds.world_seed);

        world_rand_state = Random.state;

        do_regeneration = true;
        cc2d            = dungeon_walls.GetComponent <CompositeCollider2D>();
    }
Пример #3
0
    // Use this for initialization
    void Start()
    {
        ds = GameObject.FindGameObjectWithTag("Data").GetComponent <Data_Script>();

        player_score_text.text = "Your score: " + ds.gold_amount.ToString();

        submit_button.onClick.AddListener(() => Add_Highscore());
        menu_button.onClick.AddListener(() => Return_To_Menu());

        for (int i = 0; i < num_of_scores; i++)
        {
            scores score_to_add = new scores();
            score_to_add.name = "---";
            score_to_add.gold = 0;
            highscore.Add(score_to_add);
        }

        Update_Scores();
    }
Пример #4
0
    // Use this for initialization
    void Start()
    {
        if (!(GameObject.FindGameObjectWithTag("Data")))
        {
            Instantiate(data_obj);
        }

        ds = GameObject.FindGameObjectWithTag("Data").GetComponent <Data_Script>();

        seed_text.text = UnityEngine.Random.Range(0, 9999999).ToString();

        world_type_display_string_default = options_text_strings[1];
        options_text_strings[1]           = world_type_display_string_default + ": " + world_gen_presets[selected_world_type_id].name;

        reach_type_display_string_default = options_text_strings[2];
        options_text_strings[2]           = reach_type_display_string_default + ": " + reach_presets[selected_reach_type_id].name;

        ds.world_size     = world_gen_presets[selected_world_type_id].size;
        ds.world_gen_type = world_gen_presets[selected_world_type_id].world_gen_type;

        ds.max_interact_reach = reach_presets[selected_reach_type_id].reach;

        for (int i = 0; i < menu.Length; i++)
        {
            int index = i;
            menu[i].button.onClick.AddListener(() => Activate_Option(index, 0));
        }

        for (int i = 0; i < options_menu.Length; i++)
        {
            int index = i;
            options_menu[i].button.onClick.AddListener(() => Activate_Option(index, 1));
        }

        default_menu_pos = menu[0].button.transform.position;
        move_menu_to_pos = default_menu_pos;
    }