add test unit

This commit is contained in:
2024-10-06 00:41:24 +10:00
parent 49650ffbde
commit 7e6060b046
2 changed files with 40 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
[gd_scene load_steps=5 format=3 uid="uid://cfixshlmwhpmi"]
[ext_resource type="Script" path="res://scripts/units/test_unit.gd" id="1_e76lg"]
[ext_resource type="PackedScene" uid="uid://bi231xk2sp410" path="res://assets/models/ant.glb" id="1_ff64u"]
[ext_resource type="Texture2D" uid="uid://dehqm00kiljut" path="res://assets/textures/selection_unit_decal.png" id="2_5725f"]
[sub_resource type="SphereShape3D" id="SphereShape3D_kq47f"]
radius = 0.25
[node name="TestUnit" type="Node3D"]
script = ExtResource("1_e76lg")
[node name="ant2" parent="." instance=ExtResource("1_ff64u")]
[node name="CharacterBody3D" type="StaticBody3D" parent="."]
[node name="CollisionShape3D" type="CollisionShape3D" parent="CharacterBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.25, 0)
shape = SubResource("SphereShape3D_kq47f")
[node name="SelectionSprite" type="Sprite3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0021804, 0.00953716, -0.00236732)
pixel_size = 0.0055
axis = 1
texture = ExtResource("2_5725f")

View File

@@ -0,0 +1,15 @@
extends Node3D
class_name TestUnit
var selected: bool = false
@onready var selection_sprite: Sprite3D = $SelectionSprite
func _ready() -> void:
set_selected(false)
func set_selected(on: bool) -> void:
selected = on
selection_sprite.visible = selected