Пример #1
0
    private void OnCollisionStay(Collision collision)
    {
        RB_Ball ball = collision.gameObject.GetComponent <RB_Ball>();

        if (ball != null)
        {
            time_in += Time.deltaTime;
            if (time_in >= time_stay_limit)
            {
                ball.Respawn();
                time_in = 0.0f;
            }
        }
    }
Пример #2
0
    void Set_Board()
    {
        //generate board
        Reset_Board_Rotation();
        board_loader.Generate_Board();
        number_tiles = FindObjectsOfType <RB_Number_Tile>();
        answer_tile  = FindObjectOfType <RB_Answer_Tile>();

        //generate answer
        answer = answer_controller.Generate_Answer(true);
        if (ui_question == null)
        {
            ui_question = UI_Question_Display.ui_question_display;
        }
        if (ui_question != null)
        {
            string question_string = answer_controller.Get_Question();
            ui_question.Set_Question("");
            ui_question.Set_Question(question_string);
        }
        else
        {
            print("UI Question not found.");
        }
        possible_answers = answer_controller.Get_Possible_Answers(number_tiles.Length);
        for (int i = 0; i < number_tiles.Length; i++)
        {
            int chosen_answer = possible_answers[i];
            while (chosen_answer == answer)
            {
                chosen_answer = possible_answers[Random.Range(0, possible_answers.Length)];
            }
            number_tiles[i].Set_Tile_Value(chosen_answer);
        }
        ball.Respawn();
        Set_Answer();
    }
    IEnumerator Respawn(RB_Ball _ball)
    {
        yield return(new WaitForSeconds(spawn_time));

        _ball.Respawn();
    }