mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:15:33 +00:00
Directional spider bomb
This commit is contained in:
parent
029128c8b8
commit
36e77adcd7
8 changed files with 44 additions and 6 deletions
|
|
@ -8,7 +8,11 @@ public partial class Active : PlayerStateBase
|
|||
{
|
||||
public override PlayerState StateId => PlayerState.Active;
|
||||
private Vector2 _movementDirection { get; set; }
|
||||
public Vector2 FacingDirection { get; private set; } = Vector2.Down;
|
||||
public Vector2 FacingDirection
|
||||
{
|
||||
get => _storageModule.FacingDirection;
|
||||
private set => _storageModule.FacingDirection = value;
|
||||
}
|
||||
|
||||
[Export]
|
||||
public int Speed { get; set; } = 45;
|
||||
|
|
@ -32,6 +36,8 @@ public partial class Active : PlayerStateBase
|
|||
[Export] private ActivationProvider _activationProvider;
|
||||
|
||||
[Export] private InteractionController _interactionController;
|
||||
|
||||
[Export] private PlayerStorageModule _storageModule;
|
||||
|
||||
private bool _isStrafing;
|
||||
|
||||
|
|
|
|||
|
|
@ -10,8 +10,12 @@ public partial class Init : PlayerStateBase
|
|||
|
||||
[Export]
|
||||
private PlayerAnimationProvider _animationProvider;
|
||||
|
||||
[Export] private PlayerStorageModule _storageModule;
|
||||
|
||||
public override void EnterState()
|
||||
{
|
||||
_storageModule.FacingDirection = ((PlayerStateMachine)StateMachine).StartingDirection;
|
||||
_animationProvider.PlayUnteleportAnimation();
|
||||
_ = AutoSwitchToStart();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,14 @@ public partial class PlayerFSMItemUseModule : ModuleBase<PlayerState, CharacterB
|
|||
[Export]
|
||||
public ActorResourceProvider Shield { get; set; }
|
||||
|
||||
[Export] private PlayerStorageModule _storageModule;
|
||||
|
||||
public Vector2 FacingDirection
|
||||
{
|
||||
get => _storageModule.FacingDirection;
|
||||
private set => _storageModule.FacingDirection = value;
|
||||
}
|
||||
|
||||
public bool Enabled { get; set; } = false;
|
||||
|
||||
public override void EnterState(PlayerState state)
|
||||
|
|
@ -105,7 +113,8 @@ public partial class PlayerFSMItemUseModule : ModuleBase<PlayerState, CharacterB
|
|||
var bulletData = item.WeaponData.MakeBullet(this.GlobalPosition);
|
||||
|
||||
bullet.Initialize(bulletData, GameManager.Instance);
|
||||
|
||||
bullet.SetDirection(FacingDirection);
|
||||
bullet.RotateSpriteDegrees(-90);
|
||||
//bullet.SetDirection(_facingDirection);
|
||||
bullet.Speed = item.WeaponData.BulletData.BulletSpeed;
|
||||
|
||||
|
|
|
|||
8
Scripts/Components/FSM/Player/PlayerStorageModule.cs
Normal file
8
Scripts/Components/FSM/Player/PlayerStorageModule.cs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Components.FSM.Player;
|
||||
|
||||
public partial class PlayerStorageModule : Node2D
|
||||
{
|
||||
public Vector2 FacingDirection { get; set; }
|
||||
}
|
||||
1
Scripts/Components/FSM/Player/PlayerStorageModule.cs.uid
Normal file
1
Scripts/Components/FSM/Player/PlayerStorageModule.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dbxbvjonbtib2
|
||||
|
|
@ -7,6 +7,8 @@ public partial class PlayerStateMachine : StateMachineBase<PlayerState, Characte
|
|||
{
|
||||
[Export] public override PlayerState InitialState { get; protected set; } = PlayerState.Init;
|
||||
|
||||
[Export] public Vector2 StartingDirection { get; set; } = Vector2.Down;
|
||||
|
||||
public void RefillHealth()
|
||||
{
|
||||
GD.Print("Refilling health");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue