mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-05 22:25:54 +00:00
Dialogue System
This commit is contained in:
parent
77765a581e
commit
1fa77f0c03
690 changed files with 46698 additions and 14 deletions
27
Scripts/Activables/DialogueStarter.cs
Normal file
27
Scripts/Activables/DialogueStarter.cs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Activables;
|
||||
|
||||
public partial class DialogueStarter : Activable
|
||||
{
|
||||
|
||||
[Export] private string _trackName = "timeline";
|
||||
|
||||
private Node _dialogic;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
base._Ready();
|
||||
|
||||
_dialogic = GetNode("/root/Dialogic");
|
||||
}
|
||||
|
||||
public override void Activate()
|
||||
{
|
||||
_dialogic.Call("start", _trackName);
|
||||
// Script dialogic = ResourceLoader.Load("res://addons/dialogic/Other/DialogicClass.gd") as Script;
|
||||
// var dialog = (Node) dialogic.Call("start","timeline");
|
||||
// AddChild(dialog);
|
||||
//if (Dialogic)
|
||||
}
|
||||
}
|
||||
|
|
@ -4,11 +4,13 @@ using Godot.Collections;
|
|||
|
||||
namespace Cirno.Scripts.Actors;
|
||||
|
||||
public partial class Boss : Enemy
|
||||
public partial class Boss : Enemy, IActivable
|
||||
{
|
||||
[Export] private Array<BossPhase> Phases;
|
||||
private int currentPhaseIndex = 0;
|
||||
|
||||
private bool _started = false;
|
||||
|
||||
private GameManager _gameManager;
|
||||
|
||||
private Vector2 _homePosition;
|
||||
|
|
@ -25,12 +27,14 @@ public partial class Boss : Enemy
|
|||
|
||||
_homePosition = this.GlobalPosition;
|
||||
|
||||
StartPhase(CurrentPhase);
|
||||
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
base._Process(delta);
|
||||
|
||||
if (!_started) return;
|
||||
|
||||
CurrentPhase.UpdatePhase(delta);
|
||||
if (_currentHealth <= CurrentPhase.Threshold && currentPhaseIndex + 1 < Phases.Count)
|
||||
|
|
@ -48,7 +52,14 @@ public partial class Boss : Enemy
|
|||
|
||||
public void TakeDamage(int amount)
|
||||
{
|
||||
if (!_started) return;
|
||||
|
||||
_currentHealth -= amount;
|
||||
}
|
||||
|
||||
|
||||
public void Activate()
|
||||
{
|
||||
_started = true;
|
||||
StartPhase(CurrentPhase);
|
||||
}
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@ namespace Cirno.Scripts.Interactables;
|
|||
|
||||
public partial class AreaTrigger : Area2D
|
||||
{
|
||||
[Export] public Activable Target { get; set; }
|
||||
[Export] public Node2D Target { get; set; }
|
||||
|
||||
[Export] public bool OneTime { get; set; }
|
||||
[Export] public bool DoNotActivateOnFirst { get; set; }
|
||||
|
|
@ -20,8 +20,9 @@ public partial class AreaTrigger : Area2D
|
|||
}
|
||||
|
||||
if (OneTime && _activations > 0) return false;
|
||||
|
||||
Target?.Activate();
|
||||
|
||||
if (Target is not IActivable target) return false;
|
||||
target.Activate();
|
||||
|
||||
_activations++;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue