Show network Ping & start AI behaviour tree
This commit is contained in:
9
scenes/map/NearEnemy.gd
Normal file
9
scenes/map/NearEnemy.gd
Normal file
@@ -0,0 +1,9 @@
|
||||
extends BTCondition
|
||||
class_name NearEnemy
|
||||
|
||||
@export var player_detection_distance:int = 50
|
||||
|
||||
func tick(actor:Node2D, _blackboard:BTBlackboard) -> int:
|
||||
if actor.enemies_in_range.size() > 0:
|
||||
return BTTickResult.SUCCESS
|
||||
return BTTickResult.FAILURE
|
||||
@@ -1,10 +1,16 @@
|
||||
[gd_scene load_steps=12 format=3 uid="uid://bq7p576e7a17i"]
|
||||
[gd_scene load_steps=18 format=3 uid="uid://bq7p576e7a17i"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bx4pdgghucl4k" path="res://textures/concrete_15.jpg" id="1_37wdm"]
|
||||
[ext_resource type="Texture2D" uid="uid://bj2qm3joiywso" path="res://textures/dark.png" id="2_f8syx"]
|
||||
[ext_resource type="Texture2D" uid="uid://bt671xkej3a2s" path="res://textures/shipping_container_01_side.jpg" id="3_vf5qg"]
|
||||
[ext_resource type="Texture2D" uid="uid://c52qu6ad3taix" path="res://textures/shipping_container_01_front.jpg" id="4_70w0l"]
|
||||
[ext_resource type="PackedScene" uid="uid://bp5ekvan8qsmc" path="res://entities/enemy/dummy.tscn" id="5_1x24o"]
|
||||
[ext_resource type="Script" path="res://addons/yet_another_behavior_tree/src/Nodes/BTRoot.gd" id="6_sr8ry"]
|
||||
[ext_resource type="Script" path="res://addons/yet_another_behavior_tree/src/Nodes/Composite/BTSelector.gd" id="7_2hqse"]
|
||||
[ext_resource type="Script" path="res://addons/yet_another_behavior_tree/src/Nodes/Decorators/BTInverter.gd" id="8_6fp60"]
|
||||
[ext_resource type="Script" path="res://addons/yet_another_behavior_tree/src/Nodes/Composite/BTSequence.gd" id="8_oe2bf"]
|
||||
[ext_resource type="Script" path="res://scenes/map/NearEnemy.gd" id="9_dts0y"]
|
||||
[ext_resource type="Script" path="res://addons/yet_another_behavior_tree/src/Blackboard/BTBlackboard.gd" id="10_xftr2"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_yhpph"]
|
||||
albedo_texture = ExtResource("1_37wdm")
|
||||
@@ -81,3 +87,23 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -11.7493, -0.748922, -3.17036
|
||||
|
||||
[node name="Enemy" parent="." instance=ExtResource("5_1x24o")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5.47822, -2.5938, -7.02456)
|
||||
|
||||
[node name="BTRoot" type="Node" parent="Enemy" node_paths=PackedStringArray("blackboard")]
|
||||
script = ExtResource("6_sr8ry")
|
||||
actor_path = NodePath("..")
|
||||
blackboard = NodePath("../BTBlackboard")
|
||||
|
||||
[node name="States" type="Node" parent="Enemy/BTRoot"]
|
||||
script = ExtResource("7_2hqse")
|
||||
|
||||
[node name="Idle" type="Node" parent="Enemy/BTRoot/States"]
|
||||
script = ExtResource("8_oe2bf")
|
||||
|
||||
[node name="Enemy not in range" type="Node" parent="Enemy/BTRoot/States/Idle"]
|
||||
script = ExtResource("8_6fp60")
|
||||
|
||||
[node name="enemy in sight" type="Node" parent="Enemy/BTRoot/States/Idle/Enemy not in range"]
|
||||
script = ExtResource("9_dts0y")
|
||||
|
||||
[node name="BTBlackboard" type="Node" parent="Enemy"]
|
||||
script = ExtResource("10_xftr2")
|
||||
|
||||
Reference in New Issue
Block a user