mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:15:33 +00:00
Terminal dialogue and entities fix
This commit is contained in:
parent
fe33f8d225
commit
dd979fe50a
16 changed files with 1078 additions and 912 deletions
|
|
@ -1,10 +1,12 @@
|
|||
using Cirno.Scripts.Resources.Events;
|
||||
using Cirno.Scripts.Interactables;
|
||||
using Cirno.Scripts.Misc;
|
||||
using Cirno.Scripts.Resources.Events;
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
||||
namespace Cirno.Scripts.Activables;
|
||||
|
||||
public partial class ScriptableArea3D : Area3D, IActivable
|
||||
public partial class ScriptableArea3D : Area3D, IActivable, IInteractable
|
||||
{
|
||||
[Export] public Array<EventResource> Events { get; set; } = [];
|
||||
|
||||
|
|
@ -71,4 +73,19 @@ public partial class ScriptableArea3D : Area3D, IActivable
|
|||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public Vector2 GetGlobalPosition2D()
|
||||
{
|
||||
return new Vector2(this.GlobalPosition.X, this.GlobalPosition.Z);
|
||||
}
|
||||
|
||||
public Vector2 GetScreenPosition()
|
||||
{
|
||||
if (CameraController3D.Instance is null)
|
||||
{
|
||||
return this.GetGlobalPosition2D();
|
||||
}
|
||||
|
||||
return CameraController3D.Instance.UnprojectPosition(this.GlobalPosition);
|
||||
}
|
||||
}
|
||||
55
Scripts/Activables/Terminal3D.cs
Normal file
55
Scripts/Activables/Terminal3D.cs
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
using Cirno.Scripts.Interactables;
|
||||
using Cirno.Scripts.Misc;
|
||||
using Cirno.Scripts.Utils;
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
||||
namespace Cirno.Scripts.Activables;
|
||||
|
||||
[Tool]
|
||||
public partial class Terminal3D : Area3D, IInteractable
|
||||
{
|
||||
[Export] public StringName TimelineName = "timeline";
|
||||
private DialogueTools _dialogueInstance;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
if (Engine.IsEditorHint()) return;
|
||||
_dialogueInstance = new DialogueTools();
|
||||
_dialogueInstance.Init(this, TimelineName);
|
||||
}
|
||||
|
||||
public void _func_godot_apply_properties(Dictionary<string, string> props)
|
||||
{
|
||||
TimelineName = props["timeline"];
|
||||
}
|
||||
|
||||
public bool Activate(ActivationType activationType = ActivationType.Toggle)
|
||||
{
|
||||
if (Engine.IsEditorHint()) return false;
|
||||
_dialogueInstance.Start(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CanActivate()
|
||||
{
|
||||
if (Engine.IsEditorHint()) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public Vector2 GetGlobalPosition2D()
|
||||
{
|
||||
return new Vector2(this.GlobalPosition.X, this.GlobalPosition.Z);
|
||||
}
|
||||
|
||||
public Vector2 GetScreenPosition()
|
||||
{
|
||||
if (CameraController3D.Instance is null)
|
||||
{
|
||||
return this.GetGlobalPosition2D();
|
||||
}
|
||||
|
||||
return CameraController3D.Instance.UnprojectPosition(this.GlobalPosition);
|
||||
}
|
||||
}
|
||||
1
Scripts/Activables/Terminal3D.cs.uid
Normal file
1
Scripts/Activables/Terminal3D.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://duy020jwtwver
|
||||
Loading…
Add table
Add a link
Reference in a new issue