diff --git a/DungeonShooting_Godot/prefab/bullet/explode/Explode0001.tscn b/DungeonShooting_Godot/prefab/bullet/explode/Explode0001.tscn index 8980f34..31cb46f 100644 --- a/DungeonShooting_Godot/prefab/bullet/explode/Explode0001.tscn +++ b/DungeonShooting_Godot/prefab/bullet/explode/Explode0001.tscn @@ -97,6 +97,105 @@ [sub_resource type="CircleShape2D" id="CircleShape2D_isein"] resource_local_to_scene = true +[sub_resource type="Animation" id="Animation_20asn"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Circle:visible") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [true] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Circle:frame") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [0] +} +tracks/2/type = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("Line:visible") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [true] +} +tracks/3/type = "value" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("Line:frame") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [0] +} +tracks/4/type = "value" +tracks/4/imported = false +tracks/4/enabled = true +tracks/4/path = NodePath("ParticlesSmoke2:emitting") +tracks/4/interp = 1 +tracks/4/loop_wrap = true +tracks/4/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [false] +} +tracks/5/type = "value" +tracks/5/imported = false +tracks/5/enabled = true +tracks/5/path = NodePath("ParticlesFire:emitting") +tracks/5/interp = 1 +tracks/5/loop_wrap = true +tracks/5/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [false] +} +tracks/6/type = "value" +tracks/6/imported = false +tracks/6/enabled = true +tracks/6/path = NodePath("ParticlesSmoke:emitting") +tracks/6/interp = 1 +tracks/6/loop_wrap = true +tracks/6/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [false] +} +tracks/7/type = "value" +tracks/7/imported = false +tracks/7/enabled = true +tracks/7/path = NodePath("CollisionShape2D:disabled") +tracks/7/interp = 1 +tracks/7/loop_wrap = true +tracks/7/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [false] +} + [sub_resource type="Animation" id="Animation_j6a2s"] resource_name = "play" length = 4.0 @@ -198,105 +297,6 @@ "values": [false, true] } -[sub_resource type="Animation" id="Animation_20asn"] -length = 0.001 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("Circle:visible") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 1, -"values": [true] -} -tracks/1/type = "value" -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/path = NodePath("Circle:frame") -tracks/1/interp = 1 -tracks/1/loop_wrap = true -tracks/1/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 1, -"values": [0] -} -tracks/2/type = "value" -tracks/2/imported = false -tracks/2/enabled = true -tracks/2/path = NodePath("Line:visible") -tracks/2/interp = 1 -tracks/2/loop_wrap = true -tracks/2/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 1, -"values": [true] -} -tracks/3/type = "value" -tracks/3/imported = false -tracks/3/enabled = true -tracks/3/path = NodePath("Line:frame") -tracks/3/interp = 1 -tracks/3/loop_wrap = true -tracks/3/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 1, -"values": [0] -} -tracks/4/type = "value" -tracks/4/imported = false -tracks/4/enabled = true -tracks/4/path = NodePath("ParticlesSmoke2:emitting") -tracks/4/interp = 1 -tracks/4/loop_wrap = true -tracks/4/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 1, -"values": [false] -} -tracks/5/type = "value" -tracks/5/imported = false -tracks/5/enabled = true -tracks/5/path = NodePath("ParticlesFire:emitting") -tracks/5/interp = 1 -tracks/5/loop_wrap = true -tracks/5/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 1, -"values": [false] -} -tracks/6/type = "value" -tracks/6/imported = false -tracks/6/enabled = true -tracks/6/path = NodePath("ParticlesSmoke:emitting") -tracks/6/interp = 1 -tracks/6/loop_wrap = true -tracks/6/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 1, -"values": [false] -} -tracks/7/type = "value" -tracks/7/imported = false -tracks/7/enabled = true -tracks/7/path = NodePath("CollisionShape2D:disabled") -tracks/7/interp = 1 -tracks/7/loop_wrap = true -tracks/7/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 1, -"values": [false] -} - [sub_resource type="AnimationLibrary" id="AnimationLibrary_p6l6x"] _data = { "RESET": SubResource("Animation_20asn"), diff --git a/DungeonShooting_Godot/prefab/effect/enemy/Effect0001.tscn b/DungeonShooting_Godot/prefab/effect/enemy/Effect0001.tscn index 6b7176e..be02a75 100644 --- a/DungeonShooting_Godot/prefab/effect/enemy/Effect0001.tscn +++ b/DungeonShooting_Godot/prefab/effect/enemy/Effect0001.tscn @@ -14,6 +14,7 @@ shader_parameter/show_outline = true shader_parameter/outline_color = Color(0, 0, 0, 1) shader_parameter/outline_rainbow = false +shader_parameter/outline_use_blend = true [sub_resource type="ShaderMaterial" id="ShaderMaterial_08fn3"] shader = ExtResource("2_h62s7") @@ -23,6 +24,7 @@ shader_parameter/show_outline = false shader_parameter/outline_color = Color(0, 0, 0, 1) shader_parameter/outline_rainbow = false +shader_parameter/outline_use_blend = true [sub_resource type="AtlasTexture" id="AtlasTexture_cldwb"] atlas = ExtResource("3_6ewaj") @@ -165,10 +167,8 @@ [sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_ku1mm"] particle_flag_disable_z = true -gravity = Vector3(0, 0, 0) -orbit_velocity_min = 0.0 -orbit_velocity_max = 0.0 angle_max = 360.0 +gravity = Vector3(0, 0, 0) scale_min = 0.4 scale_max = 1.5 scale_curve = SubResource("CurveTexture_rutlp") @@ -177,6 +177,7 @@ anim_offset_max = 1.0 [node name="Effect0001" type="CharacterBody2D" node_paths=PackedStringArray("ShadowSprite", "AnimatedSprite", "Collision")] +collision_layer = 128 script = ExtResource("1_ttosm") ShadowSprite = NodePath("ShadowSprite") AnimatedSprite = NodePath("AnimatedSprite") diff --git a/DungeonShooting_Godot/project.godot b/DungeonShooting_Godot/project.godot index 8f16079..83159ea 100644 --- a/DungeonShooting_Godot/project.godot +++ b/DungeonShooting_Godot/project.godot @@ -192,7 +192,7 @@ 2d_physics/layer_5="enemy" 2d_physics/layer_6="affiliation" 2d_physics/layer_7="onHead" -2d_physics/layer_8="shell" +2d_physics/layer_8="debris" 2d_physics/layer_9="throwing" [mono] diff --git a/DungeonShooting_Godot/resource/material/SmokeParticleMaterial.tres b/DungeonShooting_Godot/resource/material/SmokeParticleMaterial.tres index 95ae1df..4470829 100644 --- a/DungeonShooting_Godot/resource/material/SmokeParticleMaterial.tres +++ b/DungeonShooting_Godot/resource/material/SmokeParticleMaterial.tres @@ -11,11 +11,9 @@ [resource] particle_flag_disable_z = true spread = 180.0 -gravity = Vector3(0, 0, 0) initial_velocity_min = 5.0 initial_velocity_max = 35.0 -orbit_velocity_min = 0.0 -orbit_velocity_max = 0.0 +gravity = Vector3(0, 0, 0) scale_min = 0.8 scale_max = 0.8 scale_curve = ExtResource("1_yr5l8") diff --git a/DungeonShooting_Godot/src/framework/activity/ActivityMaterial.cs b/DungeonShooting_Godot/src/framework/activity/ActivityMaterial.cs index 2d561fc..a233c8e 100644 --- a/DungeonShooting_Godot/src/framework/activity/ActivityMaterial.cs +++ b/DungeonShooting_Godot/src/framework/activity/ActivityMaterial.cs @@ -4,5 +4,28 @@ /// </summary> public class ActivityMaterial { + /// <summary> + /// 摩擦力 + /// </summary> + public float Friction { get; set; } = 100; + /// <summary> + /// 落地之后是否回弹 + /// </summary> + public bool Bounce { get; set; } = true; + + /// <summary> + /// 物体下坠回弹的强度 + /// </summary> + public float BounceStrength { get; set; } = 0.5f; + + /// <summary> + /// 物体下坠回弹后的运动速度衰减量 + /// </summary> + public float BounceSpeed { get; set; } = 0.75f; + + /// <summary> + /// 物体下坠回弹后的旋转速度衰减量 + /// </summary> + public float BounceRotationSpeed { get; set; } = 0.5f; } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs b/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs index 004b3e5..b8c6d62 100644 --- a/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs +++ b/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs @@ -145,26 +145,6 @@ private float _verticalSpeed; /// <summary> - /// 落地之后是否回弹 - /// </summary> - public bool Bounce { get; set; } = true; - - /// <summary> - /// 物体下坠回弹的强度 - /// </summary> - public float BounceStrength { get; set; } = 0.5f; - - /// <summary> - /// 物体下坠回弹后的运动速度衰减量 - /// </summary> - public float BounceSpeed { get; set; } = 0.75f; - - /// <summary> - /// 物体下坠回弹后的旋转速度衰减量 - /// </summary> - public float BounceRotationSpeed { get; set; } = 0.5f; - - /// <summary> /// 投抛状态下物体碰撞器大小, 如果 (x, y) 都小于 0, 则默认使用 AnimatedSprite 的默认动画第一帧的大小 /// </summary> [Export] @@ -347,6 +327,7 @@ } } #endif + ActivityMaterial = new ActivityMaterial(); World = world; ItemConfig = activityData.Config; Name = GetType().Name + (_instanceIndex++); @@ -957,28 +938,28 @@ { //缩放移动速度 //MoveController.ScaleAllForce(BounceSpeed); - _throwForce.Velocity *= BounceSpeed; + _throwForce.Velocity *= ActivityMaterial.BounceSpeed; //缩放旋转速度 //MoveController.ScaleAllRotationSpeed(BounceStrength); - _throwForce.RotationSpeed *= BounceRotationSpeed; + _throwForce.RotationSpeed *= ActivityMaterial.BounceRotationSpeed; } //如果落地高度不够低, 再抛一次 - if (Bounce && (!_hasResilienceVerticalSpeed || _resilienceVerticalSpeed > 5)) + if (ActivityMaterial.Bounce && (!_hasResilienceVerticalSpeed || _resilienceVerticalSpeed > 5)) { if (!_hasResilienceVerticalSpeed) { _hasResilienceVerticalSpeed = true; - _resilienceVerticalSpeed = -VerticalSpeed * BounceStrength; + _resilienceVerticalSpeed = -VerticalSpeed * ActivityMaterial.BounceStrength; } else { if (_resilienceVerticalSpeed < 25) { - _resilienceVerticalSpeed = _resilienceVerticalSpeed * BounceStrength * 0.4f; + _resilienceVerticalSpeed = _resilienceVerticalSpeed * ActivityMaterial.BounceStrength * 0.4f; } else { - _resilienceVerticalSpeed = _resilienceVerticalSpeed * BounceStrength; + _resilienceVerticalSpeed = _resilienceVerticalSpeed * ActivityMaterial.BounceStrength; } } _verticalSpeed = _resilienceVerticalSpeed; @@ -1414,6 +1395,14 @@ _playHit = true; _playHitSchedule = 0; } + + /// <summary> + /// 获取当前摩擦力 + /// </summary> + public float GetCurrentFriction() + { + return ActivityMaterial.Friction; + } public long StartCoroutine(IEnumerator able) { diff --git a/DungeonShooting_Godot/src/framework/activity/ExternalForce.cs b/DungeonShooting_Godot/src/framework/activity/ExternalForce.cs index 02ee215..fee637c 100644 --- a/DungeonShooting_Godot/src/framework/activity/ExternalForce.cs +++ b/DungeonShooting_Godot/src/framework/activity/ExternalForce.cs @@ -19,8 +19,8 @@ /// <summary> /// 是否在空中也会受到阻力 /// </summary> - public bool EnableResistanceInTheAir { get; set; } = true; - + public bool EnableResistanceInTheAir { get; set; } = false; + /// <summary> /// 当速度( Velocity 和 RotationSpeed )到达 0 后是否自动销毁, 默认 true /// </summary> diff --git a/DungeonShooting_Godot/src/framework/activity/components/MoveController.cs b/DungeonShooting_Godot/src/framework/activity/components/MoveController.cs index 9056451..1992fbe 100644 --- a/DungeonShooting_Godot/src/framework/activity/components/MoveController.cs +++ b/DungeonShooting_Godot/src/framework/activity/components/MoveController.cs @@ -307,12 +307,13 @@ Master.Rotation += rotationSpeed * delta; } //衰减旋转速率 + var friction = Master.GetCurrentFriction(); for (var i = 0; i < _forceList.Count; i++) { var force = _forceList[i]; - if (force.RotationResistance != 0 && (force.EnableResistanceInTheAir || !Master.IsThrowing)) + if ((friction != 0 || force.RotationResistance != 0) && (force.EnableResistanceInTheAir || !Master.IsThrowing)) { - force.RotationSpeed = Mathf.MoveToward(force.RotationSpeed, 0, force.RotationResistance * delta); + force.RotationSpeed = Mathf.MoveToward(force.RotationSpeed, 0, (force.RotationResistance + friction) * delta); } } @@ -344,7 +345,7 @@ var no = collision.GetNormal().Rotated(Mathf.Pi * 0.5f); newVelocity = (finallyVelocity - _basisVelocity).Reflect(no); var length = _forceList.Count; - var v = newVelocity / (length / Master.BounceStrength); + var v = newVelocity / (length / Master.ActivityMaterial.BounceStrength); for (var i = 0; i < _forceList.Count; i++) { _forceList[i].Velocity = v; @@ -365,9 +366,9 @@ ); //力速度衰减 - if (force.VelocityResistance != 0 && (force.EnableResistanceInTheAir || !Master.IsThrowing)) + if ((friction != 0 || force.VelocityResistance != 0) && (force.EnableResistanceInTheAir || !Master.IsThrowing)) { - force.Velocity = force.Velocity.MoveToward(Vector2.Zero, force.VelocityResistance * delta); + force.Velocity = force.Velocity.MoveToward(Vector2.Zero, (friction + force.VelocityResistance) * delta); } } } diff --git a/DungeonShooting_Godot/src/framework/map/AffiliationArea.cs b/DungeonShooting_Godot/src/framework/map/AffiliationArea.cs index 1972ec2..90fac99 100644 --- a/DungeonShooting_Godot/src/framework/map/AffiliationArea.cs +++ b/DungeonShooting_Godot/src/framework/map/AffiliationArea.cs @@ -63,7 +63,7 @@ Monitoring = true; Monitorable = false; CollisionLayer = PhysicsLayer.None; - CollisionMask = PhysicsLayer.Prop | PhysicsLayer.Player | PhysicsLayer.Enemy | PhysicsLayer.Shell | PhysicsLayer.Throwing; + CollisionMask = PhysicsLayer.Prop | PhysicsLayer.Player | PhysicsLayer.Enemy | PhysicsLayer.Debris | PhysicsLayer.Throwing; BodyEntered += OnBodyEntered; BodyExited += OnBodyExited; diff --git a/DungeonShooting_Godot/src/game/PhysicsLayer.cs b/DungeonShooting_Godot/src/game/PhysicsLayer.cs index a96e34d..f181de2 100644 --- a/DungeonShooting_Godot/src/game/PhysicsLayer.cs +++ b/DungeonShooting_Godot/src/game/PhysicsLayer.cs @@ -36,9 +36,9 @@ /// </summary> public const uint OnHand = 0b1000000; /// <summary> - /// 弹壳 + /// 各种碎屑,包括弹壳,敌人死亡碎片,爆炸碎片等 /// </summary> - public const uint Shell = 0b10000000; + public const uint Debris = 0b10000000; /// <summary> /// 投抛中 /// </summary> diff --git a/DungeonShooting_Godot/src/game/activity/bullet/explode/Explode.cs b/DungeonShooting_Godot/src/game/activity/bullet/explode/Explode.cs index b9c98bf..73cbf62 100644 --- a/DungeonShooting_Godot/src/game/activity/bullet/explode/Explode.cs +++ b/DungeonShooting_Godot/src/game/activity/bullet/explode/Explode.cs @@ -28,16 +28,14 @@ /// 爆炸攻击的层级 /// </summary> public uint AttackLayer { get; private set; } - /// <summary> - /// 最小伤害 - /// </summary> - public int MinHarm { get; private set; } - /// <summary> - /// 最大伤害 - /// </summary> - public int MaxHarm { get; private set; } + private bool _init = false; + private float _hitRadius; + private int _minHarm; + private int _maxHarm; + private float _repelledRadius; + private float _maxRepelled; public void Destroy() { @@ -50,7 +48,16 @@ QueueFree(); } - public void Init(uint attackLayer, float radius, int minHarm, int maxHarm) + /// <summary> + /// 初始化爆炸数据 + /// </summary> + /// <param name="attackLayer">攻击的层级</param> + /// <param name="hitRadius">伤害半径</param> + /// <param name="minHarm">最小伤害</param> + /// <param name="maxHarm">最大伤害</param> + /// <param name="repelledRadius">击退半径</param> + /// <param name="maxRepelled">最大击退速度</param> + public void Init(uint attackLayer, float hitRadius, int minHarm, int maxHarm, float repelledRadius, float maxRepelled) { if (!_init) { @@ -63,10 +70,13 @@ } AttackLayer = attackLayer; - MinHarm = minHarm; - MaxHarm = maxHarm; - CollisionMask = attackLayer; - CircleShape.Radius = radius; + _hitRadius = hitRadius; + _minHarm = minHarm; + _maxHarm = maxHarm; + _repelledRadius = repelledRadius; + _maxRepelled = maxRepelled; + CollisionMask = attackLayer | PhysicsLayer.Prop | PhysicsLayer.Throwing | PhysicsLayer.Debris; + CircleShape.Radius = Mathf.Max(hitRadius, maxRepelled); } public void RunPlay() @@ -95,12 +105,27 @@ private void OnBodyEntered(Node2D node) { - var role = node.AsActivityObject<Role>(); - if (role != null) + var o = node.AsActivityObject(); + if (o != null) { - var angle = (role.Position - Position).Angle(); - role.CallDeferred(nameof(role.Hurt), Utils.Random.RandomRangeInt(MinHarm, MaxHarm), angle); - role.MoveController.AddForce(Vector2.FromAngle(angle) * 150, 300); + var temp = o.Position - Position; + var len = temp.Length(); + var angle = temp.Angle(); + + if (len <= _repelledRadius) //击退半径内 + { + var repelled = (_repelledRadius - len) / _repelledRadius * _maxRepelled; + o.MoveController.SetAllVelocity(Vector2.Zero); + o.MoveController.AddForce(Vector2.FromAngle(angle) * repelled); + } + + if (o is Role role) + { + if (len <= _hitRadius) //在伤害半径内 + { + role.CallDeferred(nameof(role.Hurt), Utils.Random.RandomRangeInt(_minHarm, _maxHarm), angle); + } + } } } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/activity/bullet/normal/Bullet.cs b/DungeonShooting_Godot/src/game/activity/bullet/normal/Bullet.cs index fae59af..71ded6a 100644 --- a/DungeonShooting_Godot/src/game/activity/bullet/normal/Bullet.cs +++ b/DungeonShooting_Godot/src/game/activity/bullet/normal/Bullet.cs @@ -137,7 +137,7 @@ explode.Position = Position; explode.RotationDegrees = Utils.Random.RandomRangeInt(0, 360); explode.AddToActivityRoot(RoomLayerEnum.YSortLayer); - explode.Init(AttackLayer, 25, MinHarm, MaxHarm); + explode.Init(AttackLayer, 25, MinHarm, MaxHarm, 50, 250); explode.RunPlay(); } @@ -177,7 +177,7 @@ var repel = Utils.Random.RandomConfigRange(attr.RepelRnage); if (repel != 0) { - role.MoveController.AddForce(Vector2.FromAngle(BasisVelocity.Angle()) * repel, repel * 2); + role.MoveController.AddForce(Vector2.FromAngle(BasisVelocity.Angle()) * repel); } } @@ -191,7 +191,7 @@ explode.Position = Position; explode.RotationDegrees = Utils.Random.RandomRangeInt(0, 360); explode.AddToActivityRootDeferred(RoomLayerEnum.YSortLayer); - explode.Init(AttackLayer, 25, MinHarm, MaxHarm); + explode.Init(AttackLayer, 25, MinHarm, MaxHarm, 50, 250); explode.RunPlay(); } diff --git a/DungeonShooting_Godot/src/game/activity/role/Role.cs b/DungeonShooting_Godot/src/game/activity/role/Role.cs index 0342a63..130c95a 100644 --- a/DungeonShooting_Godot/src/game/activity/role/Role.cs +++ b/DungeonShooting_Godot/src/game/activity/role/Role.cs @@ -1166,7 +1166,7 @@ var repel = Utils.Random.RandomConfigRange(attr.MeleeAttackRepelRnage); var position = role.GlobalPosition - MountPoint.GlobalPosition; var v2 = position.Normalized() * repel; - role.MoveController.AddForce(v2, repel * 2); + role.MoveController.AddForce(v2); } role.CallDeferred(nameof(Hurt), damage, (role.GetCenterPosition() - GlobalPosition).Angle()); diff --git a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs index 7945a4e..8e20c50 100644 --- a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs +++ b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs @@ -1048,7 +1048,7 @@ else //在地上 { var v = Utils.Random.RandomConfigRange(Attribute.BacklashRange) * 5; - var externalForce = MoveController.AddForce(new Vector2(-v, 0).Rotated(Rotation), v * 2); + var externalForce = MoveController.AddForce(new Vector2(-v, 0).Rotated(Rotation)); externalForce.RotationSpeed = -Mathf.DegToRad(40); externalForce.RotationResistance = Mathf.DegToRad(80); } diff --git a/DungeonShooting_Godot/src/game/activity/weapon/knife/Knife.cs b/DungeonShooting_Godot/src/game/activity/weapon/knife/Knife.cs index 7b0950d..3f74a4d 100644 --- a/DungeonShooting_Godot/src/game/activity/weapon/knife/Knife.cs +++ b/DungeonShooting_Godot/src/game/activity/weapon/knife/Knife.cs @@ -140,7 +140,7 @@ { var position = role.GlobalPosition - Master.MountPoint.GlobalPosition; var v2 = position.Normalized() * repel; - role.MoveController.AddForce(v2, repel * 2); + role.MoveController.AddForce(v2); } }