Пример #1
0
bool AnimationPlayer::_set(const StringName &p_name, const Variant &p_value) {

	String name = p_name;

	if (p_name == SceneStringNames::get_singleton()->playback_speed || p_name == SceneStringNames::get_singleton()->speed) { //bw compatibility
		set_speed_scale(p_value);

	} else if (p_name == SceneStringNames::get_singleton()->playback_active) {
		set_active(p_value);
	} else if (name.begins_with("playback/play")) {

		String which = p_value;

		if (which == "[stop]")
			stop();
		else
			play(which);
	} else if (name.begins_with("anims/")) {

		String which = name.get_slicec('/', 1);

		add_animation(which, p_value);
	} else if (name.begins_with("next/")) {

		String which = name.get_slicec('/', 1);
		animation_set_next(which, p_value);

	} else if (p_name == SceneStringNames::get_singleton()->blend_times) {

		Array array = p_value;
		int len = array.size();
		ERR_FAIL_COND_V(len % 3, false);

		for (int i = 0; i < len / 3; i++) {

			StringName from = array[i * 3 + 0];
			StringName to = array[i * 3 + 1];
			float time = array[i * 3 + 2];

			set_blend_time(from, to, time);
		}

	} else if (p_name == SceneStringNames::get_singleton()->autoplay) {
		autoplay = p_value;

	} else
		return false;

	return true;
}
Пример #2
0
Particles2D::Particles2D() {

	particles = VS::get_singleton()->particles_create();

	set_emitting(true);
	set_one_shot(false);
	set_amount(8);
	set_lifetime(1);
	set_fixed_fps(0);
	set_fractional_delta(true);
	set_pre_process_time(0);
	set_explosiveness_ratio(0);
	set_randomness_ratio(0);
	set_visibility_rect(Rect2(Vector2(-100, -100), Vector2(200, 200)));
	set_use_local_coordinates(true);
	set_draw_order(DRAW_ORDER_INDEX);
	set_speed_scale(1);
	h_frames = 1;
	v_frames = 1;
}