mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 10:25:35 +00:00
Nonworking script
This commit is contained in:
parent
0d2302c9fe
commit
7b8abba100
3 changed files with 42 additions and 15 deletions
2
Cirno.sln.DotSettings.user
Normal file
2
Cirno.sln.DotSettings.user
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACastHelpers_002Ecs_002Fl_003AC_0021_003FUsers_003FMaddo_003FAppData_003FLocal_003FJetBrains_003FShared_003FvAny_003FSourcesCache_003F3c92637ae2e83da0a63791071c41eae291d594156062866d8621b7ed7245c_003FCastHelpers_002Ecs/@EntryIndexedValue">ForceIncluded</s:String></wpf:ResourceDictionary>
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=29 format=4 uid="uid://bv451a8wgty4u"]
|
||||
[gd_scene load_steps=28 format=4 uid="uid://bv451a8wgty4u"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/GameManager.cs" id="1_8tmoj"]
|
||||
[ext_resource type="PackedScene" uid="uid://bghghp5ep4w2j" path="res://Scenes/player.tscn" id="2_8mh54"]
|
||||
|
|
@ -14,7 +14,6 @@
|
|||
[ext_resource type="PackedScene" uid="uid://crph24e6e0v0q" path="res://Scenes/Interactable/Control_Pad.tscn" id="12_hfkf1"]
|
||||
[ext_resource type="PackedScene" uid="uid://l84on3kv2s52" path="res://Scenes/Door_Horizontal.tscn" id="12_i7i2m"]
|
||||
[ext_resource type="PackedScene" uid="uid://bnhck5eh0tqxf" path="res://Scenes/Props/MediumTerminal.tscn" id="13_acrmt"]
|
||||
[ext_resource type="Script" path="res://addons/ButtonLink/DoorButtonVisualizer.cs" id="14_6cydc"]
|
||||
[ext_resource type="PackedScene" uid="uid://bqq3q37hugdlj" path="res://Scenes/Door.tscn" id="14_y363m"]
|
||||
[ext_resource type="PackedScene" uid="uid://bgk7fgwiis425" path="res://Scenes/Props/Box_Red.tscn" id="15_m0y0j"]
|
||||
[ext_resource type="PackedScene" uid="uid://bc64lr3vlwchq" path="res://Scenes/Door_Vertical.tscn" id="15_mgtvp"]
|
||||
|
|
@ -286,10 +285,6 @@ Target = NodePath("../Door_vertical")
|
|||
position = Vector2(-824, 167)
|
||||
Target = NodePath("../Door_vertical2")
|
||||
|
||||
[node name="ButtonDoorVisualizer" type="Node2D" parent="Factory Tilemaps/ControlPad2"]
|
||||
script = ExtResource("14_6cydc")
|
||||
TargetPath = NodePath("../../Door_vertical2")
|
||||
|
||||
[node name="ControlPad4" parent="Factory Tilemaps" node_paths=PackedStringArray("Target") instance=ExtResource("12_hfkf1")]
|
||||
position = Vector2(-856, 167)
|
||||
Target = NodePath("../Door_vertical2")
|
||||
|
|
|
|||
|
|
@ -3,21 +3,51 @@
|
|||
[Tool]
|
||||
public partial class DoorButtonVisualizer : Node2D
|
||||
{
|
||||
[Export] public NodePath TargetPath; // Expose the Target NodePath in the editor
|
||||
// [Export] public NodePath TargetPath; // Expose the Target NodePath in the editor
|
||||
|
||||
// public override void _Ready()
|
||||
// {
|
||||
//
|
||||
// }
|
||||
|
||||
private Interactable _parent;
|
||||
|
||||
public override void _EnterTree()
|
||||
{
|
||||
var p = GetParent();
|
||||
if (p == null) return;
|
||||
if (p is Interactable parent)
|
||||
{
|
||||
_parent = parent;
|
||||
}
|
||||
//if (_parent == null) return;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override void _Draw()
|
||||
{
|
||||
if (TargetPath == null || !Engine.IsEditorHint())
|
||||
return;
|
||||
//var parent = GetParent<Interactable>();
|
||||
if (_parent != null) return;
|
||||
|
||||
//if (GetParent() is not Interactable parent) return;
|
||||
if (!Engine.IsEditorHint()) return;
|
||||
|
||||
// if (TargetPath == null || !Engine.IsEditorHint())
|
||||
// return;
|
||||
|
||||
if (_parent is not Interactable p) return;
|
||||
|
||||
if (p.Target == null) return;
|
||||
|
||||
// Get the target node
|
||||
Node targetNode = GetNodeOrNull(TargetPath);
|
||||
if (targetNode == null || !(targetNode is Node2D target))
|
||||
return;
|
||||
// Node targetNode = GetNodeOrNull(TargetPath);
|
||||
// if (targetNode == null || !(targetNode is Node2D target))
|
||||
// return;
|
||||
|
||||
// Draw a line to the target
|
||||
Vector2 start = GlobalPosition;
|
||||
Vector2 end = target.GlobalPosition;
|
||||
var start = GlobalPosition;
|
||||
var end = p.Target.GlobalPosition;
|
||||
|
||||
DrawLine(ToLocal(start), ToLocal(end), Colors.Green, 2);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue