mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-12 07:05:54 +00:00
Interactable interface
This commit is contained in:
parent
49e58ff735
commit
54d9824581
27 changed files with 102 additions and 61 deletions
|
|
@ -16,7 +16,7 @@ public partial class BlackCover : Sprite2D, IActivable
|
|||
UpdateSprite();
|
||||
}
|
||||
|
||||
public void Activate(ActivationType activationType = ActivationType.Toggle)
|
||||
public bool Activate(ActivationType activationType = ActivationType.Toggle)
|
||||
{
|
||||
switch (activationType)
|
||||
{
|
||||
|
|
@ -36,6 +36,7 @@ public partial class BlackCover : Sprite2D, IActivable
|
|||
break;
|
||||
}
|
||||
UpdateSprite();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void UpdateSprite()
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public partial class BulletEmitter : Node2D, IActivable
|
|||
_bulletSpawner.SpawnBullet(BulletResource.MakeBullet(this.GlobalPosition, Count, Spread, EmissionRotation));
|
||||
}
|
||||
|
||||
public void Activate(ActivationType activationType = ActivationType.Toggle)
|
||||
public bool Activate(ActivationType activationType = ActivationType.Toggle)
|
||||
{
|
||||
switch (activationType)
|
||||
{
|
||||
|
|
@ -77,5 +77,7 @@ public partial class BulletEmitter : Node2D, IActivable
|
|||
case ActivationType.Destroy:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -35,7 +35,7 @@ public partial class DialogueStarter : ChainActivable
|
|||
DialogueEndAction();
|
||||
}
|
||||
|
||||
public override void Activate(ActivationType activationType = ActivationType.Toggle)
|
||||
public override bool Activate(ActivationType activationType = ActivationType.Toggle)
|
||||
{
|
||||
_dialogic.Connect("timeline_ended", Callable.From(OnTimelineEnded));
|
||||
|
||||
|
|
@ -43,6 +43,7 @@ public partial class DialogueStarter : ChainActivable
|
|||
((Node)dialogicNode).ProcessMode = ProcessModeEnum.Always;
|
||||
_gameManager.ChangeState(GameState.Dialogue);
|
||||
|
||||
return true;
|
||||
// Script dialogic = ResourceLoader.Load("res://addons/dialogic/Other/DialogicClass.gd") as Script;
|
||||
// var dialog = (Node) dialogic.Call("start","timeline");
|
||||
// AddChild(dialog);
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ public partial class HealthStation : Activable
|
|||
_healingTimer = 0;
|
||||
}
|
||||
|
||||
public override void Activate(ActivationType activationType = ActivationType.Toggle)
|
||||
public override bool Activate(ActivationType activationType = ActivationType.Toggle)
|
||||
{
|
||||
switch (activationType)
|
||||
{
|
||||
|
|
@ -90,6 +90,8 @@ public partial class HealthStation : Activable
|
|||
// Destroys
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void _on_area_entered(Area2D area)
|
||||
|
|
|
|||
|
|
@ -34,11 +34,13 @@ public partial class PlayerMover : ChainActivable
|
|||
_gameManager = this.GetGameManager();
|
||||
}
|
||||
|
||||
public override void Activate(ActivationType activationType = ActivationType.Toggle)
|
||||
public override bool Activate(ActivationType activationType = ActivationType.Toggle)
|
||||
{
|
||||
if (_gameManager.Player is null) return;
|
||||
if (_gameManager.Player is null) return false;
|
||||
|
||||
_ = MovePlayer();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private async Task MovePlayer()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using Cirno.Scripts.Interactables;
|
||||
using Cirno.Scripts.Resources.Events;
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
|
@ -63,8 +64,15 @@ public partial class ScriptableBase : Node2D, IActivable
|
|||
// }
|
||||
}
|
||||
|
||||
public void Activate(ActivationType activationType = ActivationType.Toggle)
|
||||
public bool Activate(ActivationType activationType = ActivationType.Toggle)
|
||||
{
|
||||
Start();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CanActivate()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -76,7 +76,7 @@ public partial class Teleporter : Activable
|
|||
}
|
||||
}
|
||||
|
||||
public override void Activate(ActivationType activationType = ActivationType.Toggle)
|
||||
public override bool Activate(ActivationType activationType = ActivationType.Toggle)
|
||||
{
|
||||
switch (activationType)
|
||||
{
|
||||
|
|
@ -100,6 +100,8 @@ public partial class Teleporter : Activable
|
|||
// Destroys
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void PrepareForReceiving()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue