mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 06:45:33 +00:00
Made selector 3D
This commit is contained in:
parent
5e3ccf3b99
commit
0a7b1614a9
8 changed files with 113 additions and 45 deletions
25
Resources/Sprites/Selector.tres
Normal file
25
Resources/Sprites/Selector.tres
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
[gd_resource type="SpriteFrames" load_steps=4 format=3 uid="uid://dhn6pld33ek0v"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://dde36pgb8fbwc" path="res://Sprites/selector_big.png" id="1_5rjgr"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_vxp1j"]
|
||||
atlas = ExtResource("1_5rjgr")
|
||||
region = Rect2(0, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_bnh43"]
|
||||
atlas = ExtResource("1_5rjgr")
|
||||
region = Rect2(16, 0, 16, 16)
|
||||
|
||||
[resource]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_vxp1j")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_bnh43")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"default",
|
||||
"speed": 5.0
|
||||
}]
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=69 format=3 uid="uid://rimplblbptcd"]
|
||||
[gd_scene load_steps=70 format=3 uid="uid://rimplblbptcd"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://88smibkin17p" path="res://Scripts/Components/FSM/3DPlayer/IsoPlayerFSMProxy.cs" id="1_cc7e7"]
|
||||
[ext_resource type="Texture2D" uid="uid://ddwhrlrgj6i00" path="res://Sprites/Actors/Cirno.png" id="1_vex34"]
|
||||
|
|
@ -29,6 +29,7 @@
|
|||
[ext_resource type="Script" uid="uid://by0x0qmbmkoak" path="res://Scripts/Components/FSM/3DPlayer/PlayerWeaponProvider3D.cs" id="16_olwak"]
|
||||
[ext_resource type="PackedScene" uid="uid://cfgc6ik8vb08c" path="res://Scenes/Weapons/BaseWeapon_3D.tscn" id="17_olwak"]
|
||||
[ext_resource type="Script" uid="uid://cqyr8mko8oo5" path="res://Scripts/Components/FSM/3DPlayer/PlayerAcidDeathModule.cs" id="19_7selo"]
|
||||
[ext_resource type="PackedScene" uid="uid://cwnyegefc8o6q" path="res://Scenes/HUD/WorldSelector3D.tscn" id="24_j6bpw"]
|
||||
[ext_resource type="Script" uid="uid://hdw15b6fi7de" path="res://Scripts/Components/Actors/3D/PlayerDamageReceiver3D.cs" id="26_ok6gd"]
|
||||
[ext_resource type="Script" uid="uid://ddsqqfx1usc3j" path="res://Scripts/Resources/DamageResistance.cs" id="27_5v3dv"]
|
||||
[ext_resource type="Script" uid="uid://cqwvssstkrdmw" path="res://Scripts/Components/Actors/ActorResourceProvider.cs" id="28_b3jpo"]
|
||||
|
|
@ -325,6 +326,7 @@ script = ExtResource("11_4exx2")
|
|||
_inputProvider = NodePath("../InputProvider")
|
||||
_selectorController = NodePath("SelectorController")
|
||||
_errorSound = NodePath("AudioStreamPlayer")
|
||||
SelectorScene = ExtResource("24_j6bpw")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="ActivationProvider"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.294313, 0)
|
||||
|
|
|
|||
|
|
@ -1,30 +1,13 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://dsaj5dx82brsg"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://dsaj5dx82brsg"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://dde36pgb8fbwc" path="res://Sprites/selector_big.png" id="1_undfg"]
|
||||
[ext_resource type="Script" uid="uid://w85hem1ec8cq" path="res://Scripts/Tools/AnimatedTextureRect.gd" id="2_cjotf"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_vxp1j"]
|
||||
atlas = ExtResource("1_undfg")
|
||||
region = Rect2(0, 0, 16, 16)
|
||||
[ext_resource type="SpriteFrames" uid="uid://dhn6pld33ek0v" path="res://Resources/Sprites/Selector.tres" id="3_cjotf"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_bnh43"]
|
||||
atlas = ExtResource("1_undfg")
|
||||
region = Rect2(16, 0, 16, 16)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_0vbph"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_vxp1j")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_bnh43")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"default",
|
||||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[node name="UiSelector" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
|
|
@ -39,7 +22,7 @@ offset_left = -8.0
|
|||
offset_top = -8.0
|
||||
offset_right = 8.0
|
||||
offset_bottom = 8.0
|
||||
texture = SubResource("AtlasTexture_vxp1j")
|
||||
texture = SubResource("AtlasTexture_bnh43")
|
||||
stretch_mode = 2
|
||||
script = ExtResource("2_cjotf")
|
||||
Frames = SubResource("SpriteFrames_0vbph")
|
||||
Frames = ExtResource("3_cjotf")
|
||||
|
|
|
|||
16
Scenes/HUD/WorldSelector3D.tscn
Normal file
16
Scenes/HUD/WorldSelector3D.tscn
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://cwnyegefc8o6q"]
|
||||
|
||||
[ext_resource type="SpriteFrames" uid="uid://dhn6pld33ek0v" path="res://Resources/Sprites/Selector.tres" id="1_vi7xt"]
|
||||
|
||||
[node name="UiSelector" type="Node3D"]
|
||||
|
||||
[node name="Sprite" type="AnimatedSprite3D" parent="."]
|
||||
transform = Transform3D(0.70710677, -0.49999997, 0.49999997, 0, 0.70710677, 0.70710677, -0.70710677, -0.49999997, 0.49999997, 0, 0, 0)
|
||||
pixel_size = 0.05
|
||||
no_depth_test = true
|
||||
texture_filter = 0
|
||||
render_priority = 10
|
||||
sprite_frames = ExtResource("1_vi7xt")
|
||||
autoplay = "default"
|
||||
frame = 1
|
||||
frame_progress = 0.888575
|
||||
|
|
@ -125,7 +125,7 @@ public partial class PreviewMarker3D : Marker3D
|
|||
if (!Engine.IsEditorHint()) return;
|
||||
if (_sprite is not null)
|
||||
{
|
||||
GD.Print($"Modulating sprite to {alpha}");
|
||||
//GD.Print($"Modulating sprite to {alpha}");
|
||||
_sprite.SetModulate(new Color(_sprite.Modulate.R, _sprite.Modulate.G, _sprite.Modulate.B, alpha));
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -48,12 +48,8 @@ public partial class IsoActivationProvider: Area3D, IModule<PlayerState, Charact
|
|||
StateMachine = machine;
|
||||
|
||||
_selectorController.Hide();
|
||||
|
||||
|
||||
if (Hud.Instance is not null)
|
||||
{
|
||||
Hud.Instance.CreateSelector(_selectorController);
|
||||
}
|
||||
|
||||
SpawnSelector();
|
||||
|
||||
// if (SelectorScene is not null && _selector is null)
|
||||
// {
|
||||
|
|
@ -62,6 +58,43 @@ public partial class IsoActivationProvider: Area3D, IModule<PlayerState, Charact
|
|||
// }
|
||||
}
|
||||
|
||||
private void SpawnSelector()
|
||||
{
|
||||
var sel = SelectorScene.Instantiate<Node3D>();
|
||||
StateMachine.MainObject.GetParent().AddChild(sel);
|
||||
sel.GlobalPosition = StateMachine.MainObject.GlobalPosition;
|
||||
|
||||
_selectorController.ShowSelector += () =>
|
||||
{
|
||||
sel.Show();
|
||||
};
|
||||
|
||||
_selectorController.HideSelector += () =>
|
||||
{
|
||||
sel.Reparent(this);
|
||||
sel.Hide();
|
||||
};
|
||||
|
||||
_selectorController.ChangeParent3D += parent =>
|
||||
{
|
||||
if (parent is not null)
|
||||
{
|
||||
sel.Reparent(parent);
|
||||
}
|
||||
else
|
||||
{
|
||||
sel.Reparent(this);
|
||||
sel.Hide();
|
||||
}
|
||||
|
||||
sel.Position = Vector3.Zero;
|
||||
};
|
||||
// if (Hud.Instance is not null)
|
||||
// {
|
||||
// Hud.Instance.CreateSelector(_selectorController);
|
||||
// }
|
||||
}
|
||||
|
||||
public void Process(double delta)
|
||||
{
|
||||
|
||||
|
|
@ -69,7 +102,7 @@ public partial class IsoActivationProvider: Area3D, IModule<PlayerState, Charact
|
|||
|
||||
public void PhysicsProcess(double delta)
|
||||
{
|
||||
_selectorController.PhysicsProcess(delta);
|
||||
//_selectorController.PhysicsProcess(delta);
|
||||
|
||||
HandleInteraction();
|
||||
}
|
||||
|
|
@ -110,6 +143,7 @@ public partial class IsoActivationProvider: Area3D, IModule<PlayerState, Charact
|
|||
if (success)
|
||||
{
|
||||
// Deselect and scan for next
|
||||
_selectorController.RemoveInteractable(selected);
|
||||
_selectorController.SelectNext();
|
||||
//_selector.RemoveInteractable(selected);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ public partial class SelectorController : Node
|
|||
[Signal] public delegate void HideSelectorEventHandler();
|
||||
[Signal] public delegate void ChangePositionEventHandler(Vector2 position);
|
||||
|
||||
[Signal] public delegate void ChangeParent3DEventHandler(Node3D node);
|
||||
|
||||
private Interactable _lastInteractable;
|
||||
|
||||
private List<IInteractable> _interactables = [];
|
||||
|
|
@ -100,10 +102,7 @@ public partial class SelectorController : Node
|
|||
|
||||
public void RemoveInteractable(IInteractable interactable)
|
||||
{
|
||||
if (_interactables.Contains(interactable))
|
||||
{
|
||||
_interactables.Remove(interactable);
|
||||
}
|
||||
_interactables.Remove(interactable);
|
||||
|
||||
UpdatePosition();
|
||||
}
|
||||
|
|
@ -119,6 +118,8 @@ public partial class SelectorController : Node
|
|||
if (SelectedInteractable != null)
|
||||
{
|
||||
EmitSignalChangePosition(SelectedInteractable.GetScreenPosition());
|
||||
//EmitSignalChangePosition3D();
|
||||
EmitSignalChangeParent3D(SelectedInteractable as Node3D);
|
||||
EmitSignalShowSelector();
|
||||
}
|
||||
else
|
||||
|
|
@ -137,9 +138,9 @@ public partial class SelectorController : Node
|
|||
EmitSignalHideSelector();
|
||||
}
|
||||
|
||||
public void PhysicsProcess(double delta)
|
||||
{
|
||||
if (SelectedInteractable is null) return;
|
||||
EmitSignalChangePosition(SelectedInteractable.GetScreenPosition());
|
||||
}
|
||||
// public void PhysicsProcess(double delta)
|
||||
// {
|
||||
// if (SelectedInteractable is null) return;
|
||||
// //EmitSignalChangePosition(SelectedInteractable.GetScreenPosition());
|
||||
// }
|
||||
}
|
||||
|
|
@ -3,32 +3,39 @@
|
|||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dde36pgb8fbwc"
|
||||
path="res://.godot/imported/selector_big.png-27577e86fb500a19a8e9ac34042c9f91.ctex"
|
||||
path.s3tc="res://.godot/imported/selector_big.png-27577e86fb500a19a8e9ac34042c9f91.s3tc.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Sprites/selector_big.png"
|
||||
dest_files=["res://.godot/imported/selector_big.png-27577e86fb500a19a8e9ac34042c9f91.ctex"]
|
||||
dest_files=["res://.godot/imported/selector_big.png-27577e86fb500a19a8e9ac34042c9f91.s3tc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
detect_3d/compress_to=0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue