Placeholders completed for enemy viewer

This commit is contained in:
2024-12-18 16:47:36 -08:00
parent 09e340179d
commit d135be4318
8 changed files with 85 additions and 28 deletions

View File

@@ -24,6 +24,11 @@ public partial class DataViewer : Control
[Node] public DataViewerRepository DataViewerRepository { get; set; } = default!;
#region UI
[Node] public RichTextLabel EnemyName { get; set; } = default!;
[Node] public RichTextLabel Description { get; set; } = default!;
#endregion
private EnemyModelView _currentModel;
private int _modelIndex = 0;
@@ -40,10 +45,6 @@ public partial class DataViewer : Control
CameraPivot.RotateY(_cameraSpeed);
if (Input.IsActionPressed(GameInputs.MoveRight))
CameraPivot.RotateY(-_cameraSpeed);
if (Input.IsActionPressed(GameInputs.MoveUp))
ModelPivot.RotateX(-_cameraSpeed);
if (Input.IsActionPressed(GameInputs.MoveDown))
ModelPivot.RotateX(_cameraSpeed);
if (Input.IsActionPressed(GameInputs.StrafeLeft))
Camera3D.Position = Camera3D.Position.MoveToward(CameraPivot.Position, (float)delta * 2f);
if (Input.IsActionPressed(GameInputs.StrafeRight))
@@ -51,7 +52,7 @@ public partial class DataViewer : Control
Camera3D.Position = Camera3D.Position.Clamp(new Vector3(0, 0, 1), new Vector3(0, 0, 4));
ModelPivot.Rotation = ModelPivot.Rotation.Clamp(Mathf.DegToRad(-60), Mathf.DegToRad(60));
_currentModel.RotateModel(_currentModel.Basis, CameraPivot.Basis.Z);
_currentModel.RotateModel(_currentModel.Basis, CameraPivot.Basis.Z, 0.75f, 0.5f);
if (Input.IsActionJustPressed(GameInputs.Attack))
{
@@ -70,7 +71,6 @@ public partial class DataViewer : Control
// Load previous model
_currentModel.CallDeferred(MethodName.QueueFree);
_modelIndex = (_modelIndex - 1 < 0 ? DataViewerRepository.ModelRepository.Count : _modelIndex) - 1;
GD.Print(_modelIndex);
CallDeferred(MethodName.LoadModel);
}
}
@@ -80,5 +80,7 @@ public partial class DataViewer : Control
var modelScene = DataViewerRepository.ModelRepository.ElementAt(_modelIndex);
_currentModel = modelScene.Instantiate<EnemyModelView>();
ModelPivot.AddChild(_currentModel);
EnemyName.Text = _currentModel.EnemyLoreInfo.Name;
Description.Text = _currentModel.EnemyLoreInfo.Description;
}
}

View File

@@ -1,11 +1,15 @@
[gd_scene load_steps=6 format=3 uid="uid://c7wjbgbrdivol"]
[gd_scene load_steps=8 format=3 uid="uid://c7wjbgbrdivol"]
[ext_resource type="Script" path="res://src/data_viewer/DataViewer.cs" id="1_1qako"]
[ext_resource type="Theme" uid="uid://daxuhpmyxwxck" path="res://src/inventory_menu/InventoryDialogueSelectionStyle.tres" id="2_bef6s"]
[ext_resource type="PackedScene" uid="uid://c16i1gmg6yu5a" path="res://src/data_viewer/DataViewerRepository.tscn" id="3_ejdn0"]
[ext_resource type="Texture2D" uid="uid://djvga5kh0ncqa" path="res://src/map/dungeon/models/antechamber_1/ANTECHAMBER_TYPE1_VER2_8311.png" id="3_hpkd1"]
[ext_resource type="PackedScene" uid="uid://bjg8wyvp8q6oc" path="res://src/enemy/enemy_types/michael/MichaelModelView.tscn" id="4_bef6s"]
[ext_resource type="PackedScene" uid="uid://bli0t0d6ommvi" path="res://src/enemy/enemy_types/sproingy/SproingyModelView.tscn" id="5_hpkd1"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_dvixg"]
albedo_texture = ExtResource("3_hpkd1")
[node name="DataViewer" type="Control"]
layout_mode = 3
anchors_preset = 15
@@ -13,13 +17,18 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 3
size_flags_vertical = 3
script = ExtResource("1_1qako")
_cameraSpeed = 0.015
[node name="CenterContainer" type="CenterContainer" parent="."]
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer"]
layout_mode = 2
@@ -33,8 +42,10 @@ theme_override_constants/separation = 0
[node name="LeftPanel" type="Panel" parent="CenterContainer/VBoxContainer/HBoxContainer"]
custom_minimum_size = Vector2(390, 0)
layout_mode = 2
size_flags_horizontal = 3
[node name="TextEdit" type="RichTextLabel" parent="CenterContainer/VBoxContainer/HBoxContainer/LeftPanel"]
[node name="EnemyName" type="RichTextLabel" parent="CenterContainer/VBoxContainer/HBoxContainer/LeftPanel"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
@@ -60,15 +71,25 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.82392, 0)
[node name="CameraPivot" type="Node3D" parent="CenterContainer/VBoxContainer/HBoxContainer/SubViewportContainer/SubViewport"]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 1, 0)
[node name="Camera3D" type="Camera3D" parent="CenterContainer/VBoxContainer/HBoxContainer/SubViewportContainer/SubViewport/CameraPivot"]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 2)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -9.82023e-08, 0, 3.1233)
[node name="CSGCylinder3D" type="CSGCylinder3D" parent="CenterContainer/VBoxContainer/HBoxContainer/SubViewportContainer/SubViewport"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -2.47154, 0)
radius = 1.5
height = 5.46951
material = SubResource("StandardMaterial3D_dvixg")
[node name="SpotLight3D" type="SpotLight3D" parent="CenterContainer/VBoxContainer/HBoxContainer/SubViewportContainer/SubViewport"]
transform = Transform3D(1, 0, 0, 0, 0.0417012, 0.99913, 0, -0.99913, 0.0417012, 0, 4.88492, 0)
[node name="RightPanel" type="Panel" parent="CenterContainer/VBoxContainer/HBoxContainer"]
custom_minimum_size = Vector2(390, 0)
layout_mode = 2
size_flags_horizontal = 3
[node name="TextEdit" type="RichTextLabel" parent="CenterContainer/VBoxContainer/HBoxContainer/RightPanel"]
layout_mode = 1
@@ -94,13 +115,8 @@ anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 0
[node name="RotationLabel" type="Label" parent="CenterContainer/VBoxContainer/BottomPanel"]
[node name="Description" type="RichTextLabel" parent="CenterContainer/VBoxContainer/BottomPanel"]
unique_name_in_owner = true
layout_mode = 0
offset_right = 40.0
offset_bottom = 23.0
[node name="TextEdit" type="RichTextLabel" parent="CenterContainer/VBoxContainer/BottomPanel"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
@@ -126,4 +142,4 @@ text = "Press ○ to exit"
[node name="DataViewerRepository" parent="." instance=ExtResource("3_ejdn0")]
unique_name_in_owner = true
ModelRepository = Array[PackedScene]([ExtResource("4_bef6s"), ExtResource("5_hpkd1")])
ModelRepository = Array[PackedScene]([ExtResource("5_hpkd1"), ExtResource("4_bef6s")])