// Update is called once per frame void Update() { if (!m_wait_for_next_move.did_time_passed()) { return; } var values = System.Enum.GetValues(typeof(ColoredBall.BallColors)); GetComponent <Renderer>().material.color = ColoredBall.get_color(inner_colors[color_index]); color_index++; color_index %= inner_colors.Count; }
// Update is called once per frame void Update() { player.update_player(); float in_shoot = Input.GetAxis("Fire"); if (in_shoot > PUSH_SENSETIVITY) { player.shoot(); player = new DefultPlayer(); return; } if (!m_wait_for_next_move.did_time_passed()) { return; } float in_dir = Input.GetAxis("Horizontal"); Vector3 player_pos = transform.position; //Debug.logger.Log("info", in_dir.ToString()); if (in_dir > PUSH_SENSETIVITY || m_button_pressed == 1) { if (position_index < position.position_values.Count - 1) { position_index++; player_pos.x = position.position_values[position_index]; transform.position = player_pos; } } else if (in_dir < -1 * PUSH_SENSETIVITY || m_button_pressed == -1) { if (position_index > 0) { position_index--; player_pos.x = position.position_values[position_index]; transform.position = player_pos; } } m_button_pressed = 0; }
// Update is called once per frame void Update() { if (!m_wait_for_next_ball.did_time_passed()) { return; } GetComponent <victory>().update_for_win_next_ball(); positions p = GetComponent <positions>(); int type_ball = (int)Random.Range(0, balls.Count); int place_index = (int)Random.Range(0, p.position_values.Count); Ball ball_to_create = balls[type_ball]; float position_x = p.position_values[place_index]; Vector3 fin_pos = new Vector3(position_x, y_to_drop); GameObject g = (GameObject)Instantiate(ball_to_create.gameObject, fin_pos, Quaternion.identity); g.GetComponent <Ball>().pos_index = place_index; g.GetComponent <Ball>().ball_index = type_ball; }