调整角色出生位置

This commit is contained in:
小李xl 2024-03-28 01:27:41 +08:00
parent cfc99321bb
commit a20b9162a3
4 changed files with 19 additions and 21 deletions

View File

@ -1,19 +1,13 @@
[gd_scene load_steps=3 format=3] [gd_scene load_steps=3 format=3 uid="uid://dmjlddmt2h1pa"]
[ext_resource type="Texture2D" uid="uid://cgptnp74ive4r" path="res://resource/sprite/common/Circle.png" id="1"] [ext_resource type="Texture2D" uid="uid://cgptnp74ive4r" path="res://resource/sprite/common/Circle.png" id="1"]
[ext_resource type="Script" path="res://src/game/effects/Blood.cs" id="2"] [ext_resource type="Script" path="res://src/game/effects/Blood.cs" id="2"]
[node name="Blood" type="CPUParticles2D"] [node name="Blood" type="CPUParticles2D"]
z_index = -5 z_index = -5
lifetime = 0.2 lifetime = 0.2
explosiveness = 0.9 explosiveness = 0.9
texture = ExtResource( 1 ) texture = ExtResource("1")
gravity = Vector2( 0, 0 ) gravity = Vector2(0, 0)
initial_velocity = 150.0 color = Color(0.627451, 0.0705882, 0.0705882, 0.705882)
initial_velocity_random = 1.0 script = ExtResource("2")
scale_amount = 0.15
scale_amount_random = 0.4
color = Color( 0.627451, 0.0705882, 0.0705882, 0.705882 )
script = ExtResource( 2 )

View File

@ -86,7 +86,7 @@ metadata/_edit_group_ = true
[node name="BirthMark" type="Marker2D" parent="." index="3"] [node name="BirthMark" type="Marker2D" parent="." index="3"]
z_as_relative = false z_as_relative = false
position = Vector2(535, 180) position = Vector2(502, 214)
[node name="DungeonEntrance" type="Area2D" parent="." index="4"] [node name="DungeonEntrance" type="Area2D" parent="." index="4"]
z_index = 15 z_index = 15

View File

@ -369,7 +369,17 @@ public abstract partial class AiRole : Role
AffiliationArea.RoomInfo.MarkTargetPosition[LookTarget.Id] = LookTarget.Position; AffiliationArea.RoomInfo.MarkTargetPosition[LookTarget.Id] = LookTarget.Position;
} }
} }
protected override void OnDie()
{
//扔掉所有武器
ThrowAllWeapon();
//创建金币
Gold.CreateGold(Position, RoleState.Gold);
//销毁
Destroy();
}
// private void OnVelocityComputed(Vector2 velocity) // private void OnVelocityComputed(Vector2 velocity)
// { // {
// if (Mathf.Abs(velocity.X) >= 0.01f && Mathf.Abs(velocity.Y) >= 0.01f) // if (Mathf.Abs(velocity.X) >= 0.01f && Mathf.Abs(velocity.Y) >= 0.01f)

View File

@ -110,9 +110,6 @@ public partial class Enemy : AiRole
protected override void OnDie() protected override void OnDie()
{ {
//扔掉所有武器
ThrowAllWeapon();
var effPos = Position + new Vector2(0, -Altitude); var effPos = Position + new Vector2(0, -Altitude);
//血液特效 //血液特效
var blood = ObjectManager.GetPoolItem<AutoDestroyParticles>(ResourcePath.prefab_effect_enemy_EnemyBlood0001_tscn); var blood = ObjectManager.GetPoolItem<AutoDestroyParticles>(ResourcePath.prefab_effect_enemy_EnemyBlood0001_tscn);
@ -130,13 +127,10 @@ public partial class Enemy : AiRole
debris.MoveController.AddForce(Velocity + realVelocity); debris.MoveController.AddForce(Velocity + realVelocity);
} }
//创建金币
Gold.CreateGold(Position, RoleState.Gold);
//派发敌人死亡信号 //派发敌人死亡信号
EventManager.EmitEvent(EventEnum.OnEnemyDie, this); EventManager.EmitEvent(EventEnum.OnEnemyDie, this);
Destroy();
base.OnDie();
} }
protected override void Process(float delta) protected override void Process(float delta)