add test unit
This commit is contained in:
25
scenes/units/test_unit.tscn
Normal file
25
scenes/units/test_unit.tscn
Normal 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")
|
||||
15
scripts/units/test_unit.gd
Normal file
15
scripts/units/test_unit.gd
Normal 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
|
||||
Reference in New Issue
Block a user