Implemented state machine & added NPC ship template

This commit is contained in:
2ndbeam 2024-05-01 17:45:17 +03:00
commit bda9232e72
15 changed files with 284 additions and 22 deletions

View file

@ -0,0 +1,35 @@
[gd_scene load_steps=7 format=3 uid="uid://pev6k21vqaem"]
[ext_resource type="Script" path="res://scripts/Ship/ship.gd" id="1_82bba"]
[ext_resource type="PackedScene" uid="uid://bkd4gyhlota7l" path="res://scenes/Ships/Modules/Hulls/kamikaze_hull.tscn" id="2_165nu"]
[ext_resource type="PackedScene" uid="uid://mw4kwxoeqch3" path="res://scenes/Ships/Modules/Engines/engine.tscn" id="3_plu72"]
[ext_resource type="PackedScene" uid="uid://bunboi5ouscw8" path="res://scenes/Ships/Modules/Shields/shield.tscn" id="4_aos8x"]
[ext_resource type="Script" path="res://scripts/State Machine/tree.gd" id="5_m8m3f"]
[ext_resource type="Script" path="res://scripts/State Machine/Kamikaze/WanderingState.gd" id="6_emcj1"]
[node name="KamikazeShip" type="Node2D"]
script = ExtResource("1_82bba")
[node name="HullHolder" type="Node" parent="."]
[node name="Hull" parent="HullHolder" instance=ExtResource("2_165nu")]
collision_damage = 15.0
[node name="Engine" parent="." instance=ExtResource("3_plu72")]
[node name="Shield" parent="." instance=ExtResource("4_aos8x")]
max_capacity = 5
[node name="Weapons" type="Node2D" parent="."]
[node name="StateTree" type="Node" parent="." node_paths=PackedStringArray("state")]
script = ExtResource("5_m8m3f")
state = NodePath("WanderingState")
[node name="WanderingState" type="Node" parent="StateTree"]
script = ExtResource("6_emcj1")
[node name="UpdateDestination" type="Timer" parent="StateTree/WanderingState"]
wait_time = 10.0
[connection signal="timeout" from="StateTree/WanderingState/UpdateDestination" to="StateTree/WanderingState" method="update_destination"]