Make adjustments to bad end map
Modify debug menu slightly to pause while open (need to close the menu to load floors, etc) Clear map when game over screen appears
This commit is contained in:
@@ -30,10 +30,14 @@ public interface IPlayer : IKillable, ICharacterBody3D
|
||||
|
||||
public void SetSigil(ISigil sigil);
|
||||
|
||||
public void ShowCamera(bool showCamera);
|
||||
|
||||
public void ApplyNewAugment(IAugmentItem jewel, IAugmentableItem equipableItem);
|
||||
|
||||
public IBaseInventoryItem IdentifyItem(IBaseInventoryItem unidentifiedItem);
|
||||
|
||||
public void ShakePlayerCamera(float shakeIntensity, float shakeAmount);
|
||||
|
||||
public IInventory Inventory { get; }
|
||||
|
||||
public IHealthComponent HealthComponent { get; }
|
||||
@@ -52,7 +56,7 @@ public interface IPlayer : IKillable, ICharacterBody3D
|
||||
|
||||
public IStatusEffectComponent StatusEffectComponent { get; }
|
||||
|
||||
public ISigilComponent SigilComponent { get; }
|
||||
public ISigilComponent SigilComponent { get; }
|
||||
|
||||
public void SetHealthTimerStatus(bool isActive);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=29 format=3 uid="uid://brgi35xj3b4ud"]
|
||||
[gd_scene load_steps=30 format=3 uid="uid://brgi35xj3b4ud"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cw100tox0ufsy" path="res://src/audio/SfxDatabase.cs" id="1_ojkqd"]
|
||||
[ext_resource type="AudioStream" uid="uid://cye8wlqbx66h4" path="res://src/audio/sfx/player_heal.ogg" id="2_158j8"]
|
||||
@@ -22,6 +22,7 @@
|
||||
[ext_resource type="AudioStream" uid="uid://brb8xj4vsgcw4" path="res://src/audio/sfx/player_DEBUFF.ogg" id="18_bi4v5"]
|
||||
[ext_resource type="AudioStream" uid="uid://coeynqnn61c43" path="res://src/audio/sfx/environment_ITEM_TRANSFER.ogg" id="18_l6w22"]
|
||||
[ext_resource type="AudioStream" uid="uid://bfrmm07vthpwt" path="res://src/audio/sfx/item_divine_recall.ogg" id="19_nerso"]
|
||||
[ext_resource type="AudioStream" uid="uid://dl6svxp5ow2vk" path="res://src/audio/sfx/player_death_1.ogg" id="19_uv31i"]
|
||||
[ext_resource type="AudioStream" uid="uid://bu8akh5uh3ioo" path="res://src/audio/sfx/item_devic_balance_element1.ogg" id="20_rloay"]
|
||||
[ext_resource type="AudioStream" uid="uid://bjkn6s2xjxuji" path="res://src/audio/sfx/item_gospel_dimension.ogg" id="21_6hsck"]
|
||||
[ext_resource type="AudioStream" uid="uid://c3ur4bgvmsidi" path="res://src/audio/sfx/item_gospel_escape.ogg" id="22_3wq6u"]
|
||||
@@ -139,6 +140,12 @@ process_mode = 3
|
||||
stream = ExtResource("18_bi4v5")
|
||||
bus = &"SFX"
|
||||
|
||||
[node name="DeathSound" type="AudioStreamPlayer" parent="Player"]
|
||||
unique_name_in_owner = true
|
||||
process_mode = 3
|
||||
stream = ExtResource("19_uv31i")
|
||||
bus = &"SFX"
|
||||
|
||||
[node name="Item" type="Node" parent="."]
|
||||
|
||||
[node name="TransferItemSound" type="AudioStreamPlayer" parent="Item"]
|
||||
|
||||
@@ -33,6 +33,7 @@ public partial class SfxDatabase : Node
|
||||
{SoundEffect.Unequip, UnequipSound },
|
||||
{SoundEffect.Buff, BuffSound },
|
||||
{SoundEffect.Debuff, DebuffSound },
|
||||
{SoundEffect.Death, DeathSound },
|
||||
{SoundEffect.SortInventory, SortSound },
|
||||
{SoundEffect.SelectUI, SelectSound },
|
||||
{SoundEffect.CancelUI, CancelSound },
|
||||
@@ -67,6 +68,7 @@ public partial class SfxDatabase : Node
|
||||
[Node] private AudioStreamPlayer UnequipSound { get; set; }
|
||||
[Node] private AudioStreamPlayer BuffSound { get; set; }
|
||||
[Node] private AudioStreamPlayer DebuffSound { get; set; }
|
||||
[Node] private AudioStreamPlayer DeathSound { get; set; }
|
||||
[Node] private AudioStreamPlayer SortSound { get; set; }
|
||||
[Node] private AudioStreamPlayer SelectSound { get; set; }
|
||||
[Node] private AudioStreamPlayer CancelSound { get; set; }
|
||||
@@ -120,6 +122,7 @@ public enum SoundEffect
|
||||
WeaponPlasmaSword,
|
||||
Eucharistia,
|
||||
Buff,
|
||||
Debuff
|
||||
Debuff,
|
||||
Death
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ public partial class ShakeCamera : Camera3D
|
||||
{
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
[Export] private double _shakeIntensity = 1.0;
|
||||
[Export] public double _shakeIntensity { get; set; } = 1.0;
|
||||
|
||||
[Export] private double _maxX = 10;
|
||||
[Export] private double _maxY = 10;
|
||||
@@ -24,28 +24,28 @@ public partial class ShakeCamera : Camera3D
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_initialRotation = RotationDegrees;
|
||||
_initialRotation = RotationDegrees;
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
_time += delta;
|
||||
_shake = Mathf.Max(_shake - delta * _shakeIntensity, 0.0);
|
||||
_time += delta;
|
||||
_shake = Mathf.Max(_shake - delta * _shakeIntensity, 0.0);
|
||||
|
||||
RotationDegrees = new Vector3(
|
||||
(float)(_initialRotation.X + _maxX * Mathf.Pow(_shake, 2) * GetNoiseFromSeed(0)),
|
||||
(float)(_initialRotation.Y + _maxY * Mathf.Pow(_shake, 2) * GetNoiseFromSeed(1)),
|
||||
(float)(_initialRotation.Z + _maxZ * Mathf.Pow(_shake, 2) * GetNoiseFromSeed(2)));
|
||||
RotationDegrees = new Vector3(
|
||||
(float)(_initialRotation.X + _maxX * Mathf.Pow(_shake, 2) * GetNoiseFromSeed(0)),
|
||||
(float)(_initialRotation.Y + _maxY * Mathf.Pow(_shake, 2) * GetNoiseFromSeed(1)),
|
||||
(float)(_initialRotation.Z + _maxZ * Mathf.Pow(_shake, 2) * GetNoiseFromSeed(2)));
|
||||
}
|
||||
|
||||
public void AddShake(float shakeAmount)
|
||||
{
|
||||
_shake = Mathf.Clamp(_shake + shakeAmount, 0.0, 1.0);
|
||||
_shake = Mathf.Clamp(_shake + shakeAmount, 0.0, 1.0);
|
||||
}
|
||||
|
||||
private double GetNoiseFromSeed(int seed)
|
||||
{
|
||||
_noise.Seed = seed;
|
||||
return _noise.GetNoise1D((float)(_time * _noiseSpeed));
|
||||
_noise.Seed = seed;
|
||||
return _noise.GetNoise1D((float)(_time * _noiseSpeed));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,6 +215,7 @@ public partial class Game : Node3D, IGame
|
||||
_player.PlayerDied += GameOver;
|
||||
GameOverMenu.NewGame += OnNewGame;
|
||||
GameOverMenu.QuitGame += OnQuit;
|
||||
GameOverMenu.GameOverMenuVisible += GameOverMenuAppeared;
|
||||
|
||||
PauseMenu.ExitGamePressed += OnQuit;
|
||||
PauseMenu.UnpauseButtonPressed += OnResume;
|
||||
@@ -339,6 +340,7 @@ public partial class Game : Node3D, IGame
|
||||
{
|
||||
QuestData.DeathCount++;
|
||||
await Save();
|
||||
_player.SetSigil(new NoneSigil());
|
||||
_player.Deactivate();
|
||||
GameRepo.Pause();
|
||||
GameState.Input(new GameState.Input.GameOver());
|
||||
@@ -393,15 +395,13 @@ public partial class Game : Node3D, IGame
|
||||
})
|
||||
.Handle((in GameState.Output.OpenDebugMenu _) =>
|
||||
{
|
||||
GameRepo.Pause();
|
||||
InGameUI.DebugMenu.Show();
|
||||
InGameUI.PlayerInfoUI.Hide();
|
||||
_player.Deactivate();
|
||||
})
|
||||
.Handle((in GameState.Output.CloseDebugMenu _) =>
|
||||
{
|
||||
GameRepo.Resume();
|
||||
InGameUI.DebugMenu.Hide();
|
||||
InGameUI.PlayerInfoUI.Show();
|
||||
_player.Activate();
|
||||
})
|
||||
.Handle((in GameState.Output.OpenTeleportScreen _) =>
|
||||
{
|
||||
@@ -451,9 +451,6 @@ public partial class Game : Node3D, IGame
|
||||
.Handle((in GameState.Output.GameOver _) =>
|
||||
{
|
||||
GameOverMenu.FadeIn();
|
||||
var enemies = GetTree().GetNodesInGroup("enemy").OfType<IEnemy>();
|
||||
foreach (var enemy in enemies)
|
||||
enemy.CallDeferred(MethodName.QueueFree, []);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -961,6 +958,8 @@ public partial class Game : Node3D, IGame
|
||||
|
||||
private void OnQuit() => GameExitRequested?.Invoke();
|
||||
|
||||
private void GameOverMenuAppeared() => _map.ClearFloor();
|
||||
|
||||
private void OnResume() => GameState.Input(new GameState.Input.PauseButtonPressed());
|
||||
|
||||
public void OnExitTree()
|
||||
|
||||
@@ -88,7 +88,15 @@ public partial class Map : Node3D, IMap
|
||||
|
||||
public void ClearFloor()
|
||||
{
|
||||
CurrentFloor?.CallDeferred(MethodName.QueueFree, []);
|
||||
try
|
||||
{
|
||||
if (CurrentFloor != null && !CurrentFloor.IsQueuedForDeletion())
|
||||
CurrentFloor?.CallDeferred(MethodName.QueueFree, []);
|
||||
}
|
||||
catch (ObjectDisposedException ex)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public async Task LoadFloor()
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -3,33 +3,61 @@ using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
using System.Linq;
|
||||
using Zennysoft.Game.Ma;
|
||||
using Zennysoft.Ma.Adapter;
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class BadEnd : SpecialFloor
|
||||
{
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
[Dependency] protected IPlayer _player => this.DependOn(() => GetParent().GetChildren().OfType<IPlayer>().Single());
|
||||
[Dependency] protected IGame _game => this.DependOn<IGame>();
|
||||
|
||||
[Export] public float ShakeAmount = 50;
|
||||
|
||||
[Node] public Node3D EnemySpawnPoints { get; set; } = default!;
|
||||
|
||||
[Node] public Marker3D PlayerSpawnPoint { get; set; } = default!;
|
||||
|
||||
[Node] public ShakeCamera Camera3D { get; set; } = default!;
|
||||
|
||||
public void OnReady()
|
||||
{
|
||||
SpawnEnemies();
|
||||
var tweener = GetTree().CreateTween();
|
||||
tweener.TweenMethod(Callable.From((float x) => SetShakeValue(x)), ShakeAmount, 1f, 700f).SetDelay(30);
|
||||
}
|
||||
|
||||
public void StartEndGameCutscene()
|
||||
{
|
||||
_player.Deactivate();
|
||||
_player.ShowCamera(false);
|
||||
Camera3D.Current = true;
|
||||
}
|
||||
|
||||
public void EndGame()
|
||||
{
|
||||
SfxDatabase.Instance.Play(SoundEffect.Death);
|
||||
_game.GameOver();
|
||||
}
|
||||
|
||||
private void SetShakeValue(float shakeAmount)
|
||||
{
|
||||
_player.ShakePlayerCamera(shakeAmount, 1f);
|
||||
}
|
||||
|
||||
public void SpawnEnemies()
|
||||
{
|
||||
var enemySpawnPoints = EnemySpawnPoints.GetChildren().OfType<Marker3D>();
|
||||
foreach (var spawnPoint in enemySpawnPoints)
|
||||
{
|
||||
var instantiatedEnemy = EnemyTypeToEnemyConverter.Convert(EnemyType.Michael);
|
||||
AddChild(instantiatedEnemy);
|
||||
instantiatedEnemy.GlobalPosition = new Vector3(spawnPoint.GlobalPosition.X, 2.4f, spawnPoint.GlobalPosition.Z);
|
||||
ResetPhysicsInterpolation();
|
||||
var enemyWithFollowBehavior = (IHaveFollowBehavior)instantiatedEnemy;
|
||||
enemyWithFollowBehavior.FollowBehavior.StartFollow(enemyWithFollowBehavior.NavigationAgent);
|
||||
}
|
||||
var enemySpawnPoints = EnemySpawnPoints.GetChildren().OfType<Marker3D>();
|
||||
foreach (var spawnPoint in enemySpawnPoints)
|
||||
{
|
||||
var instantiatedEnemy = EnemyTypeToEnemyConverter.Convert(EnemyType.Michael);
|
||||
AddChild(instantiatedEnemy);
|
||||
instantiatedEnemy.GlobalPosition = new Vector3(spawnPoint.GlobalPosition.X, 2.4f, spawnPoint.GlobalPosition.Z);
|
||||
ResetPhysicsInterpolation();
|
||||
var enemyWithFollowBehavior = (IHaveFollowBehavior)instantiatedEnemy;
|
||||
enemyWithFollowBehavior.FollowBehavior.StartFollow(enemyWithFollowBehavior.NavigationAgent);
|
||||
}
|
||||
}
|
||||
|
||||
public override (Vector3 Rotation, Vector3 Position) GetPlayerSpawnPoint() { return (PlayerSpawnPoint.Rotation, new Vector3(PlayerSpawnPoint.GlobalPosition.X, 2.4f, PlayerSpawnPoint.GlobalPosition.Z)); }
|
||||
|
||||
@@ -49,4 +49,6 @@ public partial class DummyPlayer : CharacterBody3D, IPlayer
|
||||
public IBaseInventoryItem IdentifyItem(IBaseInventoryItem unidentifiedItem) => throw new NotImplementedException();
|
||||
public void EnactBriefImmunity() => throw new NotImplementedException();
|
||||
public void SetSigil(ISigil sigil) => throw new NotImplementedException();
|
||||
public void ShakePlayerCamera(float shakeIntensity, float shakeAmount) => throw new NotImplementedException();
|
||||
public void ShowCamera(bool showCamera) => throw new NotImplementedException();
|
||||
}
|
||||
|
||||
@@ -205,8 +205,6 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
||||
LuckComponent.Reset();
|
||||
EquipmentComponent.Reset();
|
||||
SigilComponent.Reset();
|
||||
|
||||
HealthTimer.Timeout += OnHealthTimerTimeout;
|
||||
}
|
||||
|
||||
#region Initialization
|
||||
@@ -220,6 +218,7 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
||||
ExperiencePointsComponent.PlayerLevelDown += OnLevelDown;
|
||||
PlayerFXAnimations.AnimationFinished += PlayerFXAnimations_AnimationFinished;
|
||||
HealthTimer.WaitTime = _healthTimerWaitTime;
|
||||
HealthTimer.Timeout += OnHealthTimerTimeout;
|
||||
|
||||
_projectileCooldownTimer = new Timer();
|
||||
AddChild(_projectileCooldownTimer);
|
||||
@@ -248,6 +247,7 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
||||
SetProcessInput(true);
|
||||
SetPhysicsProcess(true);
|
||||
SetHealthTimerStatus(HealthTimerIsActive);
|
||||
ShowCamera(true);
|
||||
Hitbox.SetDeferred(Area3D.PropertyName.Monitoring, true);
|
||||
Hitbox.SetDeferred(Area3D.PropertyName.Monitorable, true);
|
||||
}
|
||||
@@ -290,12 +290,14 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
||||
ResetPhysicsInterpolation();
|
||||
}
|
||||
|
||||
public void ShowCamera(bool showCamera) => _camera3D.Current = showCamera;
|
||||
|
||||
public void TakeDamage(AttackData damage)
|
||||
{
|
||||
if (BriefImmunity)
|
||||
return;
|
||||
|
||||
_camera3D.AddShake(1.0f);
|
||||
ShakePlayerCamera(1, 1);
|
||||
TakeDamageAnimationPlayer.Play("take_damage");
|
||||
var defense = TotalDefense;
|
||||
var elementalResistance = EquipmentComponent.ElementalResistance + SigilComponent.Sigil.ElementalResistanceSet;
|
||||
@@ -329,6 +331,12 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
||||
|
||||
public IBaseInventoryItem IdentifyItem(IBaseInventoryItem unidentifiedItem) => _itemReroller.RerollItem(unidentifiedItem, Inventory);
|
||||
|
||||
public void ShakePlayerCamera(float shakeIntensity, float shakeAmount)
|
||||
{
|
||||
_camera3D._shakeIntensity = shakeIntensity;
|
||||
_camera3D.AddShake(shakeAmount);
|
||||
}
|
||||
|
||||
public int TotalAttack => AttackComponent.CurrentAttack.Value + EquipmentComponent.BonusAttack;
|
||||
|
||||
public int TotalDefense => DefenseComponent.CurrentDefense.Value + EquipmentComponent.BonusDefense;
|
||||
@@ -348,11 +356,7 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
||||
return;
|
||||
|
||||
SetSigil(new NoneSigil());
|
||||
|
||||
HealthTimer.WaitTime = _healthTimerWaitTime;
|
||||
HealthTimer.Timeout -= OnHealthTimerTimeout;
|
||||
SetProcessInput(false);
|
||||
SetPhysicsProcess(false);
|
||||
Deactivate();
|
||||
}
|
||||
|
||||
public override void _Input(InputEvent @event)
|
||||
@@ -920,7 +924,7 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
||||
if (SigilComponent.Sigil.ElementType == weapon.WeaponElement)
|
||||
totalDamage = Mathf.RoundToInt(totalDamage * 1.15f);
|
||||
|
||||
totalDamage = Mathf.RoundToInt(totalDamage * (1 + SigilComponent.Sigil.DamageModifier));
|
||||
totalDamage = Mathf.RoundToInt(totalDamage * (1 + SigilComponent.Sigil.DamageModifier));
|
||||
|
||||
if (isCriticalHit)
|
||||
{
|
||||
|
||||
@@ -13031,6 +13031,7 @@ collision_mask = 775
|
||||
script = ExtResource("1_xcol5")
|
||||
RotationSpeed = 1.6
|
||||
HealthTimerIsActive = true
|
||||
_immunityTime = 99999.0
|
||||
|
||||
[node name="MainCollision" type="CollisionShape3D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
|
||||
@@ -13,6 +13,7 @@ public interface IGameOverMenu : IControl
|
||||
|
||||
public event Action NewGame;
|
||||
public event Action QuitGame;
|
||||
public event Action GameOverMenuVisible;
|
||||
}
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
@@ -22,6 +23,7 @@ public partial class GameOverMenu : Control, IGameOverMenu
|
||||
|
||||
public event Action NewGame;
|
||||
public event Action QuitGame;
|
||||
public event Action GameOverMenuVisible;
|
||||
|
||||
[Dependency] Game Game => this.DependOn<Game>();
|
||||
|
||||
@@ -36,6 +38,13 @@ public partial class GameOverMenu : Control, IGameOverMenu
|
||||
Continue.Pressed += Continue_Pressed;
|
||||
Exit.Pressed += Exit_Pressed;
|
||||
VisibilityChanged += DeathMenu_VisibilityChanged;
|
||||
AnimationPlayer.AnimationFinished += AnimationPlayer_AnimationFinished;
|
||||
}
|
||||
|
||||
private void AnimationPlayer_AnimationFinished(StringName animName)
|
||||
{
|
||||
if (animName == "fade_in")
|
||||
GameOverMenuVisible?.Invoke();
|
||||
}
|
||||
|
||||
private void DeathMenu_VisibilityChanged()
|
||||
|
||||
Reference in New Issue
Block a user