diff --git a/components/Effects/ParryEntity.tscn b/components/Effects/ParryEntity.tscn new file mode 100644 index 0000000..2d4826c --- /dev/null +++ b/components/Effects/ParryEntity.tscn @@ -0,0 +1,63 @@ +[gd_scene load_steps=13 format=3 uid="uid://61vnckgx6x28"] + +[ext_resource type="PackedScene" uid="uid://bwbhxnuhmkwww" path="res://components/Effects/Parry.tscn" id="1_2mq06"] +[ext_resource type="Script" uid="uid://btj8sxcc0m28q" path="res://scripts/Contents/Effects/ParryEntity.gd" id="2_7dupr"] +[ext_resource type="AudioStream" uid="uid://23ttwefh4ej2" path="res://resources/sounds/effect/arrowshot.mp3" id="2_vfg08"] + +[sub_resource type="Curve" id="Curve_471em"] +_data = [Vector2(0.5, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0] +point_count = 2 + +[sub_resource type="CurveTexture" id="CurveTexture_tu1jt"] +curve = SubResource("Curve_471em") + +[sub_resource type="Curve" id="Curve_f5km5"] +_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0] +point_count = 2 + +[sub_resource type="CurveTexture" id="CurveTexture_molrd"] +curve = SubResource("Curve_f5km5") + +[sub_resource type="Gradient" id="Gradient_vfg08"] +colors = PackedColorArray(1, 0.23036289, 0.23036289, 1, 0.58383155, 0, 0, 1) + +[sub_resource type="GradientTexture1D" id="GradientTexture1D_7dupr"] +gradient = SubResource("Gradient_vfg08") + +[sub_resource type="Curve" id="Curve_pg3k8"] +_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(0.5, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0] +point_count = 3 + +[sub_resource type="CurveTexture" id="CurveTexture_tys76"] +curve = SubResource("Curve_pg3k8") + +[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_rs11f"] +particle_flag_disable_z = true +emission_shape = 1 +emission_sphere_radius = 22.49 +angle_min = 1.0728835e-05 +angle_max = 360.00003 +angle_curve = SubResource("CurveTexture_molrd") +direction = Vector3(-1, 0, 0) +initial_velocity_max = 2000.0 +gravity = Vector3(0, 0, 0) +damping_min = 1000.00006 +damping_max = 1000.00006 +scale_min = 0.19999999 +scale_max = 0.59999996 +scale_curve = SubResource("CurveTexture_tys76") +color_initial_ramp = SubResource("GradientTexture1D_7dupr") +alpha_curve = SubResource("CurveTexture_tu1jt") + +[node name="ParryEntity" instance=ExtResource("1_2mq06")] +script = ExtResource("2_7dupr") + +[node name="spawn" parent="sounds" index="0"] +stream = ExtResource("2_vfg08") +volume_db = 10.0 + +[node name="particles" parent="." index="1"] +process_material = SubResource("ParticleProcessMaterial_rs11f") + +[node name="texture" parent="stage" index="1"] +modulate = Color(1, 1, 1, 1) diff --git a/scripts/Contents/Bullets/Parrier.gd b/scripts/Contents/Bullets/Parrier.gd index 9ea9b59..a039055 100644 --- a/scripts/Contents/Bullets/Parrier.gd +++ b/scripts/Contents/Bullets/Parrier.gd @@ -23,11 +23,11 @@ func spawn(): func succeedToHit(_dmg: float, entity: EntityBase): if parryiedTimes < maxParryTimes: parryiedTimes += 1 - var eff = EffectController.create(ComponentManager.getEffect("Parry"), entity.position) - eff.rotation = position.angle_to_point(entity.position) + var effSpawn = entity.texture.global_position + var eff = EffectController.create(ComponentManager.getEffect("ParryEntity"), effSpawn) + eff.rotation = position.angle_to_point(effSpawn) eff.shot() - launcher.impluse((position - entity.position).normalized() * 600) - entity.impluse((entity.position - position).normalized() * 600) + entity.impluse((effSpawn - position).normalized() * 600) func hitBullet(bullet: BulletBase): # 当前子弹与其他子弹相撞 if BulletTool.canDamage(bullet, launcher): # 其他子弹可以使当前子弹的发射者受伤吗? if parryiedTimes < maxParryTimes && MathTool.rate(parryRate): # 一个刀光最多格挡多少个敌方子弹? diff --git a/scripts/Contents/Effects/ParryEntity.gd b/scripts/Contents/Effects/ParryEntity.gd new file mode 100644 index 0000000..9d0cac5 --- /dev/null +++ b/scripts/Contents/Effects/ParryEntity.gd @@ -0,0 +1,5 @@ +extends ParryEffect +class_name ParryEntityEffect + +func beforeShot(): + CameraManager.shake(100, 200) diff --git a/scripts/Contents/Effects/ParryEntity.gd.uid b/scripts/Contents/Effects/ParryEntity.gd.uid new file mode 100644 index 0000000..736c939 --- /dev/null +++ b/scripts/Contents/Effects/ParryEntity.gd.uid @@ -0,0 +1 @@ +uid://btj8sxcc0m28q diff --git a/scripts/Contents/Weapons/Tree.gd b/scripts/Contents/Weapons/Tree.gd index a9b1dbb..bc5d3c5 100644 --- a/scripts/Contents/Weapons/Tree.gd +++ b/scripts/Contents/Weapons/Tree.gd @@ -19,4 +19,5 @@ func attack(entity: EntityBase): bullet.maxParryTimes = readStore("count") bullet.maxBallCount = readStore("max") bullet.reflectRate = readStore("rate") + bullet.baseDamage = readStore("atk") return true