Teleport spawner tweaks

This commit is contained in:
MaddoScientisto 2025-03-10 22:37:42 +01:00
commit 2ba95ee922
5 changed files with 53 additions and 16 deletions

View file

@ -7,13 +7,13 @@
script = ExtResource("2_8ycgt")
Name = "Enemy Weapon"
BulletData = ExtResource("1_eps1c")
RateOfFire = 0.4
RateOfFire = 0.3
BulletCapacity = 4
ReloadTime = 1.0
AutoReload = true
InfiniteAmmo = true
BulletsPerShot = 5
SpreadAngle = 180.0
BulletsPerShot = 1
SpreadAngle = 0.0
RandomSpread = 0.0
ItemKey = "EnemyWeapon"
AmmoKey = ""

View file

@ -60,6 +60,7 @@ collision_layer = 16
collision_mask = 113
script = ExtResource("1_ugrra")
MovementSpeed = 30.0
Health = 2.0
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
sprite_frames = ExtResource("2_i2plx")
@ -134,7 +135,7 @@ script = ExtResource("15_17yce")
[node name="LootDrops" type="Node2D" parent="."]
script = ExtResource("16_76vwd")
LootDrops = Array[ExtResource("17_gsthm")]([SubResource("Resource_lh4qp"), SubResource("Resource_fmqd5"), SubResource("Resource_gry1a"), SubResource("Resource_6b6qx")])
LootDrops = [SubResource("Resource_lh4qp"), SubResource("Resource_fmqd5"), SubResource("Resource_gry1a"), SubResource("Resource_6b6qx")]
[connection signal="area_entered" from="PlayerDetection" to="PlayerDetection" method="_on_area_entered"]
[connection signal="area_exited" from="PlayerDetection" to="PlayerDetection" method="_on_area_exited"]

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,4 +1,5 @@
using Cirno.Scripts.Activables;
using System.Threading.Tasks;
using Cirno.Scripts.Activables;
using Godot;
namespace Cirno.Scripts.Actors;
@ -13,6 +14,8 @@ public partial class AlarmTeleporterActorSpawner : ActorSpawner
[Export]
public float ActivationRange { get; private set; }
[Export] public float ActivationDelay { get; private set; } = 2f;
public override void _Ready()
{
_alarmManager = this.GetAlarmManager();
@ -22,6 +25,13 @@ public partial class AlarmTeleporterActorSpawner : ActorSpawner
private void AlarmManagerOnAlarmEnabled(Vector2 location)
{
if (!(location.DistanceTo(this.GlobalPosition) <= ActivationRange)) return;
_ = DelaySpawn();
}
private async Task DelaySpawn()
{
await Task.Delay((int)(1000 * ActivationDelay));
Teleporter?.FireParticles();
Spawn();
}