mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:15:33 +00:00
Cheat buttons
This commit is contained in:
parent
0a631bf5b7
commit
e637f69ce6
7 changed files with 98 additions and 16 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using Cirno.Scripts.Components.Actors;
|
||||
using Cirno.Scripts.Resources;
|
||||
using Godot;
|
||||
|
||||
|
|
@ -6,6 +7,12 @@ namespace Cirno.Scripts.Components.FSM.Player;
|
|||
|
||||
public partial class PlayerFSMItemUseModule : ModuleBase<PlayerState, CharacterBody2D>
|
||||
{
|
||||
[Export]
|
||||
public ActorResourceProvider Health { get; set; }
|
||||
|
||||
[Export]
|
||||
public ActorResourceProvider Shield { get; set; }
|
||||
|
||||
public bool Enabled { get; set; } = false;
|
||||
|
||||
public override void EnterState(PlayerState state)
|
||||
|
|
@ -43,15 +50,18 @@ public partial class PlayerFSMItemUseModule : ModuleBase<PlayerState, CharacterB
|
|||
case ItemTypes.Ammo:
|
||||
break;
|
||||
case ItemTypes.Medkit:
|
||||
Heal(item);
|
||||
break;
|
||||
case ItemTypes.FrogBomb:
|
||||
SpawnSpiderBomb(item);
|
||||
break;
|
||||
case ItemTypes.Bomb:
|
||||
SpawnBomb(item);
|
||||
break;
|
||||
case ItemTypes.Mine:
|
||||
break;
|
||||
case ItemTypes.Battery:
|
||||
RechargeShield(item);
|
||||
break;
|
||||
case ItemTypes.Weapon:
|
||||
break;
|
||||
|
|
@ -67,6 +77,21 @@ public partial class PlayerFSMItemUseModule : ModuleBase<PlayerState, CharacterB
|
|||
|
||||
}
|
||||
|
||||
private void SpawnBomb(LootItem item)
|
||||
{
|
||||
GD.Print("Spawned bomb");
|
||||
}
|
||||
|
||||
private void Heal(LootItem item)
|
||||
{
|
||||
Health.CurrentResource += Mathf.CeilToInt(Health.MaxResource * 25 / 100);
|
||||
}
|
||||
|
||||
private void RechargeShield(LootItem item)
|
||||
{
|
||||
Shield.CurrentResource += Mathf.CeilToInt(Health.MaxResource * 25 / 100);
|
||||
}
|
||||
|
||||
private void SpawnSpiderBomb(LootItem item)
|
||||
{
|
||||
//var bullet = item.WeaponData.BulletData.BulletScene.Instantiate<Bullet>();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue