Compare commits
4 Commits
b62478bbea
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 427bef6509 | |||
| 3616f4ba79 | |||
| 2bf903728b | |||
| bfe951939d |
@@ -1,23 +1,22 @@
|
|||||||
using Godot;
|
using Godot;
|
||||||
using Godot.Collections;
|
|
||||||
using Mr.BrickAdventures.scripts.Resources;
|
using Mr.BrickAdventures.scripts.Resources;
|
||||||
|
using Mr.BrickAdventures.scripts.State;
|
||||||
|
|
||||||
namespace Mr.BrickAdventures.Autoloads;
|
namespace Mr.BrickAdventures.Autoloads;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Manages achievements using GameStateStore.
|
||||||
|
/// </summary>
|
||||||
public partial class AchievementManager : Node
|
public partial class AchievementManager : Node
|
||||||
{
|
{
|
||||||
[Export] private string AchievementsFolderPath = "res://achievements/";
|
[Export] private string AchievementsFolderPath = "res://achievements/";
|
||||||
[Export] private PackedScene AchievementPopupScene { get; set; }
|
[Export] private PackedScene AchievementPopupScene { get; set; }
|
||||||
|
|
||||||
private System.Collections.Generic.Dictionary<string, AchievementResource> _achievements = new();
|
private System.Collections.Generic.Dictionary<string, AchievementResource> _achievements = new();
|
||||||
private Array<string> _unlockedAchievementIds = [];
|
|
||||||
private GameManager _gameManager;
|
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
_gameManager = GetNode<GameManager>("/root/GameManager");
|
|
||||||
LoadAchievementsFromFolder();
|
LoadAchievementsFromFolder();
|
||||||
LoadUnlockedAchievements();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadAchievementsFromFolder()
|
private void LoadAchievementsFromFolder()
|
||||||
@@ -44,7 +43,15 @@ public partial class AchievementManager : Node
|
|||||||
fileName = dir.GetNext();
|
fileName = dir.GetNext();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the list of unlocked achievement IDs from the store.
|
||||||
|
/// </summary>
|
||||||
|
private System.Collections.Generic.List<string> GetUnlockedIds()
|
||||||
|
{
|
||||||
|
return GameStateStore.Instance?.Player.UnlockedAchievements ?? new System.Collections.Generic.List<string>();
|
||||||
|
}
|
||||||
|
|
||||||
public void UnlockAchievement(string achievementId)
|
public void UnlockAchievement(string achievementId)
|
||||||
{
|
{
|
||||||
if (!_achievements.TryGetValue(achievementId, out var achievement))
|
if (!_achievements.TryGetValue(achievementId, out var achievement))
|
||||||
@@ -53,13 +60,14 @@ public partial class AchievementManager : Node
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_unlockedAchievementIds.Contains(achievementId))
|
var unlockedIds = GetUnlockedIds();
|
||||||
|
if (unlockedIds.Contains(achievementId))
|
||||||
{
|
{
|
||||||
return; // Already unlocked
|
return; // Already unlocked
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1. Mark as unlocked internally
|
// 1. Mark as unlocked
|
||||||
_unlockedAchievementIds.Add(achievementId);
|
unlockedIds.Add(achievementId);
|
||||||
GD.Print($"Achievement Unlocked: {achievement.DisplayName}");
|
GD.Print($"Achievement Unlocked: {achievement.DisplayName}");
|
||||||
|
|
||||||
// 2. Show the UI popup
|
// 2. Show the UI popup
|
||||||
@@ -75,31 +83,19 @@ public partial class AchievementManager : Node
|
|||||||
{
|
{
|
||||||
SteamManager.UnlockAchievement(achievement.Id);
|
SteamManager.UnlockAchievement(achievement.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. Save progress
|
|
||||||
SaveUnlockedAchievements();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LockAchievement(string achievementId)
|
|
||||||
{
|
|
||||||
if (_unlockedAchievementIds.Contains(achievementId))
|
|
||||||
{
|
|
||||||
_unlockedAchievementIds.Remove(achievementId);
|
|
||||||
SaveUnlockedAchievements();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SaveUnlockedAchievements()
|
|
||||||
{
|
|
||||||
_gameManager.PlayerState["unlocked_achievements"] = _unlockedAchievementIds;
|
|
||||||
// You might want to trigger a save game here, depending on your SaveSystem
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadUnlockedAchievements()
|
public void LockAchievement(string achievementId)
|
||||||
{
|
{
|
||||||
if (_gameManager.PlayerState.TryGetValue("unlocked_achievements", out var unlocked))
|
var unlockedIds = GetUnlockedIds();
|
||||||
|
if (unlockedIds.Contains(achievementId))
|
||||||
{
|
{
|
||||||
_unlockedAchievementIds = (Array<string>)unlocked;
|
unlockedIds.Remove(achievementId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsAchievementUnlocked(string achievementId)
|
||||||
|
{
|
||||||
|
return GetUnlockedIds().Contains(achievementId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using Godot;
|
using Godot;
|
||||||
|
using Mr.BrickAdventures;
|
||||||
using Mr.BrickAdventures.scripts.components;
|
using Mr.BrickAdventures.scripts.components;
|
||||||
|
|
||||||
namespace Mr.BrickAdventures.Autoloads;
|
namespace Mr.BrickAdventures.Autoloads;
|
||||||
@@ -12,9 +13,9 @@ public partial class ConsoleManager : Node
|
|||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
_gameManager = GetNode<GameManager>("/root/GameManager");
|
_gameManager = GameManager.Instance;
|
||||||
_achievementManager = GetNode<AchievementManager>("/root/AchievementManager");
|
_achievementManager = GetNode<AchievementManager>(Constants.AchievementManagerPath);
|
||||||
_skillManager = GetNode<SkillManager>("/root/SkillManager");
|
_skillManager = SkillManager.Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddCoinsCommand(int amount)
|
private void AddCoinsCommand(int amount)
|
||||||
@@ -88,7 +89,7 @@ public partial class ConsoleManager : Node
|
|||||||
|
|
||||||
_skillUnlockerComponent.UnlockAllSkills();
|
_skillUnlockerComponent.UnlockAllSkills();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RemoveSkillCommand(string skillName)
|
private void RemoveSkillCommand(string skillName)
|
||||||
{
|
{
|
||||||
if (!GetSkillManagement()) return;
|
if (!GetSkillManagement()) return;
|
||||||
@@ -102,28 +103,28 @@ public partial class ConsoleManager : Node
|
|||||||
_gameManager.RemoveSkill(skill.Name);
|
_gameManager.RemoveSkill(skill.Name);
|
||||||
_skillManager.DeactivateSkill(skill);
|
_skillManager.DeactivateSkill(skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RemoveAllSkillsCommand()
|
private void RemoveAllSkillsCommand()
|
||||||
{
|
{
|
||||||
if (!GetSkillManagement()) return;
|
if (!GetSkillManagement()) return;
|
||||||
|
|
||||||
foreach (var skill in _skillManager.AvailableSkills)
|
foreach (var skill in _skillManager.AvailableSkills)
|
||||||
{
|
{
|
||||||
_gameManager.RemoveSkill(skill.Name);
|
_gameManager.RemoveSkill(skill.Name);
|
||||||
_skillManager.DeactivateSkill(skill);
|
_skillManager.DeactivateSkill(skill);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GoToNextLevelCommand()
|
private void GoToNextLevelCommand()
|
||||||
{
|
{
|
||||||
_gameManager.OnLevelComplete();
|
_gameManager.OnLevelComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UnlockAchievementCommand(string achievementId)
|
private void UnlockAchievementCommand(string achievementId)
|
||||||
{
|
{
|
||||||
_achievementManager.UnlockAchievement(achievementId);
|
_achievementManager.UnlockAchievement(achievementId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ResetAchievementCommand(string achievementId)
|
private void ResetAchievementCommand(string achievementId)
|
||||||
{
|
{
|
||||||
_achievementManager.LockAchievement(achievementId);
|
_achievementManager.LockAchievement(achievementId);
|
||||||
|
|||||||
@@ -1,9 +1,155 @@
|
|||||||
using Godot;
|
using Godot;
|
||||||
|
using Mr.BrickAdventures.scripts.components;
|
||||||
|
using Mr.BrickAdventures.scripts.Resources;
|
||||||
|
|
||||||
namespace Mr.BrickAdventures.Autoloads;
|
namespace Mr.BrickAdventures.Autoloads;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Global event bus for decoupled communication between game systems.
|
||||||
|
/// Use the static Instance property for easy access from anywhere.
|
||||||
|
/// </summary>
|
||||||
public partial class EventBus : Node
|
public partial class EventBus : Node
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Singleton instance. Available after the autoload is initialized.
|
||||||
|
/// </summary>
|
||||||
|
public static EventBus Instance { get; private set; }
|
||||||
|
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
Instance = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void _ExitTree()
|
||||||
|
{
|
||||||
|
if (Instance == this)
|
||||||
|
Instance = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Level Events
|
||||||
|
|
||||||
[Signal] public delegate void LevelStartedEventHandler(int levelIndex, Node currentScene);
|
[Signal] public delegate void LevelStartedEventHandler(int levelIndex, Node currentScene);
|
||||||
[Signal] public delegate void LevelCompletedEventHandler(int levelIndex, Node currentScene, double completionTime);
|
[Signal] public delegate void LevelCompletedEventHandler(int levelIndex, Node currentScene, double completionTime);
|
||||||
|
[Signal] public delegate void LevelRestartedEventHandler(int levelIndex);
|
||||||
|
|
||||||
|
public static void EmitLevelStarted(int levelIndex, Node currentScene)
|
||||||
|
=> Instance?.EmitSignal(SignalName.LevelStarted, levelIndex, currentScene);
|
||||||
|
|
||||||
|
public static void EmitLevelCompleted(int levelIndex, Node currentScene, double completionTime)
|
||||||
|
=> Instance?.EmitSignal(SignalName.LevelCompleted, levelIndex, currentScene, completionTime);
|
||||||
|
|
||||||
|
public static void EmitLevelRestarted(int levelIndex)
|
||||||
|
=> Instance?.EmitSignal(SignalName.LevelRestarted, levelIndex);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Player Events
|
||||||
|
|
||||||
|
[Signal] public delegate void PlayerSpawnedEventHandler(PlayerController player);
|
||||||
|
[Signal] public delegate void PlayerDiedEventHandler(Vector2 position);
|
||||||
|
[Signal] public delegate void PlayerDamagedEventHandler(float damage, float remainingHealth, Vector2 position);
|
||||||
|
[Signal] public delegate void PlayerHealedEventHandler(float amount, float newHealth, Vector2 position);
|
||||||
|
|
||||||
|
public static void EmitPlayerSpawned(PlayerController player)
|
||||||
|
=> Instance?.EmitSignal(SignalName.PlayerSpawned, player);
|
||||||
|
|
||||||
|
public static void EmitPlayerDied(Vector2 position)
|
||||||
|
=> Instance?.EmitSignal(SignalName.PlayerDied, position);
|
||||||
|
|
||||||
|
public static void EmitPlayerDamaged(float damage, float remainingHealth, Vector2 position)
|
||||||
|
=> Instance?.EmitSignal(SignalName.PlayerDamaged, damage, remainingHealth, position);
|
||||||
|
|
||||||
|
public static void EmitPlayerHealed(float amount, float newHealth, Vector2 position)
|
||||||
|
=> Instance?.EmitSignal(SignalName.PlayerHealed, amount, newHealth, position);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Combat Events
|
||||||
|
|
||||||
|
[Signal] public delegate void EnemyDefeatedEventHandler(Node enemy, Vector2 position);
|
||||||
|
[Signal] public delegate void EnemyDamagedEventHandler(Node enemy, float damage, Vector2 position);
|
||||||
|
|
||||||
|
public static void EmitEnemyDefeated(Node enemy, Vector2 position)
|
||||||
|
=> Instance?.EmitSignal(SignalName.EnemyDefeated, enemy, position);
|
||||||
|
|
||||||
|
public static void EmitEnemyDamaged(Node enemy, float damage, Vector2 position)
|
||||||
|
=> Instance?.EmitSignal(SignalName.EnemyDamaged, enemy, damage, position);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Collection Events
|
||||||
|
|
||||||
|
[Signal] public delegate void CoinCollectedEventHandler(int amount, Vector2 position);
|
||||||
|
[Signal] public delegate void ItemCollectedEventHandler(CollectableType itemType, float amount, Vector2 position);
|
||||||
|
[Signal] public delegate void ChildRescuedEventHandler(Vector2 position);
|
||||||
|
[Signal] public delegate void SkillCollectedEventHandler(SkillData skill, Vector2 position);
|
||||||
|
|
||||||
|
public static void EmitCoinCollected(int amount, Vector2 position)
|
||||||
|
=> Instance?.EmitSignal(SignalName.CoinCollected, amount, position);
|
||||||
|
|
||||||
|
public static void EmitItemCollected(CollectableType itemType, float amount, Vector2 position)
|
||||||
|
=> Instance?.EmitSignal(SignalName.ItemCollected, (int)itemType, amount, position);
|
||||||
|
|
||||||
|
public static void EmitChildRescued(Vector2 position)
|
||||||
|
=> Instance?.EmitSignal(SignalName.ChildRescued, position);
|
||||||
|
|
||||||
|
public static void EmitSkillCollected(SkillData skill, Vector2 position)
|
||||||
|
=> Instance?.EmitSignal(SignalName.SkillCollected, skill, position);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Skill Events
|
||||||
|
|
||||||
|
[Signal] public delegate void SkillUnlockedEventHandler(string skillName, int level);
|
||||||
|
[Signal] public delegate void SkillActivatedEventHandler(string skillName);
|
||||||
|
[Signal] public delegate void SkillDeactivatedEventHandler(string skillName);
|
||||||
|
|
||||||
|
public static void EmitSkillUnlocked(string skillName, int level = 1)
|
||||||
|
=> Instance?.EmitSignal(SignalName.SkillUnlocked, skillName, level);
|
||||||
|
|
||||||
|
public static void EmitSkillActivated(string skillName)
|
||||||
|
=> Instance?.EmitSignal(SignalName.SkillActivated, skillName);
|
||||||
|
|
||||||
|
public static void EmitSkillDeactivated(string skillName)
|
||||||
|
=> Instance?.EmitSignal(SignalName.SkillDeactivated, skillName);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Game State Events
|
||||||
|
|
||||||
|
[Signal] public delegate void GamePausedEventHandler();
|
||||||
|
[Signal] public delegate void GameResumedEventHandler();
|
||||||
|
[Signal] public delegate void GameSavedEventHandler();
|
||||||
|
[Signal] public delegate void GameStartedEventHandler();
|
||||||
|
[Signal] public delegate void GameContinuedEventHandler();
|
||||||
|
|
||||||
|
public static void EmitGamePaused()
|
||||||
|
=> Instance?.EmitSignal(SignalName.GamePaused);
|
||||||
|
|
||||||
|
public static void EmitGameResumed()
|
||||||
|
=> Instance?.EmitSignal(SignalName.GameResumed);
|
||||||
|
|
||||||
|
public static void EmitGameSaved()
|
||||||
|
=> Instance?.EmitSignal(SignalName.GameSaved);
|
||||||
|
|
||||||
|
public static void EmitGameStarted()
|
||||||
|
=> Instance?.EmitSignal(SignalName.GameStarted);
|
||||||
|
|
||||||
|
public static void EmitGameContinued()
|
||||||
|
=> Instance?.EmitSignal(SignalName.GameContinued);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region State Change Events
|
||||||
|
|
||||||
|
[Signal] public delegate void CoinsChangedEventHandler(int totalCoins);
|
||||||
|
[Signal] public delegate void LivesChangedEventHandler(int lives);
|
||||||
|
|
||||||
|
public static void EmitCoinsChanged(int totalCoins)
|
||||||
|
=> Instance?.EmitSignal(SignalName.CoinsChanged, totalCoins);
|
||||||
|
|
||||||
|
public static void EmitLivesChanged(int lives)
|
||||||
|
=> Instance?.EmitSignal(SignalName.LivesChanged, lives);
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
using Mr.BrickAdventures.scripts.Resources;
|
||||||
using Mr.BrickAdventures.scripts.UI;
|
using Mr.BrickAdventures.scripts.UI;
|
||||||
|
|
||||||
namespace Mr.BrickAdventures.Autoloads;
|
namespace Mr.BrickAdventures.Autoloads;
|
||||||
@@ -7,22 +9,34 @@ namespace Mr.BrickAdventures.Autoloads;
|
|||||||
public partial class FloatingTextManager : Node
|
public partial class FloatingTextManager : Node
|
||||||
{
|
{
|
||||||
[Export] public PackedScene FloatingTextScene { get; set; }
|
[Export] public PackedScene FloatingTextScene { get; set; }
|
||||||
|
|
||||||
[ExportGroup("Colors")]
|
[ExportGroup("Colors")]
|
||||||
[Export] public Color DamageColor { get; set; } = new Color("#b21030"); // Red
|
[Export] public Color DamageColor { get; set; } = new Color("#b21030"); // Red
|
||||||
[Export] public Color HealColor { get; set; } = new Color("#71f341"); // Green
|
[Export] public Color HealColor { get; set; } = new Color("#71f341"); // Green
|
||||||
[Export] public Color CoinColor { get; set; } = new Color("#ebd320"); // Gold
|
[Export] public Color CoinColor { get; set; } = new Color("#ebd320"); // Gold
|
||||||
[Export] public Color MessageColor { get; set; } = new Color("#ffffff"); // White
|
[Export] public Color MessageColor { get; set; } = new Color("#ffffff"); // White
|
||||||
|
|
||||||
|
public static FloatingTextManager Instance { get; private set; }
|
||||||
|
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
Instance = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void _ExitTree()
|
||||||
|
{
|
||||||
|
if (Instance == this) Instance = null;
|
||||||
|
}
|
||||||
|
|
||||||
public void ShowDamage(float amount, Vector2 position)
|
public void ShowDamage(float amount, Vector2 position)
|
||||||
{
|
{
|
||||||
var text = Mathf.Round(amount * 100f).ToString(CultureInfo.InvariantCulture);
|
var text = Mathf.Round(amount * 100f).ToString(CultureInfo.InvariantCulture);
|
||||||
CreateFloatingText(text, position, DamageColor);
|
CreateFloatingText(text, position, DamageColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ShowHeal(float amount, Vector2 position)
|
public void ShowHeal(float amount, Vector2 position)
|
||||||
{
|
{
|
||||||
var text = $"+{Mathf.Round(amount)}";
|
var text = $"+{Mathf.Round(amount * 100f).ToString(CultureInfo.InvariantCulture)}";
|
||||||
CreateFloatingText(text, position, HealColor);
|
CreateFloatingText(text, position, HealColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,12 +45,12 @@ public partial class FloatingTextManager : Node
|
|||||||
var text = $"+{amount}";
|
var text = $"+{amount}";
|
||||||
CreateFloatingText(text, position, CoinColor);
|
CreateFloatingText(text, position, CoinColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ShowMessage(string message, Vector2 position)
|
public void ShowMessage(string message, Vector2 position)
|
||||||
{
|
{
|
||||||
CreateFloatingText(message, position, MessageColor);
|
CreateFloatingText(message, position, MessageColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CreateFloatingText(string text, Vector2 position, Color color)
|
private void CreateFloatingText(string text, Vector2 position, Color color)
|
||||||
{
|
{
|
||||||
if (FloatingTextScene == null)
|
if (FloatingTextScene == null)
|
||||||
|
|||||||
@@ -3,41 +3,34 @@ using Godot;
|
|||||||
using Godot.Collections;
|
using Godot.Collections;
|
||||||
using Mr.BrickAdventures.scripts.components;
|
using Mr.BrickAdventures.scripts.components;
|
||||||
using Mr.BrickAdventures.scripts.Resources;
|
using Mr.BrickAdventures.scripts.Resources;
|
||||||
using Double = System.Double;
|
using Mr.BrickAdventures.scripts.State;
|
||||||
|
|
||||||
namespace Mr.BrickAdventures.Autoloads;
|
namespace Mr.BrickAdventures.Autoloads;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Game orchestrator - handles scene management and game flow.
|
||||||
|
/// State is delegated to GameStateStore for better separation of concerns.
|
||||||
|
/// </summary>
|
||||||
public partial class GameManager : Node
|
public partial class GameManager : Node
|
||||||
{
|
{
|
||||||
[Export] public Array<PackedScene> LevelScenes { get; set; } = [];
|
[Export] public Array<PackedScene> LevelScenes { get; set; } = [];
|
||||||
|
|
||||||
public PlayerController Player {
|
public PlayerController Player
|
||||||
|
{
|
||||||
get => GetPlayer();
|
get => GetPlayer();
|
||||||
private set => _player = value;
|
private set => _player = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Node> _sceneNodes = [];
|
private List<Node> _sceneNodes = [];
|
||||||
private PlayerController _player;
|
private PlayerController _player;
|
||||||
private SpeedRunManager _speedRunManager;
|
private SpeedRunManager _speedRunManager;
|
||||||
private EventBus _eventBus;
|
|
||||||
|
/// <summary>
|
||||||
[Export]
|
/// Lazy accessor for GameStateStore - avoids initialization order issues.
|
||||||
public Dictionary PlayerState { get; set; } = new()
|
/// </summary>
|
||||||
{
|
private GameStateStore Store => GameStateStore.Instance;
|
||||||
{ "coins", 0 },
|
|
||||||
{ "lives", 3 },
|
public static GameManager Instance { get; private set; }
|
||||||
{ "current_level", 0 },
|
|
||||||
{ "completed_levels", new Array<int>() },
|
|
||||||
{ "unlocked_levels", new Array<int>() {0}},
|
|
||||||
{ "unlocked_skills", new Array<SkillData>() }
|
|
||||||
};
|
|
||||||
|
|
||||||
[Export]
|
|
||||||
public Dictionary CurrentSessionState { get; private set; } = new()
|
|
||||||
{
|
|
||||||
{ "coins_collected", 0 },
|
|
||||||
{ "skills_unlocked", new Array<SkillData>() }
|
|
||||||
};
|
|
||||||
|
|
||||||
public override void _EnterTree()
|
public override void _EnterTree()
|
||||||
{
|
{
|
||||||
@@ -47,6 +40,7 @@ public partial class GameManager : Node
|
|||||||
|
|
||||||
public override void _ExitTree()
|
public override void _ExitTree()
|
||||||
{
|
{
|
||||||
|
if (Instance == this) Instance = null;
|
||||||
GetTree().NodeAdded -= OnNodeAdded;
|
GetTree().NodeAdded -= OnNodeAdded;
|
||||||
GetTree().NodeRemoved -= OnNodeRemoved;
|
GetTree().NodeRemoved -= OnNodeRemoved;
|
||||||
_sceneNodes.Clear();
|
_sceneNodes.Clear();
|
||||||
@@ -54,15 +48,15 @@ public partial class GameManager : Node
|
|||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
_speedRunManager = GetNode<SpeedRunManager>("/root/SpeedRunManager");
|
Instance = this;
|
||||||
_eventBus = GetNode<EventBus>("/root/EventBus");
|
_speedRunManager = GetNode<SpeedRunManager>(Constants.SpeedRunManagerPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnNodeAdded(Node node)
|
private void OnNodeAdded(Node node)
|
||||||
{
|
{
|
||||||
_sceneNodes.Add(node);
|
_sceneNodes.Add(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnNodeRemoved(Node node)
|
private void OnNodeRemoved(Node node)
|
||||||
{
|
{
|
||||||
_sceneNodes.Remove(node);
|
_sceneNodes.Remove(node);
|
||||||
@@ -72,57 +66,71 @@ public partial class GameManager : Node
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Coin Operations
|
||||||
|
|
||||||
public void AddCoins(int amount)
|
public void AddCoins(int amount)
|
||||||
{
|
{
|
||||||
PlayerState["coins"] = Mathf.Max(0, (int)PlayerState["coins"] + amount);
|
if (Store != null)
|
||||||
}
|
|
||||||
|
|
||||||
public void SetCoins(int amount) => PlayerState["coins"] = Mathf.Max(0, amount);
|
|
||||||
|
|
||||||
public int GetCoins() => (int)PlayerState["coins"] + (int)CurrentSessionState["coins_collected"];
|
|
||||||
|
|
||||||
public void RemoveCoins(int amount)
|
|
||||||
{
|
|
||||||
var sessionCoins = (int)CurrentSessionState["coins_collected"];
|
|
||||||
if (amount <= sessionCoins)
|
|
||||||
{
|
{
|
||||||
CurrentSessionState["coins_collected"] = sessionCoins - amount;
|
Store.Player.Coins += amount;
|
||||||
|
EventBus.EmitCoinsChanged(Store.GetTotalCoins());
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
var remaining = amount - sessionCoins;
|
|
||||||
CurrentSessionState["coins_collected"] = 0;
|
|
||||||
PlayerState["coins"] = Mathf.Max(0, (int)PlayerState["coins"] - remaining);
|
|
||||||
}
|
|
||||||
PlayerState["coins"] = Mathf.Max(0, (int)PlayerState["coins"]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddLives(int amount) => PlayerState["lives"] = (int)PlayerState["lives"] + amount;
|
public void SetCoins(int amount)
|
||||||
public void RemoveLives(int amount) => PlayerState["lives"] = (int)PlayerState["lives"] - amount;
|
|
||||||
public void SetLives(int amount) => PlayerState["lives"] = amount;
|
|
||||||
public int GetLives() => (int)PlayerState["lives"];
|
|
||||||
|
|
||||||
public bool IsSkillUnlocked(SkillData skill)
|
|
||||||
{
|
{
|
||||||
return ((Array)PlayerState["unlocked_skills"]).Contains(skill)
|
if (Store != null)
|
||||||
|| ((Array)CurrentSessionState["skills_unlocked"]).Contains(skill);
|
{
|
||||||
|
Store.Player.Coins = Mathf.Max(0, amount);
|
||||||
|
EventBus.EmitCoinsChanged(Store.GetTotalCoins());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int GetCoins() => Store?.GetTotalCoins() ?? 0;
|
||||||
|
|
||||||
|
public void RemoveCoins(int amount) => Store?.RemoveCoins(amount);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Lives Operations
|
||||||
|
|
||||||
|
public void AddLives(int amount) => Store?.AddLives(amount);
|
||||||
|
public void RemoveLives(int amount) => Store?.RemoveLife();
|
||||||
|
public void SetLives(int amount)
|
||||||
|
{
|
||||||
|
if (Store != null)
|
||||||
|
{
|
||||||
|
Store.Player.Lives = amount;
|
||||||
|
EventBus.EmitLivesChanged(amount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public int GetLives() => Store?.Player.Lives ?? 0;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Skill Operations
|
||||||
|
|
||||||
|
public bool IsSkillUnlocked(SkillData skill) => Store?.IsSkillUnlocked(skill) ?? false;
|
||||||
|
|
||||||
public void UnlockSkill(SkillData skill)
|
public void UnlockSkill(SkillData skill)
|
||||||
{
|
{
|
||||||
if (!IsSkillUnlocked(skill))
|
if (Store != null && !Store.IsSkillUnlocked(skill))
|
||||||
((Array)PlayerState["unlocked_skills"]).Add(skill);
|
{
|
||||||
|
Store.Player.UnlockedSkills.Add(skill);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveSkill(string skillName)
|
public void RemoveSkill(string skillName)
|
||||||
{
|
{
|
||||||
var arr = (Array)PlayerState["unlocked_skills"];
|
if (Store == null) return;
|
||||||
foreach (SkillData s in arr)
|
var skills = Store.Player.UnlockedSkills;
|
||||||
|
for (int i = 0; i < skills.Count; i++)
|
||||||
{
|
{
|
||||||
if (s.Name != skillName) continue;
|
if (skills[i].Name == skillName)
|
||||||
|
{
|
||||||
arr.Remove(s);
|
skills.RemoveAt(i);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,81 +140,82 @@ public partial class GameManager : Node
|
|||||||
UnlockSkill(s);
|
UnlockSkill(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResetPlayerState()
|
public Array<SkillData> GetUnlockedSkills()
|
||||||
{
|
{
|
||||||
PlayerState = new Dictionary
|
if (Store == null) return new Array<SkillData>();
|
||||||
{
|
|
||||||
{ "coins", 0 },
|
var skills = Store.GetAllUnlockedSkills();
|
||||||
{ "lives", 3 },
|
var result = new Array<SkillData>();
|
||||||
{ "current_level", 0 },
|
foreach (var s in skills) result.Add(s);
|
||||||
{ "completed_levels", new Array<int>() },
|
return result;
|
||||||
{ "unlocked_levels", new Array<int>() {0}},
|
|
||||||
{ "unlocked_skills", new Array<SkillData>() },
|
|
||||||
{ "statistics", new Godot.Collections.Dictionary<string, Variant>()}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UnlockLevel(int levelIndex)
|
|
||||||
{
|
|
||||||
var unlocked = (Array)PlayerState["unlocked_levels"];
|
|
||||||
if (!unlocked.Contains(levelIndex)) unlocked.Add(levelIndex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Level Operations
|
||||||
|
|
||||||
|
public void UnlockLevel(int levelIndex) => Store?.UnlockLevel(levelIndex);
|
||||||
|
|
||||||
|
public void MarkLevelComplete(int levelIndex) => Store?.MarkLevelComplete(levelIndex);
|
||||||
|
|
||||||
public void TryToGoToNextLevel()
|
public void TryToGoToNextLevel()
|
||||||
{
|
{
|
||||||
var next = (int)PlayerState["current_level"] + 1;
|
if (Store == null) return;
|
||||||
var unlocked = (Array)PlayerState["unlocked_levels"];
|
|
||||||
if (next < LevelScenes.Count && unlocked.Contains(next))
|
var next = Store.Session.CurrentLevel + 1;
|
||||||
|
if (next < LevelScenes.Count && Store.IsLevelUnlocked(next))
|
||||||
{
|
{
|
||||||
PlayerState["current_level"] = next;
|
Store.Session.CurrentLevel = next;
|
||||||
GetTree().ChangeSceneToPacked(LevelScenes[next]);
|
GetTree().ChangeSceneToPacked(LevelScenes[next]);
|
||||||
_eventBus.EmitSignal(EventBus.SignalName.LevelStarted, next, GetTree().CurrentScene);
|
EventBus.EmitLevelStarted(next, GetTree().CurrentScene);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MarkLevelComplete(int levelIndex)
|
|
||||||
{
|
|
||||||
UnlockLevel(levelIndex + 1);
|
|
||||||
var completed = (Array)PlayerState["completed_levels"];
|
|
||||||
if (!completed.Contains(levelIndex)) completed.Add(levelIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ResetCurrentSessionState()
|
#endregion
|
||||||
{
|
|
||||||
CurrentSessionState = new Dictionary
|
#region State Reset
|
||||||
{
|
|
||||||
{ "coins_collected", 0 },
|
public void ResetPlayerState() => Store?.ResetAll();
|
||||||
{ "skills_unlocked", new Array<SkillData>() }
|
|
||||||
};
|
public void ResetCurrentSessionState() => Store?.ResetSession();
|
||||||
}
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Game Flow
|
||||||
|
|
||||||
public void RestartGame()
|
public void RestartGame()
|
||||||
{
|
{
|
||||||
ResetPlayerState();
|
Store?.ResetAll();
|
||||||
ResetCurrentSessionState();
|
|
||||||
GetTree().ChangeSceneToPacked(LevelScenes[0]);
|
GetTree().ChangeSceneToPacked(LevelScenes[0]);
|
||||||
GetNode<SaveSystem>("/root/SaveSystem").SaveGame();
|
GetNode<SaveSystem>(Constants.SaveSystemPath).SaveGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void QuitGame() => GetTree().Quit();
|
public void QuitGame() => GetTree().Quit();
|
||||||
|
|
||||||
public void PauseGame() => Engine.TimeScale = 0;
|
public void PauseGame()
|
||||||
public void ResumeGame() => Engine.TimeScale = 1;
|
{
|
||||||
|
Engine.TimeScale = 0;
|
||||||
|
EventBus.EmitGamePaused();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ResumeGame()
|
||||||
|
{
|
||||||
|
Engine.TimeScale = 1;
|
||||||
|
EventBus.EmitGameResumed();
|
||||||
|
}
|
||||||
|
|
||||||
public void StartNewGame()
|
public void StartNewGame()
|
||||||
{
|
{
|
||||||
ResetPlayerState();
|
Store?.ResetAll();
|
||||||
ResetCurrentSessionState();
|
|
||||||
|
|
||||||
_speedRunManager?.StartTimer();
|
_speedRunManager?.StartTimer();
|
||||||
|
|
||||||
GetTree().ChangeSceneToPacked(LevelScenes[0]);
|
GetTree().ChangeSceneToPacked(LevelScenes[0]);
|
||||||
GetNode<SaveSystem>("/root/SaveSystem").SaveGame();
|
GetNode<SaveSystem>(Constants.SaveSystemPath).SaveGame();
|
||||||
|
EventBus.EmitGameStarted();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ContinueGame()
|
public void ContinueGame()
|
||||||
{
|
{
|
||||||
var save = GetNode<SaveSystem>("/root/SaveSystem");
|
var save = GetNode<SaveSystem>(Constants.SaveSystemPath);
|
||||||
if (!save.LoadGame())
|
if (!save.LoadGame())
|
||||||
{
|
{
|
||||||
GD.PrintErr("Failed to load game. Starting a new game instead.");
|
GD.PrintErr("Failed to load game. Starting a new game instead.");
|
||||||
@@ -214,57 +223,56 @@ public partial class GameManager : Node
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var idx = (int)PlayerState["current_level"];
|
var idx = Store?.Session.CurrentLevel ?? 0;
|
||||||
if (idx < LevelScenes.Count)
|
if (idx < LevelScenes.Count)
|
||||||
|
{
|
||||||
GetTree().ChangeSceneToPacked(LevelScenes[idx]);
|
GetTree().ChangeSceneToPacked(LevelScenes[idx]);
|
||||||
|
EventBus.EmitGameContinued();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
GD.PrintErr("No levels unlocked to continue.");
|
GD.PrintErr("No levels unlocked to continue.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnLevelComplete()
|
public void OnLevelComplete()
|
||||||
{
|
{
|
||||||
var levelIndex = (int)PlayerState["current_level"];
|
if (Store == null) return;
|
||||||
MarkLevelComplete(levelIndex);
|
|
||||||
|
var levelIndex = Store.Session.CurrentLevel;
|
||||||
AddCoins((int)CurrentSessionState["coins_collected"]);
|
Store.MarkLevelComplete(levelIndex);
|
||||||
foreach (var s in (Array)CurrentSessionState["skills_unlocked"])
|
Store.CommitSessionCoins();
|
||||||
UnlockSkill((SkillData)s);
|
Store.CommitSessionSkills();
|
||||||
|
|
||||||
var completionTime = _speedRunManager?.GetCurrentLevelTime() ?? 0.0;
|
var completionTime = _speedRunManager?.GetCurrentLevelTime() ?? 0.0;
|
||||||
_eventBus.EmitSignal(EventBus.SignalName.LevelCompleted, levelIndex, GetTree().CurrentScene, completionTime);
|
EventBus.EmitLevelCompleted(levelIndex, GetTree().CurrentScene, completionTime);
|
||||||
|
|
||||||
ResetCurrentSessionState();
|
Store.ResetSession();
|
||||||
TryToGoToNextLevel();
|
TryToGoToNextLevel();
|
||||||
GetNode<SaveSystem>("/root/SaveSystem").SaveGame();
|
GetNode<SaveSystem>(Constants.SaveSystemPath).SaveGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Array<SkillData> GetUnlockedSkills()
|
#endregion
|
||||||
{
|
|
||||||
var unlocked = (Array<SkillData>)PlayerState["unlocked_skills"];
|
#region Player Lookup
|
||||||
var session = (Array<SkillData>)CurrentSessionState["skills_unlocked"];
|
|
||||||
if (session!.Count == 0) return unlocked;
|
|
||||||
if (unlocked!.Count == 0) return session;
|
|
||||||
var joined = new Array<SkillData>();
|
|
||||||
joined.AddRange(unlocked);
|
|
||||||
joined.AddRange(session);
|
|
||||||
return joined;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PlayerController GetPlayer()
|
public PlayerController GetPlayer()
|
||||||
{
|
{
|
||||||
if (_player != null && IsInstanceValid(_player)) return _player;
|
if (_player != null && IsInstanceValid(_player)) return _player;
|
||||||
|
|
||||||
_player = null;
|
_player = null;
|
||||||
|
|
||||||
foreach (var node in _sceneNodes)
|
foreach (var node in _sceneNodes)
|
||||||
{
|
{
|
||||||
if (node is not PlayerController player) continue;
|
if (node is not PlayerController player) continue;
|
||||||
|
|
||||||
_player = player;
|
_player = player;
|
||||||
return _player;
|
return _player;
|
||||||
}
|
}
|
||||||
|
|
||||||
GD.PrintErr("PlayerController not found in the scene tree.");
|
GD.PrintErr("PlayerController not found in the scene tree.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
199
Autoloads/GameStateStore.cs
Normal file
199
Autoloads/GameStateStore.cs
Normal file
@@ -0,0 +1,199 @@
|
|||||||
|
using Godot;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Mr.BrickAdventures.scripts.Resources;
|
||||||
|
using Mr.BrickAdventures.scripts.State;
|
||||||
|
|
||||||
|
namespace Mr.BrickAdventures.Autoloads;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Central store for game state - single source of truth.
|
||||||
|
/// Use the static Instance property for easy access.
|
||||||
|
/// </summary>
|
||||||
|
public partial class GameStateStore : Node
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Singleton instance.
|
||||||
|
/// </summary>
|
||||||
|
public static GameStateStore Instance { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Persistent player state (saved to disk).
|
||||||
|
/// </summary>
|
||||||
|
public PlayerState Player { get; set; } = new();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Current session state (transient, reset on death/level complete).
|
||||||
|
/// </summary>
|
||||||
|
public SessionState Session { get; set; } = new();
|
||||||
|
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
Instance = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void _ExitTree()
|
||||||
|
{
|
||||||
|
if (Instance == this)
|
||||||
|
Instance = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Coin Operations
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets total coins (saved + session).
|
||||||
|
/// </summary>
|
||||||
|
public int GetTotalCoins() => Player.Coins + Session.CoinsCollected;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds coins to the session (not saved until level complete).
|
||||||
|
/// </summary>
|
||||||
|
public void AddSessionCoins(int amount)
|
||||||
|
{
|
||||||
|
Session.CoinsCollected += amount;
|
||||||
|
EventBus.EmitCoinsChanged(GetTotalCoins());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Commits session coins to player state.
|
||||||
|
/// </summary>
|
||||||
|
public void CommitSessionCoins()
|
||||||
|
{
|
||||||
|
Player.Coins += Session.CoinsCollected;
|
||||||
|
Session.CoinsCollected = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes coins, first from session then from saved.
|
||||||
|
/// </summary>
|
||||||
|
public void RemoveCoins(int amount)
|
||||||
|
{
|
||||||
|
if (amount <= Session.CoinsCollected)
|
||||||
|
{
|
||||||
|
Session.CoinsCollected -= amount;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var remaining = amount - Session.CoinsCollected;
|
||||||
|
Session.CoinsCollected = 0;
|
||||||
|
Player.Coins = Mathf.Max(0, Player.Coins - remaining);
|
||||||
|
}
|
||||||
|
EventBus.EmitCoinsChanged(GetTotalCoins());
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Lives Operations
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Decrements lives by 1.
|
||||||
|
/// </summary>
|
||||||
|
public void RemoveLife()
|
||||||
|
{
|
||||||
|
Player.Lives = Mathf.Max(0, Player.Lives - 1);
|
||||||
|
EventBus.EmitLivesChanged(Player.Lives);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds lives.
|
||||||
|
/// </summary>
|
||||||
|
public void AddLives(int amount)
|
||||||
|
{
|
||||||
|
Player.Lives += amount;
|
||||||
|
EventBus.EmitLivesChanged(Player.Lives);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Level Operations
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Unlocks a level for access.
|
||||||
|
/// </summary>
|
||||||
|
public void UnlockLevel(int levelIndex)
|
||||||
|
{
|
||||||
|
if (!Player.UnlockedLevels.Contains(levelIndex))
|
||||||
|
Player.UnlockedLevels.Add(levelIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Marks a level as completed and unlocks the next.
|
||||||
|
/// </summary>
|
||||||
|
public void MarkLevelComplete(int levelIndex)
|
||||||
|
{
|
||||||
|
if (!Player.CompletedLevels.Contains(levelIndex))
|
||||||
|
Player.CompletedLevels.Add(levelIndex);
|
||||||
|
UnlockLevel(levelIndex + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks if a level is unlocked.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsLevelUnlocked(int levelIndex) => Player.UnlockedLevels.Contains(levelIndex);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Skill Operations
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks if a skill is unlocked (saved or session).
|
||||||
|
/// </summary>
|
||||||
|
public bool IsSkillUnlocked(SkillData skill)
|
||||||
|
{
|
||||||
|
return Player.UnlockedSkills.Contains(skill) || Session.SkillsUnlocked.Contains(skill);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Unlocks a skill in the session.
|
||||||
|
/// </summary>
|
||||||
|
public void UnlockSkillInSession(SkillData skill)
|
||||||
|
{
|
||||||
|
if (!IsSkillUnlocked(skill))
|
||||||
|
Session.SkillsUnlocked.Add(skill);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Commits session skills to player state.
|
||||||
|
/// </summary>
|
||||||
|
public void CommitSessionSkills()
|
||||||
|
{
|
||||||
|
foreach (var skill in Session.SkillsUnlocked)
|
||||||
|
{
|
||||||
|
if (!Player.UnlockedSkills.Contains(skill))
|
||||||
|
Player.UnlockedSkills.Add(skill);
|
||||||
|
}
|
||||||
|
Session.SkillsUnlocked.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets all unlocked skills from player persistence and current session.
|
||||||
|
/// </summary>
|
||||||
|
public List<SkillData> GetAllUnlockedSkills()
|
||||||
|
{
|
||||||
|
var result = new List<SkillData>(Player.UnlockedSkills);
|
||||||
|
foreach (var skill in Session.SkillsUnlocked)
|
||||||
|
{
|
||||||
|
if (!result.Contains(skill)) result.Add(skill);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Reset Operations
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resets only the session state.
|
||||||
|
/// </summary>
|
||||||
|
public void ResetSession() => Session.Reset();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resets everything to defaults.
|
||||||
|
/// </summary>
|
||||||
|
public void ResetAll()
|
||||||
|
{
|
||||||
|
Player.Reset();
|
||||||
|
Session.ResetAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
1
Autoloads/GameStateStore.cs.uid
Normal file
1
Autoloads/GameStateStore.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://bwrhkipwecytk
|
||||||
@@ -1,61 +1,192 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text.Json;
|
||||||
using Godot;
|
using Godot;
|
||||||
using Godot.Collections;
|
|
||||||
using Mr.BrickAdventures.scripts.Resources;
|
using Mr.BrickAdventures.scripts.Resources;
|
||||||
|
using Mr.BrickAdventures.scripts.State;
|
||||||
|
|
||||||
namespace Mr.BrickAdventures.Autoloads;
|
namespace Mr.BrickAdventures.Autoloads;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Save system that serializes state to JSON using DTOs.
|
||||||
|
/// </summary>
|
||||||
public partial class SaveSystem : Node
|
public partial class SaveSystem : Node
|
||||||
{
|
{
|
||||||
[Export] public string SavePath { get; set; } = "user://savegame.save";
|
[Export] public string SavePath { get; set; } = "user://savegame.json";
|
||||||
[Export] public int Version { get; set; } = 1;
|
[Export] public int Version { get; set; } = 2;
|
||||||
|
|
||||||
private GameManager _gameManager;
|
public static SaveSystem Instance { get; private set; }
|
||||||
|
|
||||||
|
private static readonly JsonSerializerOptions JsonOptions = new()
|
||||||
|
{
|
||||||
|
WriteIndented = true,
|
||||||
|
PropertyNamingPolicy = JsonNamingPolicy.CamelCase
|
||||||
|
};
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
_gameManager = GetNode<GameManager>("/root/GameManager");
|
Instance = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void _ExitTree()
|
||||||
|
{
|
||||||
|
if (Instance == this) Instance = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveGame()
|
public void SaveGame()
|
||||||
{
|
{
|
||||||
var saveData = new Dictionary
|
var store = GameStateStore.Instance;
|
||||||
|
if (store == null)
|
||||||
{
|
{
|
||||||
{ "player_state", _gameManager.PlayerState},
|
GD.PrintErr("SaveSystem: GameStateStore not available.");
|
||||||
{ "version", Version}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert to DTO (only serializable data)
|
||||||
|
var saveData = new SaveDataDto
|
||||||
|
{
|
||||||
|
Version = Version,
|
||||||
|
Coins = store.Player.Coins,
|
||||||
|
Lives = store.Player.Lives,
|
||||||
|
CurrentLevel = store.Session.CurrentLevel,
|
||||||
|
CompletedLevels = [.. store.Player.CompletedLevels],
|
||||||
|
UnlockedLevels = new List<int>(store.Player.UnlockedLevels),
|
||||||
|
UnlockedSkillNames = GetSkillNames(store.Player.UnlockedSkills),
|
||||||
|
UnlockedAchievements = new List<string>(store.Player.UnlockedAchievements),
|
||||||
|
Statistics = new Dictionary<string, int>(store.Player.Statistics)
|
||||||
};
|
};
|
||||||
|
|
||||||
using var file = FileAccess.Open(SavePath, FileAccess.ModeFlags.Write);
|
try
|
||||||
file.StoreVar(saveData);
|
{
|
||||||
GD.Print("Game state saved to: ", SavePath);
|
var json = JsonSerializer.Serialize(saveData, JsonOptions);
|
||||||
|
using var file = FileAccess.Open(SavePath, FileAccess.ModeFlags.Write);
|
||||||
|
file.StoreString(json);
|
||||||
|
GD.Print("Game saved to: ", SavePath);
|
||||||
|
EventBus.EmitGameSaved();
|
||||||
|
}
|
||||||
|
catch (System.Exception e)
|
||||||
|
{
|
||||||
|
GD.PrintErr($"SaveSystem: Failed to save game: {e.Message}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool LoadGame()
|
public bool LoadGame()
|
||||||
{
|
{
|
||||||
if (!FileAccess.FileExists(SavePath))
|
if (!FileAccess.FileExists(SavePath))
|
||||||
return false;
|
|
||||||
|
|
||||||
using var file = FileAccess.Open(SavePath, FileAccess.ModeFlags.Read);
|
|
||||||
var saveDataObj = (Dictionary)file.GetVar();
|
|
||||||
|
|
||||||
if (saveDataObj.ContainsKey("version") && (int)saveDataObj["version"] != Version)
|
|
||||||
{
|
{
|
||||||
GD.Print($"Save file version mismatch. Expected: {Version}, Found: {saveDataObj["version"]}");
|
GD.Print("SaveSystem: No save file found.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
GD.Print("Game state loaded from: ", SavePath);
|
try
|
||||||
GD.Print("Player state: ", saveDataObj["player_state"]);
|
|
||||||
_gameManager.PlayerState = (Dictionary)saveDataObj["player_state"];
|
|
||||||
|
|
||||||
var skills = new Array<SkillData>();
|
|
||||||
foreach (var skill in (Array<SkillData>)_gameManager.PlayerState["unlocked_skills"])
|
|
||||||
{
|
{
|
||||||
skills.Add(skill);
|
using var file = FileAccess.Open(SavePath, FileAccess.ModeFlags.Read);
|
||||||
|
var json = file.GetAsText();
|
||||||
|
var saveData = JsonSerializer.Deserialize<SaveDataDto>(json, JsonOptions);
|
||||||
|
|
||||||
|
if (saveData == null)
|
||||||
|
{
|
||||||
|
GD.PrintErr("SaveSystem: Failed to deserialize save data.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (saveData.Version != Version)
|
||||||
|
{
|
||||||
|
GD.PrintErr($"SaveSystem: Version mismatch. Expected {Version}, found {saveData.Version}");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var store = GameStateStore.Instance;
|
||||||
|
if (store == null)
|
||||||
|
{
|
||||||
|
GD.PrintErr("SaveSystem: GameStateStore not available.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply loaded state
|
||||||
|
store.Player.Coins = saveData.Coins;
|
||||||
|
store.Player.Lives = saveData.Lives;
|
||||||
|
store.Session.CurrentLevel = saveData.CurrentLevel;
|
||||||
|
|
||||||
|
store.Player.CompletedLevels = saveData.CompletedLevels ?? new List<int>();
|
||||||
|
store.Player.UnlockedLevels = saveData.UnlockedLevels ?? new List<int> { 0 };
|
||||||
|
store.Player.UnlockedAchievements = saveData.UnlockedAchievements ?? new List<string>();
|
||||||
|
store.Player.Statistics = saveData.Statistics ?? new Dictionary<string, int>();
|
||||||
|
|
||||||
|
// Reload skills by name from SkillManager
|
||||||
|
store.Player.UnlockedSkills = LoadSkillsByName(saveData.UnlockedSkillNames);
|
||||||
|
|
||||||
|
GD.Print("Game loaded from: ", SavePath);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (System.Exception e)
|
||||||
|
{
|
||||||
|
GD.PrintErr($"SaveSystem: Failed to load game: {e.Message}");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
_gameManager.UnlockSkills(skills);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static List<string> GetSkillNames(List<SkillData> skills)
|
||||||
|
{
|
||||||
|
var names = new List<string>();
|
||||||
|
foreach (var skill in skills)
|
||||||
|
{
|
||||||
|
if (skill != null)
|
||||||
|
names.Add(skill.Name);
|
||||||
|
}
|
||||||
|
return names;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<SkillData> LoadSkillsByName(List<string> skillNames)
|
||||||
|
{
|
||||||
|
var skills = new List<SkillData>();
|
||||||
|
if (skillNames == null) return skills;
|
||||||
|
|
||||||
|
var skillManager = GetNodeOrNull<SkillManager>(Constants.SkillManagerPath);
|
||||||
|
if (skillManager == null)
|
||||||
|
{
|
||||||
|
GD.PrintErr("SaveSystem: SkillManager not available to resolve skill names.");
|
||||||
|
return skills;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var name in skillNames)
|
||||||
|
{
|
||||||
|
var skill = skillManager.GetSkillByName(name);
|
||||||
|
if (skill != null)
|
||||||
|
{
|
||||||
|
skills.Add(skill);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GD.PrintErr($"SaveSystem: Skill '{name}' not found in SkillManager.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return skills;
|
||||||
|
}
|
||||||
|
|
||||||
public bool CheckSaveExists() => FileAccess.FileExists(SavePath);
|
public bool CheckSaveExists() => FileAccess.FileExists(SavePath);
|
||||||
|
|
||||||
|
public void DeleteSave()
|
||||||
|
{
|
||||||
|
if (FileAccess.FileExists(SavePath))
|
||||||
|
{
|
||||||
|
DirAccess.RemoveAbsolute(ProjectSettings.GlobalizePath(SavePath));
|
||||||
|
GD.Print("Save file deleted.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Serializable DTO for save data - no Godot types.
|
||||||
|
/// </summary>
|
||||||
|
public class SaveDataDto
|
||||||
|
{
|
||||||
|
public int Version { get; set; }
|
||||||
|
public int Coins { get; set; }
|
||||||
|
public int Lives { get; set; }
|
||||||
|
public int CurrentLevel { get; set; }
|
||||||
|
public List<int> CompletedLevels { get; set; }
|
||||||
|
public List<int> UnlockedLevels { get; set; }
|
||||||
|
public List<string> UnlockedSkillNames { get; set; }
|
||||||
|
public List<string> UnlockedAchievements { get; set; }
|
||||||
|
public Dictionary<string, int> Statistics { get; set; }
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Godot;
|
using Godot;
|
||||||
using Godot.Collections;
|
using Godot.Collections;
|
||||||
|
using Mr.BrickAdventures;
|
||||||
using Mr.BrickAdventures.scripts.components;
|
using Mr.BrickAdventures.scripts.components;
|
||||||
using Mr.BrickAdventures.scripts.interfaces;
|
using Mr.BrickAdventures.scripts.interfaces;
|
||||||
using Mr.BrickAdventures.scripts.Resources;
|
using Mr.BrickAdventures.scripts.Resources;
|
||||||
@@ -14,19 +15,27 @@ public partial class SkillManager : Node
|
|||||||
private PlayerController _player;
|
private PlayerController _player;
|
||||||
|
|
||||||
[Export] public Array<SkillData> AvailableSkills { get; set; } = [];
|
[Export] public Array<SkillData> AvailableSkills { get; set; } = [];
|
||||||
|
|
||||||
public Dictionary ActiveComponents { get; private set; } = new();
|
public Dictionary ActiveComponents { get; private set; } = new();
|
||||||
|
|
||||||
|
public static SkillManager Instance { get; private set; }
|
||||||
|
|
||||||
[Signal]
|
[Signal]
|
||||||
public delegate void ActiveThrowSkillChangedEventHandler(BrickThrowComponent throwComponent);
|
public delegate void ActiveThrowSkillChangedEventHandler(BrickThrowComponent throwComponent);
|
||||||
[Signal]
|
[Signal]
|
||||||
public delegate void SkillRemovedEventHandler(SkillData skillData);
|
public delegate void SkillRemovedEventHandler(SkillData skillData);
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
_gameManager = GetNode<GameManager>("/root/GameManager");
|
Instance = this;
|
||||||
|
_gameManager = GetNode<GameManager>(Constants.GameManagerPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void _ExitTree()
|
||||||
|
{
|
||||||
|
if (Instance == this) Instance = null;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called by the PlayerController from its _Ready method to register itself with the manager.
|
/// Called by the PlayerController from its _Ready method to register itself with the manager.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -39,7 +48,7 @@ public partial class SkillManager : Node
|
|||||||
{
|
{
|
||||||
UnregisterPlayer();
|
UnregisterPlayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
_player = player;
|
_player = player;
|
||||||
if (_player != null)
|
if (_player != null)
|
||||||
{
|
{
|
||||||
@@ -61,7 +70,7 @@ public partial class SkillManager : Node
|
|||||||
}
|
}
|
||||||
_player = null;
|
_player = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddSkill(SkillData skillData)
|
public void AddSkill(SkillData skillData)
|
||||||
{
|
{
|
||||||
// Ensure a valid player is registered before adding a skill.
|
// Ensure a valid player is registered before adding a skill.
|
||||||
@@ -70,7 +79,7 @@ public partial class SkillManager : Node
|
|||||||
GD.Print("SkillManager: Player not available to add skill.");
|
GD.Print("SkillManager: Player not available to add skill.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ActiveComponents.ContainsKey(skillData.Name))
|
if (ActiveComponents.ContainsKey(skillData.Name))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -98,9 +107,9 @@ public partial class SkillManager : Node
|
|||||||
if (instance is ISkill skill)
|
if (instance is ISkill skill)
|
||||||
{
|
{
|
||||||
// Initialize the skill with the registered player instance.
|
// Initialize the skill with the registered player instance.
|
||||||
skill.Initialize(_player, skillData);
|
skill.Initialize(_player, skillData);
|
||||||
skill.Activate();
|
skill.Activate();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GD.PrintErr($"Skill scene for '{skillData.Name}' does not implement ISkill!");
|
GD.PrintErr($"Skill scene for '{skillData.Name}' does not implement ISkill!");
|
||||||
@@ -111,18 +120,18 @@ public partial class SkillManager : Node
|
|||||||
// Add the skill node as a child of the player.
|
// Add the skill node as a child of the player.
|
||||||
_player.AddChild(instance);
|
_player.AddChild(instance);
|
||||||
ActiveComponents[skillData.Name] = instance;
|
ActiveComponents[skillData.Name] = instance;
|
||||||
|
|
||||||
if (instance is BrickThrowComponent btc)
|
if (instance is BrickThrowComponent btc)
|
||||||
{
|
{
|
||||||
EmitSignalActiveThrowSkillChanged(btc);
|
EmitSignalActiveThrowSkillChanged(btc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveSkill(string skillName)
|
public void RemoveSkill(string skillName)
|
||||||
{
|
{
|
||||||
if (!ActiveComponents.TryGetValue(skillName, out var component))
|
if (!ActiveComponents.TryGetValue(skillName, out var component))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (component.AsGodotObject() is BrickThrowComponent)
|
if (component.AsGodotObject() is BrickThrowComponent)
|
||||||
{
|
{
|
||||||
EmitSignalActiveThrowSkillChanged(null);
|
EmitSignalActiveThrowSkillChanged(null);
|
||||||
@@ -133,7 +142,7 @@ public partial class SkillManager : Node
|
|||||||
{
|
{
|
||||||
skill.Deactivate();
|
skill.Deactivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsInstanceValid(inst))
|
if (IsInstanceValid(inst))
|
||||||
inst.QueueFree();
|
inst.QueueFree();
|
||||||
|
|
||||||
@@ -142,7 +151,6 @@ public partial class SkillManager : Node
|
|||||||
{
|
{
|
||||||
if (s.Name == skillName)
|
if (s.Name == skillName)
|
||||||
{
|
{
|
||||||
s.IsActive = false;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -150,7 +158,7 @@ public partial class SkillManager : Node
|
|||||||
var sd = GetSkillByName(skillName);
|
var sd = GetSkillByName(skillName);
|
||||||
if (sd != null) EmitSignalSkillRemoved(sd);
|
if (sd != null) EmitSignalSkillRemoved(sd);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RemoveAllActiveSkills()
|
private void RemoveAllActiveSkills()
|
||||||
{
|
{
|
||||||
// Create a copy of keys to avoid modification during iteration
|
// Create a copy of keys to avoid modification during iteration
|
||||||
@@ -187,12 +195,16 @@ public partial class SkillManager : Node
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsSkillActive(SkillData skill)
|
||||||
|
{
|
||||||
|
return skill != null && ActiveComponents.ContainsKey(skill.Name);
|
||||||
|
}
|
||||||
|
|
||||||
public void ActivateSkill(SkillData skill)
|
public void ActivateSkill(SkillData skill)
|
||||||
{
|
{
|
||||||
if (!ActiveComponents.ContainsKey(skill.Name))
|
if (!ActiveComponents.ContainsKey(skill.Name))
|
||||||
{
|
{
|
||||||
AddSkill(skill);
|
AddSkill(skill);
|
||||||
skill.IsActive = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,7 +213,6 @@ public partial class SkillManager : Node
|
|||||||
if (ActiveComponents.ContainsKey(skill.Name))
|
if (ActiveComponents.ContainsKey(skill.Name))
|
||||||
{
|
{
|
||||||
RemoveSkill(skill.Name);
|
RemoveSkill(skill.Name);
|
||||||
skill.IsActive = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,78 +1,62 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
using Godot;
|
using Godot;
|
||||||
using Godot.Collections;
|
using Mr.BrickAdventures.scripts.State;
|
||||||
|
|
||||||
namespace Mr.BrickAdventures.Autoloads;
|
namespace Mr.BrickAdventures.Autoloads;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Manages game statistics using GameStateStore.
|
||||||
|
/// </summary>
|
||||||
public partial class StatisticsManager : Node
|
public partial class StatisticsManager : Node
|
||||||
{
|
{
|
||||||
private GameManager _gameManager;
|
|
||||||
private AchievementManager _achievementManager;
|
|
||||||
private Dictionary<string, Variant> _stats = new();
|
|
||||||
|
|
||||||
public override void _Ready()
|
/// <summary>
|
||||||
|
/// Gets the statistics dictionary from the store.
|
||||||
|
/// </summary>
|
||||||
|
private Dictionary<string, int> GetStats()
|
||||||
{
|
{
|
||||||
_gameManager = GetNode<GameManager>("/root/GameManager");
|
return GameStateStore.Instance?.Player.Statistics ?? new Dictionary<string, int>();
|
||||||
_achievementManager = GetNode<AchievementManager>("/root/AchievementManager");
|
|
||||||
LoadStatistics();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadStatistics()
|
|
||||||
{
|
|
||||||
if (_gameManager.PlayerState.TryGetValue("statistics", out var statsObj))
|
|
||||||
{
|
|
||||||
_stats = (Dictionary<string, Variant>)statsObj;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_stats = new Dictionary<string, Variant>();
|
|
||||||
_gameManager.PlayerState["statistics"] = _stats;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Increases a numerical statistic by a given amount.
|
/// Increases a numerical statistic by a given amount.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void IncrementStat(string statName, int amount = 1)
|
public void IncrementStat(string statName, int amount = 1)
|
||||||
{
|
{
|
||||||
if (_stats.TryGetValue(statName, out var currentValue))
|
var stats = GetStats();
|
||||||
|
if (stats.TryGetValue(statName, out var currentValue))
|
||||||
{
|
{
|
||||||
_stats[statName] = (int)currentValue + amount;
|
stats[statName] = currentValue + amount;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_stats[statName] = amount;
|
stats[statName] = amount;
|
||||||
}
|
}
|
||||||
GD.Print($"Stat '{statName}' updated to: {_stats[statName]}");
|
}
|
||||||
CheckAchievementsForStat(statName);
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets a statistic to a specific value.
|
||||||
|
/// </summary>
|
||||||
|
public void SetStat(string statName, int value)
|
||||||
|
{
|
||||||
|
var stats = GetStats();
|
||||||
|
stats[statName] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the value of a statistic.
|
/// Gets the value of a statistic.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Variant GetStat(string statName, Variant defaultValue = default)
|
public int GetStat(string statName)
|
||||||
{
|
{
|
||||||
return _stats.TryGetValue(statName, out var value) ? value : defaultValue;
|
var stats = GetStats();
|
||||||
|
return stats.TryGetValue(statName, out var value) ? value : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks if the updated stat meets the criteria for any achievements.
|
/// Gets a copy of all statistics.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void CheckAchievementsForStat(string statName)
|
public Dictionary<string, int> GetAllStats()
|
||||||
{
|
{
|
||||||
switch (statName)
|
return new Dictionary<string, int>(GetStats());
|
||||||
{
|
|
||||||
case "enemies_defeated":
|
|
||||||
if ((int)GetStat(statName, 0) >= 100)
|
|
||||||
{
|
|
||||||
_achievementManager.UnlockAchievement("slayer_100_enemies");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "jumps_made":
|
|
||||||
if ((int)GetStat(statName, 0) >= 1000)
|
|
||||||
{
|
|
||||||
_achievementManager.UnlockAchievement("super_jumper");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<Project Sdk="Godot.NET.Sdk/4.5.1">
|
<Project Sdk="Godot.NET.Sdk/4.6.0">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<EnableDynamicLoading>true</EnableDynamicLoading>
|
<EnableDynamicLoading>true</EnableDynamicLoading>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=7 format=3 uid="uid://bargnp4twtmxg"]
|
[gd_scene format=3 uid="uid://bargnp4twtmxg"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_aya2w"]
|
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_aya2w"]
|
||||||
[ext_resource type="Script" uid="uid://r4jybneigfcn" path="res://scripts/components/CollectableComponent.cs" id="2_htmrw"]
|
[ext_resource type="Script" uid="uid://r4jybneigfcn" path="res://scripts/components/CollectableComponent.cs" id="2_htmrw"]
|
||||||
@@ -9,33 +9,33 @@
|
|||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_3ask2"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_3ask2"]
|
||||||
radius = 9.0
|
radius = 9.0
|
||||||
|
|
||||||
[node name="Big Coin" type="Area2D" groups=["coins"]]
|
[node name="Big Coin" type="Area2D" unique_id=354254828 groups=["coins"]]
|
||||||
scale = Vector2(2, 2)
|
scale = Vector2(2, 2)
|
||||||
collision_layer = 2
|
collision_layer = 2
|
||||||
collision_mask = 4
|
collision_mask = 4
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=2066526597]
|
||||||
shape = SubResource("CircleShape2D_3ask2")
|
shape = SubResource("CircleShape2D_3ask2")
|
||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=1626463721]
|
||||||
texture = ExtResource("1_aya2w")
|
texture = ExtResource("1_aya2w")
|
||||||
hframes = 12
|
hframes = 12
|
||||||
vframes = 12
|
vframes = 12
|
||||||
frame = 51
|
frame = 51
|
||||||
|
|
||||||
[node name="CollectableComponent" type="Node" parent="." node_paths=PackedStringArray("Area2D", "CollisionShape", "Sfx")]
|
[node name="CollectableComponent" type="Node" parent="." unique_id=1124310030 node_paths=PackedStringArray("Area2D", "CollisionShape", "Sfx")]
|
||||||
script = ExtResource("2_htmrw")
|
script = ExtResource("2_htmrw")
|
||||||
Area2D = NodePath("..")
|
Area2D = NodePath("..")
|
||||||
CollisionShape = NodePath("../CollisionShape2D")
|
CollisionShape = NodePath("../CollisionShape2D")
|
||||||
Data = ExtResource("3_lk3av")
|
Data = ExtResource("3_lk3av")
|
||||||
Sfx = NodePath("../sfx")
|
Sfx = NodePath("../sfx")
|
||||||
|
|
||||||
[node name="FadeAwayComponent" type="Node" parent="." node_paths=PackedStringArray("Sprite", "Area")]
|
[node name="FadeAwayComponent" type="Node" parent="." unique_id=222617739 node_paths=PackedStringArray("Sprite", "Area")]
|
||||||
script = ExtResource("4_62p7g")
|
script = ExtResource("4_62p7g")
|
||||||
Sprite = NodePath("../Sprite2D")
|
Sprite = NodePath("../Sprite2D")
|
||||||
Area = NodePath("..")
|
Area = NodePath("..")
|
||||||
|
|
||||||
[node name="sfx" type="AudioStreamPlayer2D" parent="."]
|
[node name="sfx" type="AudioStreamPlayer2D" parent="." unique_id=1978747299]
|
||||||
stream = ExtResource("5_dbffd")
|
stream = ExtResource("5_dbffd")
|
||||||
volume_db = -5.0
|
volume_db = -5.0
|
||||||
bus = &"sfx"
|
bus = &"sfx"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=7 format=3 uid="uid://d08dfqmirnd66"]
|
[gd_scene format=3 uid="uid://d08dfqmirnd66"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_1co1x"]
|
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_1co1x"]
|
||||||
[ext_resource type="Script" uid="uid://r4jybneigfcn" path="res://scripts/components/CollectableComponent.cs" id="2_lthbn"]
|
[ext_resource type="Script" uid="uid://r4jybneigfcn" path="res://scripts/components/CollectableComponent.cs" id="2_lthbn"]
|
||||||
@@ -9,32 +9,32 @@
|
|||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_3ask2"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_3ask2"]
|
||||||
radius = 9.0
|
radius = 9.0
|
||||||
|
|
||||||
[node name="Big Treasure" type="Area2D" groups=["coins"]]
|
[node name="Big Treasure" type="Area2D" unique_id=1021217632 groups=["coins"]]
|
||||||
collision_layer = 2
|
collision_layer = 2
|
||||||
collision_mask = 4
|
collision_mask = 4
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=458290011]
|
||||||
shape = SubResource("CircleShape2D_3ask2")
|
shape = SubResource("CircleShape2D_3ask2")
|
||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=564060301]
|
||||||
texture = ExtResource("1_1co1x")
|
texture = ExtResource("1_1co1x")
|
||||||
hframes = 12
|
hframes = 12
|
||||||
vframes = 12
|
vframes = 12
|
||||||
frame = 64
|
frame = 64
|
||||||
|
|
||||||
[node name="CollectableComponent" type="Node" parent="." node_paths=PackedStringArray("Area2D", "CollisionShape", "Sfx")]
|
[node name="CollectableComponent" type="Node" parent="." unique_id=2009195182 node_paths=PackedStringArray("Area2D", "CollisionShape", "Sfx")]
|
||||||
script = ExtResource("2_lthbn")
|
script = ExtResource("2_lthbn")
|
||||||
Area2D = NodePath("..")
|
Area2D = NodePath("..")
|
||||||
CollisionShape = NodePath("../CollisionShape2D")
|
CollisionShape = NodePath("../CollisionShape2D")
|
||||||
Data = ExtResource("3_k64cr")
|
Data = ExtResource("3_k64cr")
|
||||||
Sfx = NodePath("../sfx")
|
Sfx = NodePath("../sfx")
|
||||||
|
|
||||||
[node name="FadeAwayComponent" type="Node" parent="." node_paths=PackedStringArray("Sprite", "Area")]
|
[node name="FadeAwayComponent" type="Node" parent="." unique_id=1809580000 node_paths=PackedStringArray("Sprite", "Area")]
|
||||||
script = ExtResource("4_qwwsj")
|
script = ExtResource("4_qwwsj")
|
||||||
Sprite = NodePath("../Sprite2D")
|
Sprite = NodePath("../Sprite2D")
|
||||||
FadeDuration = 0.4
|
FadeDuration = 0.4
|
||||||
Area = NodePath("..")
|
Area = NodePath("..")
|
||||||
|
|
||||||
[node name="sfx" type="AudioStreamPlayer2D" parent="."]
|
[node name="sfx" type="AudioStreamPlayer2D" parent="." unique_id=466669009]
|
||||||
stream = ExtResource("5_fxf8v")
|
stream = ExtResource("5_fxf8v")
|
||||||
bus = &"sfx"
|
bus = &"sfx"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=58 format=3 uid="uid://bqi5s710xb1ju"]
|
[gd_scene load_steps=57 format=3 uid="uid://bqi5s710xb1ju"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://csel4s0e4g5uf" path="res://scripts/components/PlayerController.cs" id="1_yysbb"]
|
[ext_resource type="Script" uid="uid://csel4s0e4g5uf" path="res://scripts/components/PlayerController.cs" id="1_yysbb"]
|
||||||
[ext_resource type="Shader" uid="uid://bs4xvm4qkurpr" path="res://shaders/hit_flash.tres" id="2_lgb3u"]
|
[ext_resource type="Shader" uid="uid://bs4xvm4qkurpr" path="res://shaders/hit_flash.tres" id="2_lgb3u"]
|
||||||
@@ -19,7 +19,6 @@
|
|||||||
[ext_resource type="PackedScene" uid="uid://dre1vit1m4d2n" path="res://objects/movement_abilities/grid_movement_ability.tscn" id="8_xuhvf"]
|
[ext_resource type="PackedScene" uid="uid://dre1vit1m4d2n" path="res://objects/movement_abilities/grid_movement_ability.tscn" id="8_xuhvf"]
|
||||||
[ext_resource type="Script" uid="uid://dy78ak8eykw6e" path="res://scripts/components/FlipComponent.cs" id="9_yysbb"]
|
[ext_resource type="Script" uid="uid://dy78ak8eykw6e" path="res://scripts/components/FlipComponent.cs" id="9_yysbb"]
|
||||||
[ext_resource type="Script" uid="uid://mnjg3p0aw1ow" path="res://scripts/components/CanPickUpComponent.cs" id="10_yysbb"]
|
[ext_resource type="Script" uid="uid://mnjg3p0aw1ow" path="res://scripts/components/CanPickUpComponent.cs" id="10_yysbb"]
|
||||||
[ext_resource type="Script" uid="uid://ccqb8kd5m0eh7" path="res://scripts/components/ScoreComponent.cs" id="11_o1ihh"]
|
|
||||||
[ext_resource type="Script" uid="uid://dgb8bqcri7nsj" path="res://scripts/components/HealthComponent.cs" id="12_ur2y5"]
|
[ext_resource type="Script" uid="uid://dgb8bqcri7nsj" path="res://scripts/components/HealthComponent.cs" id="12_ur2y5"]
|
||||||
[ext_resource type="Script" uid="uid://byw1legrv1ep2" path="res://scripts/components/PlayerDeathComponent.cs" id="13_7til7"]
|
[ext_resource type="Script" uid="uid://byw1legrv1ep2" path="res://scripts/components/PlayerDeathComponent.cs" id="13_7til7"]
|
||||||
[ext_resource type="Script" uid="uid://cecelixl41t3j" path="res://scripts/components/InvulnerabilityComponent.cs" id="15_xuhvf"]
|
[ext_resource type="Script" uid="uid://cecelixl41t3j" path="res://scripts/components/InvulnerabilityComponent.cs" id="15_xuhvf"]
|
||||||
@@ -175,9 +174,6 @@ shape = SubResource("RectangleShape2D_vad0t")
|
|||||||
[node name="CanPickUpComponent" type="Node" parent="."]
|
[node name="CanPickUpComponent" type="Node" parent="."]
|
||||||
script = ExtResource("10_yysbb")
|
script = ExtResource("10_yysbb")
|
||||||
|
|
||||||
[node name="ScoreComponent" type="Node" parent="."]
|
|
||||||
script = ExtResource("11_o1ihh")
|
|
||||||
|
|
||||||
[node name="HealthComponent" type="Node2D" parent="." node_paths=PackedStringArray("HurtSfx", "HealSfx")]
|
[node name="HealthComponent" type="Node2D" parent="." node_paths=PackedStringArray("HurtSfx", "HealSfx")]
|
||||||
script = ExtResource("12_ur2y5")
|
script = ExtResource("12_ur2y5")
|
||||||
HurtSfx = NodePath("../sfx_hurt")
|
HurtSfx = NodePath("../sfx_hurt")
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=7 format=3 uid="uid://54w4wisfj8v8"]
|
[gd_scene format=3 uid="uid://54w4wisfj8v8"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_epuj5"]
|
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_epuj5"]
|
||||||
[ext_resource type="Script" uid="uid://r4jybneigfcn" path="res://scripts/components/CollectableComponent.cs" id="2_gxix7"]
|
[ext_resource type="Script" uid="uid://r4jybneigfcn" path="res://scripts/components/CollectableComponent.cs" id="2_gxix7"]
|
||||||
@@ -9,33 +9,33 @@
|
|||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_3ask2"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_3ask2"]
|
||||||
radius = 9.0
|
radius = 9.0
|
||||||
|
|
||||||
[node name="Coin" type="Area2D" groups=["coins"]]
|
[node name="Coin" type="Area2D" unique_id=1771447403 groups=["coins"]]
|
||||||
collision_layer = 2
|
collision_layer = 2
|
||||||
collision_mask = 4
|
collision_mask = 4
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=707378099]
|
||||||
shape = SubResource("CircleShape2D_3ask2")
|
shape = SubResource("CircleShape2D_3ask2")
|
||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=898624458]
|
||||||
texture = ExtResource("1_epuj5")
|
texture = ExtResource("1_epuj5")
|
||||||
hframes = 12
|
hframes = 12
|
||||||
vframes = 12
|
vframes = 12
|
||||||
frame = 51
|
frame = 51
|
||||||
|
|
||||||
[node name="CollectableComponent" type="Node" parent="." node_paths=PackedStringArray("Area2D", "CollisionShape", "Sfx")]
|
[node name="CollectableComponent" type="Node" parent="." unique_id=564726971 node_paths=PackedStringArray("Area2D", "CollisionShape", "Sfx")]
|
||||||
script = ExtResource("2_gxix7")
|
script = ExtResource("2_gxix7")
|
||||||
Area2D = NodePath("..")
|
Area2D = NodePath("..")
|
||||||
CollisionShape = NodePath("../CollisionShape2D")
|
CollisionShape = NodePath("../CollisionShape2D")
|
||||||
Data = ExtResource("3_fm2fq")
|
Data = ExtResource("3_fm2fq")
|
||||||
Sfx = NodePath("../sfx")
|
Sfx = NodePath("../sfx")
|
||||||
|
|
||||||
[node name="FadeAwayComponent" type="Node" parent="." node_paths=PackedStringArray("Sprite", "Area")]
|
[node name="FadeAwayComponent" type="Node" parent="." unique_id=1534239994 node_paths=PackedStringArray("Sprite", "Area")]
|
||||||
script = ExtResource("4_gxix7")
|
script = ExtResource("4_gxix7")
|
||||||
Sprite = NodePath("../Sprite2D")
|
Sprite = NodePath("../Sprite2D")
|
||||||
FadeDuration = 0.4
|
FadeDuration = 0.4
|
||||||
Area = NodePath("..")
|
Area = NodePath("..")
|
||||||
|
|
||||||
[node name="sfx" type="AudioStreamPlayer2D" parent="."]
|
[node name="sfx" type="AudioStreamPlayer2D" parent="." unique_id=1641717]
|
||||||
stream = ExtResource("5_4jc2c")
|
stream = ExtResource("5_4jc2c")
|
||||||
volume_db = -10.0
|
volume_db = -10.0
|
||||||
bus = &"sfx"
|
bus = &"sfx"
|
||||||
|
|||||||
34
objects/entities/double_jump_skill_pickup.tscn
Normal file
34
objects/entities/double_jump_skill_pickup.tscn
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[gd_scene load_steps=6 format=3 uid="uid://dk2cu8qs7odib"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_214vd"]
|
||||||
|
[ext_resource type="Script" uid="uid://r4jybneigfcn" path="res://scripts/components/CollectableComponent.cs" id="2_h7fi3"]
|
||||||
|
[ext_resource type="Script" uid="uid://bjln6jb1sigx2" path="res://scripts/components/FadeAwayComponent.cs" id="3_b687r"]
|
||||||
|
[ext_resource type="Resource" path="res://resources/collectables/double_jump_pickup.tres" id="3_h7fi3"]
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_pickup"]
|
||||||
|
radius = 12.0
|
||||||
|
|
||||||
|
[node name="SkillPickup" type="Area2D" groups=["Collectables"]]
|
||||||
|
collision_layer = 2
|
||||||
|
collision_mask = 4
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource("CircleShape2D_pickup")
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
|
texture = ExtResource("1_214vd")
|
||||||
|
hframes = 12
|
||||||
|
vframes = 12
|
||||||
|
frame = 24
|
||||||
|
|
||||||
|
[node name="CollectableComponent" type="Node" parent="." node_paths=PackedStringArray("Area2D", "CollisionShape")]
|
||||||
|
script = ExtResource("2_h7fi3")
|
||||||
|
Area2D = NodePath("..")
|
||||||
|
CollisionShape = NodePath("../CollisionShape2D")
|
||||||
|
Data = ExtResource("3_h7fi3")
|
||||||
|
|
||||||
|
[node name="FadeAwayComponent" type="Node" parent="." node_paths=PackedStringArray("Sprite", "Area")]
|
||||||
|
script = ExtResource("3_b687r")
|
||||||
|
Sprite = NodePath("../Sprite2D")
|
||||||
|
FadeDuration = 0.5
|
||||||
|
Area = NodePath("..")
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=6 format=3 uid="uid://12jnkdygpxwc"]
|
[gd_scene format=3 uid="uid://12jnkdygpxwc"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_agxwm"]
|
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_agxwm"]
|
||||||
[ext_resource type="Script" uid="uid://dnh0mekg2vqxi" path="res://scripts/components/RequirementComponent.cs" id="2_ed7mh"]
|
[ext_resource type="Script" uid="uid://dnh0mekg2vqxi" path="res://scripts/components/RequirementComponent.cs" id="2_ed7mh"]
|
||||||
@@ -8,14 +8,14 @@
|
|||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_yfu6m"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_yfu6m"]
|
||||||
size = Vector2(28, 32)
|
size = Vector2(28, 32)
|
||||||
|
|
||||||
[node name="ExitLevel" type="Area2D" node_paths=PackedStringArray("DoorSprite")]
|
[node name="ExitLevel" type="Area2D" unique_id=1951927125 node_paths=PackedStringArray("DoorSprite")]
|
||||||
collision_layer = 0
|
collision_layer = 0
|
||||||
collision_mask = 4
|
collision_mask = 4
|
||||||
script = ExtResource("4_06sog")
|
script = ExtResource("4_06sog")
|
||||||
DoorSprite = NodePath("Sprite2D")
|
DoorSprite = NodePath("Sprite2D")
|
||||||
OpenedDoorFrame = 88
|
OpenedDoorFrame = 88
|
||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=1296410089]
|
||||||
position = Vector2(0, -8)
|
position = Vector2(0, -8)
|
||||||
scale = Vector2(2, 2)
|
scale = Vector2(2, 2)
|
||||||
texture = ExtResource("1_agxwm")
|
texture = ExtResource("1_agxwm")
|
||||||
@@ -23,15 +23,15 @@ hframes = 12
|
|||||||
vframes = 12
|
vframes = 12
|
||||||
frame = 54
|
frame = 54
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=220927363]
|
||||||
position = Vector2(0, -8)
|
position = Vector2(0, -8)
|
||||||
shape = SubResource("RectangleShape2D_yfu6m")
|
shape = SubResource("RectangleShape2D_yfu6m")
|
||||||
|
|
||||||
[node name="RequirementComponent" type="Node" parent="."]
|
[node name="RequirementComponent" type="Node" parent="." unique_id=1338124097]
|
||||||
script = ExtResource("2_ed7mh")
|
script = ExtResource("2_ed7mh")
|
||||||
RequirementType = 1
|
RequirementType = 2
|
||||||
|
|
||||||
[node name="UnlockOnRequirementComponent" type="Node" parent="." node_paths=PackedStringArray("RequirementComponent", "UnlockTarget")]
|
[node name="UnlockOnRequirementComponent" type="Node" parent="." unique_id=1279359200 node_paths=PackedStringArray("RequirementComponent", "UnlockTarget")]
|
||||||
script = ExtResource("3_ed7mh")
|
script = ExtResource("3_ed7mh")
|
||||||
RequirementComponent = NodePath("../RequirementComponent")
|
RequirementComponent = NodePath("../RequirementComponent")
|
||||||
UnlockTarget = NodePath("..")
|
UnlockTarget = NodePath("..")
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=30 format=3 uid="uid://xp4njljog0x2"]
|
[gd_scene format=3 uid="uid://xp4njljog0x2"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://22k1u37j6k8y" path="res://sprites/flying_enemy.png" id="1_30hhw"]
|
[ext_resource type="Texture2D" uid="uid://22k1u37j6k8y" path="res://sprites/flying_enemy.png" id="1_30hhw"]
|
||||||
[ext_resource type="Shader" uid="uid://bs4xvm4qkurpr" path="res://shaders/hit_flash.tres" id="1_uyhuj"]
|
[ext_resource type="Shader" uid="uid://bs4xvm4qkurpr" path="res://shaders/hit_flash.tres" id="1_uyhuj"]
|
||||||
@@ -60,7 +60,7 @@ point_count = 2
|
|||||||
[sub_resource type="CurveTexture" id="CurveTexture_7b7mt"]
|
[sub_resource type="CurveTexture" id="CurveTexture_7b7mt"]
|
||||||
curve = SubResource("Curve_f2w8b")
|
curve = SubResource("Curve_f2w8b")
|
||||||
|
|
||||||
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_qxfb0"]
|
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_q78ru"]
|
||||||
resource_local_to_scene = true
|
resource_local_to_scene = true
|
||||||
lifetime_randomness = 1.0
|
lifetime_randomness = 1.0
|
||||||
particle_flag_disable_z = true
|
particle_flag_disable_z = true
|
||||||
@@ -80,50 +80,52 @@ color_ramp = SubResource("GradientTexture1D_f1fvy")
|
|||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_cmp1h"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_cmp1h"]
|
||||||
size = Vector2(16, 26)
|
size = Vector2(16, 26)
|
||||||
|
|
||||||
[node name="Flying Enemy" type="CharacterBody2D"]
|
[node name="Flying Enemy" type="CharacterBody2D" unique_id=1068972930]
|
||||||
collision_layer = 8
|
collision_layer = 8
|
||||||
collision_mask = 21
|
collision_mask = 21
|
||||||
motion_mode = 1
|
motion_mode = 1
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=572073196]
|
||||||
visible = false
|
visible = false
|
||||||
shape = SubResource("CapsuleShape2D_hil2i")
|
shape = SubResource("CapsuleShape2D_hil2i")
|
||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=191340928]
|
||||||
material = SubResource("ShaderMaterial_q78ru")
|
material = SubResource("ShaderMaterial_q78ru")
|
||||||
texture = ExtResource("1_30hhw")
|
texture = ExtResource("1_30hhw")
|
||||||
|
|
||||||
[node name="Jetpack Particles" type="GPUParticles2D" parent="."]
|
[node name="Jetpack Particles" type="GPUParticles2D" parent="." unique_id=1641064286]
|
||||||
z_index = -1
|
z_index = -1
|
||||||
position = Vector2(-4, 16)
|
position = Vector2(-4, 16)
|
||||||
explosiveness = 0.5
|
explosiveness = 0.5
|
||||||
fixed_fps = 24
|
fixed_fps = 24
|
||||||
process_material = SubResource("ParticleProcessMaterial_fd2du")
|
process_material = SubResource("ParticleProcessMaterial_fd2du")
|
||||||
|
|
||||||
[node name="Jetpack Particles2" type="GPUParticles2D" parent="."]
|
[node name="Jetpack Particles2" type="GPUParticles2D" parent="." unique_id=962140317]
|
||||||
z_index = -1
|
z_index = -1
|
||||||
position = Vector2(4, 16)
|
position = Vector2(4, 16)
|
||||||
explosiveness = 0.5
|
explosiveness = 0.5
|
||||||
fixed_fps = 24
|
fixed_fps = 24
|
||||||
process_material = SubResource("ParticleProcessMaterial_fd2du")
|
process_material = SubResource("ParticleProcessMaterial_fd2du")
|
||||||
|
|
||||||
[node name="HealthComponent" type="Node2D" parent="." node_paths=PackedStringArray("HurtSfx")]
|
[node name="HealthComponent" type="Node2D" parent="." unique_id=1125679087 node_paths=PackedStringArray("HurtSfx")]
|
||||||
script = ExtResource("3_uyhuj")
|
script = ExtResource("3_uyhuj")
|
||||||
|
Health = 0.25
|
||||||
|
MaxHealth = 0.25
|
||||||
HurtSfx = NodePath("../sfx_hurt")
|
HurtSfx = NodePath("../sfx_hurt")
|
||||||
|
|
||||||
[node name="sfx_hurt" type="AudioStreamPlayer2D" parent="."]
|
[node name="sfx_hurt" type="AudioStreamPlayer2D" parent="." unique_id=1006537001]
|
||||||
stream = ExtResource("3_fd2du")
|
stream = ExtResource("3_fd2du")
|
||||||
bus = &"sfx"
|
bus = &"sfx"
|
||||||
|
|
||||||
[node name="sfx_shoot" type="AudioStreamPlayer2D" parent="."]
|
[node name="sfx_shoot" type="AudioStreamPlayer2D" parent="." unique_id=1437744637]
|
||||||
stream = ExtResource("4_rhq76")
|
stream = ExtResource("4_rhq76")
|
||||||
bus = &"sfx"
|
bus = &"sfx"
|
||||||
|
|
||||||
[node name="DamageComponent" type="Node" parent="." node_paths=PackedStringArray("Area")]
|
[node name="DamageComponent" type="Node" parent="." unique_id=1923393563 node_paths=PackedStringArray("Area")]
|
||||||
script = ExtResource("6_q78ru")
|
script = ExtResource("6_q78ru")
|
||||||
Area = NodePath("../Hitbox")
|
Area = NodePath("../Hitbox")
|
||||||
|
|
||||||
[node name="PeriodicShootingComponent" type="Node" parent="." node_paths=PackedStringArray("BulletSpawnPointRight", "BulletSpawnPointLeft")]
|
[node name="PeriodicShootingComponent" type="Node" parent="." unique_id=1743534415 node_paths=PackedStringArray("BulletSpawnPointRight", "BulletSpawnPointLeft")]
|
||||||
script = ExtResource("7_weo6b")
|
script = ExtResource("7_weo6b")
|
||||||
BulletScene = ExtResource("7_4ajjm")
|
BulletScene = ExtResource("7_4ajjm")
|
||||||
ShootInterval = 2.0
|
ShootInterval = 2.0
|
||||||
@@ -131,68 +133,68 @@ BulletSpawnPointRight = NodePath("../laser spawn point right")
|
|||||||
BulletSpawnPointLeft = NodePath("../laser spawn point left")
|
BulletSpawnPointLeft = NodePath("../laser spawn point left")
|
||||||
ShootingIntervalVariation = 0.5
|
ShootingIntervalVariation = 0.5
|
||||||
|
|
||||||
[node name="EnemyDeathComponent" type="Node" parent="." node_paths=PackedStringArray("CollisionShape", "Health")]
|
[node name="EnemyDeathComponent" type="Node" parent="." unique_id=1519565079 node_paths=PackedStringArray("CollisionShape", "Health")]
|
||||||
script = ExtResource("9_6p4k7")
|
script = ExtResource("9_6p4k7")
|
||||||
TweenDuration = 0.1
|
TweenDuration = 0.1
|
||||||
CollisionShape = NodePath("../CollisionShape2D")
|
CollisionShape = NodePath("../CollisionShape2D")
|
||||||
Health = NodePath("../HealthComponent")
|
Health = NodePath("../HealthComponent")
|
||||||
|
|
||||||
[node name="FlashingComponent" type="Node" parent="." node_paths=PackedStringArray("Sprite", "HealthComponent")]
|
[node name="FlashingComponent" type="Node" parent="." unique_id=1761479670 node_paths=PackedStringArray("Sprite", "HealthComponent")]
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
script = ExtResource("10_jmybk")
|
script = ExtResource("10_jmybk")
|
||||||
Sprite = NodePath("../Sprite2D")
|
Sprite = NodePath("../Sprite2D")
|
||||||
HealthComponent = NodePath("../HealthComponent")
|
HealthComponent = NodePath("../HealthComponent")
|
||||||
|
|
||||||
[node name="HitComponent" type="Node" parent="." node_paths=PackedStringArray("Sprite", "Health", "HitFx")]
|
[node name="HitComponent" type="Node" parent="." unique_id=2106183592 node_paths=PackedStringArray("Sprite", "Health", "HitFx")]
|
||||||
script = ExtResource("11_2yvae")
|
script = ExtResource("11_2yvae")
|
||||||
Sprite = NodePath("../Sprite2D")
|
Sprite = NodePath("../Sprite2D")
|
||||||
Health = NodePath("../HealthComponent")
|
Health = NodePath("../HealthComponent")
|
||||||
HitFx = NodePath("../HitParticles")
|
HitFx = NodePath("../HitParticles")
|
||||||
|
|
||||||
[node name="StatusEffectComponent" type="Node" parent="."]
|
[node name="StatusEffectComponent" type="Node" parent="." unique_id=2016067092]
|
||||||
script = ExtResource("12_xlup2")
|
script = ExtResource("12_xlup2")
|
||||||
|
|
||||||
[node name="FireEffectComponent" type="Node" parent="." node_paths=PackedStringArray("Health", "StatusEffectComponent", "FireFX")]
|
[node name="FireEffectComponent" type="Node" parent="." unique_id=599378746 node_paths=PackedStringArray("Health", "StatusEffectComponent", "FireFX")]
|
||||||
script = ExtResource("13_mrjm6")
|
script = ExtResource("13_mrjm6")
|
||||||
Health = NodePath("../HealthComponent")
|
Health = NodePath("../HealthComponent")
|
||||||
StatusEffectComponent = NodePath("../StatusEffectComponent")
|
StatusEffectComponent = NodePath("../StatusEffectComponent")
|
||||||
FireFX = NodePath("../FireFX")
|
FireFX = NodePath("../FireFX")
|
||||||
|
|
||||||
[node name="IceEffectComponent" type="Node" parent="." node_paths=PackedStringArray("ComponentsToDisable", "StatusEffectComponent", "IceFx")]
|
[node name="IceEffectComponent" type="Node" parent="." unique_id=1515560540 node_paths=PackedStringArray("ComponentsToDisable", "StatusEffectComponent", "IceFx")]
|
||||||
script = ExtResource("14_pkino")
|
script = ExtResource("14_pkino")
|
||||||
ComponentsToDisable = [NodePath("../PeriodicShootingComponent"), NodePath("../DamageComponent")]
|
ComponentsToDisable = [NodePath("../PeriodicShootingComponent"), NodePath("../DamageComponent")]
|
||||||
StatusEffectComponent = NodePath("../StatusEffectComponent")
|
StatusEffectComponent = NodePath("../StatusEffectComponent")
|
||||||
IceFx = NodePath("../Ice FX")
|
IceFx = NodePath("../Ice FX")
|
||||||
|
|
||||||
[node name="HitParticles" parent="." instance=ExtResource("13_xlup2")]
|
[node name="HitParticles" parent="." unique_id=579475644 instance=ExtResource("13_xlup2")]
|
||||||
position = Vector2(0, 1)
|
position = Vector2(0, 1)
|
||||||
process_material = SubResource("ParticleProcessMaterial_qxfb0")
|
process_material = SubResource("ParticleProcessMaterial_q78ru")
|
||||||
|
|
||||||
[node name="FireFX" parent="." instance=ExtResource("14_mrjm6")]
|
[node name="FireFX" parent="." unique_id=1136026281 instance=ExtResource("14_mrjm6")]
|
||||||
position = Vector2(0, 9)
|
position = Vector2(0, 9)
|
||||||
emitting = false
|
emitting = false
|
||||||
amount = 2048
|
amount = 2048
|
||||||
|
|
||||||
[node name="Ice FX" parent="." instance=ExtResource("15_pkino")]
|
[node name="Ice FX" parent="." unique_id=275134518 instance=ExtResource("15_pkino")]
|
||||||
visible = false
|
visible = false
|
||||||
position = Vector2(1, 0)
|
position = Vector2(1, 0)
|
||||||
scale = Vector2(0.684407, 0.929677)
|
scale = Vector2(0.684407, 0.929677)
|
||||||
|
|
||||||
[node name="laser spawn point right" type="Node2D" parent="."]
|
[node name="laser spawn point right" type="Node2D" parent="." unique_id=915998238]
|
||||||
position = Vector2(8, -2)
|
position = Vector2(8, -2)
|
||||||
|
|
||||||
[node name="laser spawn point left" type="Node2D" parent="."]
|
[node name="laser spawn point left" type="Node2D" parent="." unique_id=1180867485]
|
||||||
position = Vector2(-9, -2)
|
position = Vector2(-9, -2)
|
||||||
|
|
||||||
[node name="Hitbox" type="Area2D" parent="."]
|
[node name="Hitbox" type="Area2D" parent="." unique_id=1699649839]
|
||||||
collision_layer = 8
|
collision_layer = 8
|
||||||
collision_mask = 20
|
collision_mask = 20
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox" unique_id=379520850]
|
||||||
position = Vector2(0, 2)
|
position = Vector2(0, 2)
|
||||||
shape = SubResource("RectangleShape2D_cmp1h")
|
shape = SubResource("RectangleShape2D_cmp1h")
|
||||||
|
|
||||||
[node name="PathFollowerComponent" type="Node2D" parent="."]
|
[node name="PathFollowerComponent" type="Node2D" parent="." unique_id=1706994676]
|
||||||
script = ExtResource("18_q78ru")
|
script = ExtResource("18_q78ru")
|
||||||
ShouldRotate = false
|
ShouldRotate = false
|
||||||
metadata/_custom_type_script = "uid://b4hvq2i66fjhi"
|
metadata/_custom_type_script = "uid://b4hvq2i66fjhi"
|
||||||
|
|||||||
32
objects/entities/skill_pickup.tscn
Normal file
32
objects/entities/skill_pickup.tscn
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
[gd_scene load_steps=5 format=3 uid="uid://0idmnkwids1r"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_sprite"]
|
||||||
|
[ext_resource type="Script" uid="uid://r4jybneigfcn" path="res://scripts/components/CollectableComponent.cs" id="2_collectable"]
|
||||||
|
[ext_resource type="Script" uid="uid://bjln6jb1sigx2" path="res://scripts/components/FadeAwayComponent.cs" id="3_fadeaway"]
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_pickup"]
|
||||||
|
radius = 12.0
|
||||||
|
|
||||||
|
[node name="SkillPickup" type="Area2D" groups=["Collectables"]]
|
||||||
|
collision_layer = 2
|
||||||
|
collision_mask = 4
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource("CircleShape2D_pickup")
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
|
texture = ExtResource("1_sprite")
|
||||||
|
hframes = 12
|
||||||
|
vframes = 12
|
||||||
|
frame = 24
|
||||||
|
|
||||||
|
[node name="CollectableComponent" type="Node" parent="." node_paths=PackedStringArray("Area2D", "CollisionShape")]
|
||||||
|
script = ExtResource("2_collectable")
|
||||||
|
Area2D = NodePath("..")
|
||||||
|
CollisionShape = NodePath("../CollisionShape2D")
|
||||||
|
|
||||||
|
[node name="FadeAwayComponent" type="Node" parent="." node_paths=PackedStringArray("Sprite", "Area")]
|
||||||
|
script = ExtResource("3_fadeaway")
|
||||||
|
Sprite = NodePath("../Sprite2D")
|
||||||
|
FadeDuration = 0.5
|
||||||
|
Area = NodePath("..")
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
[gd_scene load_steps=8 format=3 uid="uid://b4eifkc31jsun"]
|
[gd_scene format=3 uid="uid://b4eifkc31jsun"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://c6eoi3ymefc0x" path="res://Autoloads/GameManager.cs" id="1_t2tr6"]
|
[ext_resource type="Script" uid="uid://c6eoi3ymefc0x" path="res://Autoloads/GameManager.cs" id="1_t2tr6"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dwr3avefuwnpy" path="res://scenes/level_tutorial_1.tscn" id="2_7rb6w"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bol7g83v2accs" path="res://scenes/level_village_1.tscn" id="2_bentb"]
|
[ext_resource type="PackedScene" uid="uid://bol7g83v2accs" path="res://scenes/level_village_1.tscn" id="2_bentb"]
|
||||||
[ext_resource type="PackedScene" uid="uid://chqb11pfoqmeb" path="res://scenes/level_village_2.tscn" id="3_ajlkg"]
|
[ext_resource type="PackedScene" uid="uid://chqb11pfoqmeb" path="res://scenes/level_village_2.tscn" id="3_ajlkg"]
|
||||||
[ext_resource type="PackedScene" uid="uid://h60obxmju6mo" path="res://scenes/level_village_3.tscn" id="4_se5tb"]
|
[ext_resource type="PackedScene" uid="uid://h60obxmju6mo" path="res://scenes/level_village_3.tscn" id="4_se5tb"]
|
||||||
@@ -8,9 +9,9 @@
|
|||||||
[ext_resource type="PackedScene" uid="uid://bbwef3n2gjkt8" path="res://scenes/level_village_5.tscn" id="6_7rb6w"]
|
[ext_resource type="PackedScene" uid="uid://bbwef3n2gjkt8" path="res://scenes/level_village_5.tscn" id="6_7rb6w"]
|
||||||
[ext_resource type="Script" uid="uid://chrhjch4ymfvr" path="res://scripts/Screenshot.cs" id="6_bbtu1"]
|
[ext_resource type="Script" uid="uid://chrhjch4ymfvr" path="res://scripts/Screenshot.cs" id="6_bbtu1"]
|
||||||
|
|
||||||
[node name="GameManager" type="Node"]
|
[node name="GameManager" type="Node" unique_id=2076336659]
|
||||||
script = ExtResource("1_t2tr6")
|
script = ExtResource("1_t2tr6")
|
||||||
LevelScenes = Array[PackedScene]([ExtResource("2_bentb"), ExtResource("3_ajlkg"), ExtResource("4_se5tb"), ExtResource("5_mnosh"), ExtResource("6_7rb6w")])
|
LevelScenes = Array[PackedScene]([ExtResource("2_7rb6w"), ExtResource("2_bentb"), ExtResource("3_ajlkg"), ExtResource("4_se5tb"), ExtResource("5_mnosh"), ExtResource("6_7rb6w")])
|
||||||
|
|
||||||
[node name="Screenshot" type="Node" parent="."]
|
[node name="Screenshot" type="Node" parent="." unique_id=812485936]
|
||||||
script = ExtResource("6_bbtu1")
|
script = ExtResource("6_bbtu1")
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=2 format=3 uid="uid://dtxkjif7prm70"]
|
[gd_scene load_steps=2 format=3 uid="uid://bimyb8suadq3u"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://dl7vthhurirwc" path="res://scripts/components/XRayVisionSkillComponent.cs" id="1_ebn6n"]
|
[ext_resource type="Script" uid="uid://dl7vthhurirwc" path="res://scripts/components/XRayVisionSkillComponent.cs" id="1_ebn6n"]
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=13 format=3 uid="uid://bi6v7u17vg1ww"]
|
[gd_scene load_steps=12 format=3 uid="uid://bi6v7u17vg1ww"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://dru77vj07e18s" path="res://Autoloads/SkillManager.cs" id="1_31033"]
|
[ext_resource type="Script" uid="uid://dru77vj07e18s" path="res://Autoloads/SkillManager.cs" id="1_31033"]
|
||||||
[ext_resource type="Script" uid="uid://d4crrfmbgxnqf" path="res://scripts/Resources/SkillData.cs" id="2_87da4"]
|
[ext_resource type="Script" uid="uid://d4crrfmbgxnqf" path="res://scripts/Resources/SkillData.cs" id="2_87da4"]
|
||||||
@@ -6,13 +6,12 @@
|
|||||||
[ext_resource type="Resource" uid="uid://cdp8sex36vdq2" path="res://resources/skills/explosive_brick.tres" id="4_53vnv"]
|
[ext_resource type="Resource" uid="uid://cdp8sex36vdq2" path="res://resources/skills/explosive_brick.tres" id="4_53vnv"]
|
||||||
[ext_resource type="Resource" uid="uid://cr5lo4h8wm0jc" path="res://resources/skills/fire_brick.tres" id="5_77gav"]
|
[ext_resource type="Resource" uid="uid://cr5lo4h8wm0jc" path="res://resources/skills/fire_brick.tres" id="5_77gav"]
|
||||||
[ext_resource type="Resource" uid="uid://ceakv6oqob6m7" path="res://resources/skills/ice_brick.tres" id="6_gib8v"]
|
[ext_resource type="Resource" uid="uid://ceakv6oqob6m7" path="res://resources/skills/ice_brick.tres" id="6_gib8v"]
|
||||||
[ext_resource type="Resource" uid="uid://d3bjre2etov1n" path="res://resources/skills/magnetic.tres" id="7_6wy8o"]
|
|
||||||
[ext_resource type="Resource" uid="uid://bxsgq8703qx4u" path="res://resources/skills/double_jump.tres" id="8_87da4"]
|
[ext_resource type="Resource" uid="uid://bxsgq8703qx4u" path="res://resources/skills/double_jump.tres" id="8_87da4"]
|
||||||
[ext_resource type="Resource" uid="uid://cseilsspimw1n" path="res://resources/skills/ground_pound_skill.tres" id="9_77gav"]
|
[ext_resource type="Resource" uid="uid://cseilsspimw1n" path="res://resources/skills/ground_pound_skill.tres" id="9_77gav"]
|
||||||
[ext_resource type="Resource" uid="uid://c5dj06l86winx" path="res://resources/skills/xray_vision.tres" id="10_gib8v"]
|
[ext_resource type="Resource" uid="uid://d3bjre2etov1n" path="res://resources/skills/magnetic.tres" id="10_gib8v"]
|
||||||
[ext_resource type="Resource" uid="uid://d12defdtmlk0u" path="res://resources/skills/brick_shield.tres" id="11_6wy8o"]
|
[ext_resource type="Resource" uid="uid://d12defdtmlk0u" path="res://resources/skills/brick_shield.tres" id="11_6wy8o"]
|
||||||
[ext_resource type="Resource" uid="uid://dghnl301o1aiy" path="res://resources/skills/brick_armor.tres" id="12_gib8v"]
|
[ext_resource type="Resource" uid="uid://dghnl301o1aiy" path="res://resources/skills/brick_armor.tres" id="12_gib8v"]
|
||||||
|
|
||||||
[node name="SkillManager" type="Node"]
|
[node name="SkillManager" type="Node"]
|
||||||
script = ExtResource("1_31033")
|
script = ExtResource("1_31033")
|
||||||
AvailableSkills = Array[ExtResource("2_87da4")]([ExtResource("3_shjvi"), ExtResource("4_53vnv"), ExtResource("5_77gav"), ExtResource("6_gib8v"), ExtResource("7_6wy8o"), ExtResource("8_87da4"), ExtResource("9_77gav"), ExtResource("10_gib8v"), ExtResource("11_6wy8o"), ExtResource("12_gib8v")])
|
AvailableSkills = Array[ExtResource("2_87da4")]([ExtResource("3_shjvi"), ExtResource("4_53vnv"), ExtResource("5_77gav"), ExtResource("6_gib8v"), ExtResource("10_gib8v"), ExtResource("8_87da4"), ExtResource("9_77gav"), ExtResource("11_6wy8o"), ExtResource("12_gib8v")])
|
||||||
|
|||||||
@@ -8,6 +8,10 @@
|
|||||||
|
|
||||||
config_version=5
|
config_version=5
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
|
||||||
|
compatibility/default_parent_skeleton_in_mesh_instance_3d=true
|
||||||
|
|
||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="Mr. Brick Adventures"
|
config/name="Mr. Brick Adventures"
|
||||||
@@ -19,33 +23,39 @@ config/version="in-dev"
|
|||||||
run/main_scene="uid://cl00e2ocomk3m"
|
run/main_scene="uid://cl00e2ocomk3m"
|
||||||
config/use_custom_user_dir=true
|
config/use_custom_user_dir=true
|
||||||
config/custom_user_dir_name="MrBrickAdventures"
|
config/custom_user_dir_name="MrBrickAdventures"
|
||||||
config/features=PackedStringArray("4.5", "C#", "GL Compatibility")
|
config/features=PackedStringArray("4.6", "C#", "GL Compatibility")
|
||||||
run/max_fps=180
|
run/max_fps=180
|
||||||
boot_splash/bg_color=Color(0, 0, 0, 1)
|
boot_splash/bg_color=Color(0, 0, 0, 1)
|
||||||
boot_splash/show_image=false
|
boot_splash/show_image=false
|
||||||
boot_splash/fullsize=false
|
boot_splash/stretch_mode=0
|
||||||
boot_splash/use_filter=false
|
boot_splash/use_filter=false
|
||||||
config/icon="uid://jix7wdn0isr3"
|
config/icon="uid://jix7wdn0isr3"
|
||||||
|
|
||||||
[autoload]
|
[autoload]
|
||||||
|
|
||||||
GameManager="*res://objects/game_manager.tscn"
|
|
||||||
PhantomCameraManager="*res://addons/phantom_camera/scripts/managers/phantom_camera_manager.gd"
|
PhantomCameraManager="*res://addons/phantom_camera/scripts/managers/phantom_camera_manager.gd"
|
||||||
AudioController="*res://objects/audio_controller.tscn"
|
AudioController="*res://objects/audio_controller.tscn"
|
||||||
UIManager="*res://Autoloads/UIManager.cs"
|
UIManager="*res://Autoloads/UIManager.cs"
|
||||||
ConfigFileHandler="*res://Autoloads/ConfigFileHandler.cs"
|
ConfigFileHandler="*res://Autoloads/ConfigFileHandler.cs"
|
||||||
SaveSystem="*res://Autoloads/SaveSystem.cs"
|
SaveSystem="*res://Autoloads/SaveSystem.cs"
|
||||||
ConsoleManager="*res://Autoloads/ConsoleManager.cs"
|
ConsoleManager="*res://Autoloads/ConsoleManager.cs"
|
||||||
LimboConsole="*res://addons/limbo_console/limbo_console.gd"
|
LimboConsole="*uid://dyxornv8vwibg"
|
||||||
DialogueManager="*res://addons/dialogue_manager/dialogue_manager.gd"
|
DialogueManager="*res://addons/dialogue_manager/dialogue_manager.gd"
|
||||||
|
EventBus="*res://Autoloads/EventBus.cs"
|
||||||
SteamManager="*res://Autoloads/SteamManager.cs"
|
SteamManager="*res://Autoloads/SteamManager.cs"
|
||||||
AchievementManager="*res://objects/achievement_manager.tscn"
|
AchievementManager="*res://objects/achievement_manager.tscn"
|
||||||
SkillManager="*res://objects/skill_manager.tscn"
|
SkillManager="*res://objects/skill_manager.tscn"
|
||||||
FloatingTextManager="*res://objects/floating_text_manager.tscn"
|
FloatingTextManager="*res://objects/floating_text_manager.tscn"
|
||||||
EventBus="*res://Autoloads/EventBus.cs"
|
|
||||||
StatisticsManager="*res://Autoloads/StatisticsManager.cs"
|
StatisticsManager="*res://Autoloads/StatisticsManager.cs"
|
||||||
SpeedRunManager="res://Autoloads/SpeedRunManager.cs"
|
SpeedRunManager="res://Autoloads/SpeedRunManager.cs"
|
||||||
GhostManager="res://objects/ghost_manager.tscn"
|
GhostManager="res://objects/ghost_manager.tscn"
|
||||||
|
StatisticsEventHandler="*res://scripts/Events/StatisticsEventHandler.cs"
|
||||||
|
CoinStateHandler="*res://scripts/Events/CoinStateHandler.cs"
|
||||||
|
LevelStateHandler="*res://scripts/Events/LevelStateHandler.cs"
|
||||||
|
LivesStateHandler="*res://scripts/Events/LivesStateHandler.cs"
|
||||||
|
SkillCollectHandler="*res://scripts/Events/SkillCollectHandler.cs"
|
||||||
|
GameStateStore="*res://Autoloads/GameStateStore.cs"
|
||||||
|
GameManager="*res://objects/game_manager.tscn"
|
||||||
|
|
||||||
[debug]
|
[debug]
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
[gd_resource type="Resource" load_steps=2 format=3 uid="uid://bsnr5v2b2mfsl"]
|
[gd_resource type="Resource" format=3 uid="uid://bsnr5v2b2mfsl"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://gptsgaw3agkf" path="res://scripts/Resources/CollectableResource.cs" id="1_wfbgp"]
|
[ext_resource type="Script" uid="uid://gptsgaw3agkf" path="res://scripts/Resources/CollectableResource.cs" id="1_wfbgp"]
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("1_wfbgp")
|
script = ExtResource("1_wfbgp")
|
||||||
Amount = 5.0
|
Amount = 5.0
|
||||||
Type = 0
|
Type = 1
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
[gd_resource type="Resource" load_steps=2 format=3 uid="uid://b6xqotmke54x"]
|
[gd_resource type="Resource" format=3 uid="uid://b6xqotmke54x"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://gptsgaw3agkf" path="res://scripts/Resources/CollectableResource.cs" id="1_5mosu"]
|
[ext_resource type="Script" uid="uid://gptsgaw3agkf" path="res://scripts/Resources/CollectableResource.cs" id="1_5mosu"]
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("1_5mosu")
|
script = ExtResource("1_5mosu")
|
||||||
Amount = 50.0
|
Amount = 50.0
|
||||||
Type = 0
|
Type = 1
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
[gd_resource type="Resource" load_steps=2 format=3 uid="uid://b6apusc0jmi3x"]
|
[gd_resource type="Resource" format=3 uid="uid://b6apusc0jmi3x"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://gptsgaw3agkf" path="res://scripts/Resources/CollectableResource.cs" id="1_d8txc"]
|
[ext_resource type="Script" uid="uid://gptsgaw3agkf" path="res://scripts/Resources/CollectableResource.cs" id="1_d8txc"]
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("1_d8txc")
|
script = ExtResource("1_d8txc")
|
||||||
Amount = 1.0
|
Amount = 1.0
|
||||||
Type = 1
|
Type = 2
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
[gd_resource type="Resource" load_steps=2 format=3 uid="uid://vql535ckoeqm"]
|
[gd_resource type="Resource" format=3 uid="uid://vql535ckoeqm"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://gptsgaw3agkf" path="res://scripts/Resources/CollectableResource.cs" id="1_7pquc"]
|
[ext_resource type="Script" uid="uid://gptsgaw3agkf" path="res://scripts/Resources/CollectableResource.cs" id="1_7pquc"]
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("1_7pquc")
|
script = ExtResource("1_7pquc")
|
||||||
Amount = 1.0
|
Amount = 1.0
|
||||||
Type = 0
|
Type = 1
|
||||||
|
|||||||
9
resources/collectables/double_jump_pickup.tres
Normal file
9
resources/collectables/double_jump_pickup.tres
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
[gd_resource type="Resource" format=3 uid="uid://dfyp1n4p52ydm"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://gptsgaw3agkf" path="res://scripts/Resources/CollectableResource.cs" id="1_script"]
|
||||||
|
[ext_resource type="Resource" uid="uid://bxsgq8703qx4u" path="res://resources/skills/double_jump.tres" id="2_skill"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("1_script")
|
||||||
|
Type = 4
|
||||||
|
Skill = ExtResource("2_skill")
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
[gd_resource type="Resource" load_steps=2 format=3 uid="uid://2tl3yoh202no"]
|
[gd_resource type="Resource" format=3 uid="uid://2tl3yoh202no"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://gptsgaw3agkf" path="res://scripts/Resources/CollectableResource.cs" id="1_brkhb"]
|
[ext_resource type="Script" uid="uid://gptsgaw3agkf" path="res://scripts/Resources/CollectableResource.cs" id="1_brkhb"]
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("1_brkhb")
|
script = ExtResource("1_brkhb")
|
||||||
Amount = 0.25
|
Amount = 0.25
|
||||||
Type = 2
|
Type = 3
|
||||||
metadata/_custom_type_script = "uid://cb5f0mx0hrt3b"
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
[gd_resource type="Resource" load_steps=2 format=3 uid="uid://bws2xldndlre1"]
|
[gd_resource type="Resource" format=3 uid="uid://bws2xldndlre1"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://gptsgaw3agkf" path="res://scripts/Resources/CollectableResource.cs" id="1_clntw"]
|
[ext_resource type="Script" uid="uid://gptsgaw3agkf" path="res://scripts/Resources/CollectableResource.cs" id="1_clntw"]
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("1_clntw")
|
script = ExtResource("1_clntw")
|
||||||
Amount = 50.0
|
Amount = 50.0
|
||||||
Type = 0
|
Type = 1
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_resource type="Resource" script_class="SkillData" load_steps=5 format=3 uid="uid://dghnl301o1aiy"]
|
[gd_resource type="Resource" script_class="SkillData" format=3 uid="uid://dghnl301o1aiy"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://cdeh7wfc62fr4" path="res://objects/player_skills/brick_armor_skill_component.tscn" id="1_aqcna"]
|
[ext_resource type="PackedScene" uid="uid://cdeh7wfc62fr4" path="res://objects/player_skills/brick_armor_skill_component.tscn" id="1_aqcna"]
|
||||||
[ext_resource type="Script" uid="uid://d4crrfmbgxnqf" path="res://scripts/Resources/SkillData.cs" id="1_unqwr"]
|
[ext_resource type="Script" uid="uid://d4crrfmbgxnqf" path="res://scripts/Resources/SkillData.cs" id="1_unqwr"]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_resource type="Resource" script_class="SkillData" load_steps=6 format=3 uid="uid://d12defdtmlk0u"]
|
[gd_resource type="Resource" script_class="SkillData" format=3 uid="uid://d12defdtmlk0u"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://d4crrfmbgxnqf" path="res://scripts/Resources/SkillData.cs" id="1_m360g"]
|
[ext_resource type="Script" uid="uid://d4crrfmbgxnqf" path="res://scripts/Resources/SkillData.cs" id="1_m360g"]
|
||||||
[ext_resource type="PackedScene" uid="uid://blwk5qduvdnxv" path="res://objects/player_skills/brick_shield_skill_component.tscn" id="1_xjknp"]
|
[ext_resource type="PackedScene" uid="uid://blwk5qduvdnxv" path="res://objects/player_skills/brick_shield_skill_component.tscn" id="1_xjknp"]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_resource type="Resource" script_class="SkillData" load_steps=5 format=3 uid="uid://bxsgq8703qx4u"]
|
[gd_resource type="Resource" script_class="SkillData" format=3 uid="uid://bxsgq8703qx4u"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://d4crrfmbgxnqf" path="res://scripts/Resources/SkillData.cs" id="1_p5qvt"]
|
[ext_resource type="Script" uid="uid://d4crrfmbgxnqf" path="res://scripts/Resources/SkillData.cs" id="1_p5qvt"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dwaxbojb44a6l" path="res://objects/player_skills/double_jump_skill.tscn" id="1_t7o84"]
|
[ext_resource type="PackedScene" uid="uid://dwaxbojb44a6l" path="res://objects/player_skills/double_jump_skill.tscn" id="1_t7o84"]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_resource type="Resource" script_class="SkillData" load_steps=5 format=3 uid="uid://cseilsspimw1n"]
|
[gd_resource type="Resource" script_class="SkillData" format=3 uid="uid://cseilsspimw1n"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://lu3wvpqefekn" path="res://objects/player_skills/ground_pound_skill_component.tscn" id="1_auljr"]
|
[ext_resource type="PackedScene" uid="uid://lu3wvpqefekn" path="res://objects/player_skills/ground_pound_skill_component.tscn" id="1_auljr"]
|
||||||
[ext_resource type="Script" uid="uid://d4crrfmbgxnqf" path="res://scripts/Resources/SkillData.cs" id="1_i1qac"]
|
[ext_resource type="Script" uid="uid://d4crrfmbgxnqf" path="res://scripts/Resources/SkillData.cs" id="1_i1qac"]
|
||||||
|
|||||||
8
resources/skills/wall_jump.tres
Normal file
8
resources/skills/wall_jump.tres
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
[gd_resource type="Resource" script_class="SkillData" format=3 uid="uid://mwqffpqncwxo"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://dwb0e05pewcsn" path="res://scripts/Resources/SkillUpgrade.cs" id="1_vptvl"]
|
||||||
|
[ext_resource type="Script" uid="uid://d4crrfmbgxnqf" path="res://scripts/Resources/SkillData.cs" id="2_rw7jf"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("2_rw7jf")
|
||||||
|
metadata/_custom_type_script = "uid://d4crrfmbgxnqf"
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
[gd_resource type="Resource" script_class="SkillData" load_steps=6 format=3 uid="uid://c5dj06l86winx"]
|
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://dtxkjif7prm70" path="res://objects/player_skills/x_ray_vision_skill_component.tscn" id="1_ax2d8"]
|
|
||||||
[ext_resource type="Script" uid="uid://d4crrfmbgxnqf" path="res://scripts/Resources/SkillData.cs" id="1_g8qe3"]
|
|
||||||
[ext_resource type="Script" uid="uid://dwb0e05pewcsn" path="res://scripts/Resources/SkillUpgrade.cs" id="2_o726x"]
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_72ltj"]
|
|
||||||
script = ExtResource("2_o726x")
|
|
||||||
Cost = 200
|
|
||||||
Description = ""
|
|
||||||
Properties = Dictionary[String, Variant]({
|
|
||||||
"duration": 5.0
|
|
||||||
})
|
|
||||||
metadata/_custom_type_script = "uid://dwb0e05pewcsn"
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_2kdfi"]
|
|
||||||
script = ExtResource("2_o726x")
|
|
||||||
Cost = 275
|
|
||||||
Description = ""
|
|
||||||
Properties = Dictionary[String, Variant]({
|
|
||||||
"duration": 10.0
|
|
||||||
})
|
|
||||||
metadata/_custom_type_script = "uid://dwb0e05pewcsn"
|
|
||||||
|
|
||||||
[resource]
|
|
||||||
script = ExtResource("1_g8qe3")
|
|
||||||
Name = "XRAY_VISION"
|
|
||||||
Description = "XRAY_VISION_DESCRIPTION"
|
|
||||||
Node = ExtResource("1_ax2d8")
|
|
||||||
Upgrades = Array[ExtResource("2_o726x")]([SubResource("Resource_72ltj"), SubResource("Resource_2kdfi")])
|
|
||||||
metadata/_custom_type_script = "uid://d4crrfmbgxnqf"
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_resource type="TileSet" load_steps=3 format=3 uid="uid://dua4ns4tdknd1"]
|
[gd_resource type="TileSet" format=3 uid="uid://dua4ns4tdknd1"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://cysarpu6snb2y" path="res://sprites/ppc-tileset.png" id="4_ffexy"]
|
[ext_resource type="Texture2D" uid="uid://cysarpu6snb2y" path="res://sprites/ppc-tileset.png" id="4_ffexy"]
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_resource type="TileSet" load_steps=23 format=3 uid="uid://bc5a20s6kuy8e"]
|
[gd_resource type="TileSet" format=3 uid="uid://bc5a20s6kuy8e"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_ej5iv"]
|
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_ej5iv"]
|
||||||
[ext_resource type="PackedScene" uid="uid://54w4wisfj8v8" path="res://objects/entities/coin.tscn" id="2_31a0q"]
|
[ext_resource type="PackedScene" uid="uid://54w4wisfj8v8" path="res://objects/entities/coin.tscn" id="2_31a0q"]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_resource type="TileSet" load_steps=9 format=3 uid="uid://bbppo0irxdmqy"]
|
[gd_resource type="TileSet" format=3 uid="uid://bbppo0irxdmqy"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_6ec4i"]
|
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_6ec4i"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cw42lvnqxubq2" path="res://sprites/PS_Tileset_10_nes.png" id="2_0dgh6"]
|
[ext_resource type="Texture2D" uid="uid://cw42lvnqxubq2" path="res://sprites/PS_Tileset_10_nes.png" id="2_0dgh6"]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_resource type="TileSet" load_steps=3 format=3 uid="uid://ccffmjebvuoaj"]
|
[gd_resource type="TileSet" format=3 uid="uid://ccffmjebvuoaj"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://dxvevrm15uus1" path="res://sprites/flowers_tileset.png" id="1_6pkiv"]
|
[ext_resource type="Texture2D" uid="uid://dxvevrm15uus1" path="res://sprites/flowers_tileset.png" id="1_6pkiv"]
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_resource type="TileSet" load_steps=11 format=3 uid="uid://cu2sx7qigrqnv"]
|
[gd_resource type="TileSet" format=3 uid="uid://cu2sx7qigrqnv"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://do6m4ry8ss01e" path="res://sprites/PS_Tileset_12_nes.png" id="1_2p3w4"]
|
[ext_resource type="Texture2D" uid="uid://do6m4ry8ss01e" path="res://sprites/PS_Tileset_12_nes.png" id="1_2p3w4"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cw42lvnqxubq2" path="res://sprites/PS_Tileset_10_nes.png" id="2_43n76"]
|
[ext_resource type="Texture2D" uid="uid://cw42lvnqxubq2" path="res://sprites/PS_Tileset_10_nes.png" id="2_43n76"]
|
||||||
@@ -2034,12 +2034,19 @@ texture = ExtResource("4_i332m")
|
|||||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_ixyyn"]
|
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_ixyyn"]
|
||||||
texture = ExtResource("5_q7rhw")
|
texture = ExtResource("5_q7rhw")
|
||||||
1:0/0 = 0
|
1:0/0 = 0
|
||||||
|
1:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
2:0/0 = 0
|
2:0/0 = 0
|
||||||
|
2:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
3:0/0 = 0
|
3:0/0 = 0
|
||||||
|
3:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
6:0/0 = 0
|
6:0/0 = 0
|
||||||
|
6:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
8:0/0 = 0
|
8:0/0 = 0
|
||||||
|
8:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
9:0/0 = 0
|
9:0/0 = 0
|
||||||
|
9:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
10:0/0 = 0
|
10:0/0 = 0
|
||||||
|
10:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
13:0/0 = 0
|
13:0/0 = 0
|
||||||
14:0/0 = 0
|
14:0/0 = 0
|
||||||
15:0/0 = 0
|
15:0/0 = 0
|
||||||
@@ -2074,11 +2081,17 @@ texture = ExtResource("5_q7rhw")
|
|||||||
56:0/0 = 0
|
56:0/0 = 0
|
||||||
57:0/0 = 0
|
57:0/0 = 0
|
||||||
0:1/0 = 0
|
0:1/0 = 0
|
||||||
|
0:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
1:1/0 = 0
|
1:1/0 = 0
|
||||||
|
1:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
2:1/0 = 0
|
2:1/0 = 0
|
||||||
|
2:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
3:1/0 = 0
|
3:1/0 = 0
|
||||||
|
3:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
4:1/0 = 0
|
4:1/0 = 0
|
||||||
|
4:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
6:1/0 = 0
|
6:1/0 = 0
|
||||||
|
6:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
7:1/0 = 0
|
7:1/0 = 0
|
||||||
8:1/0 = 0
|
8:1/0 = 0
|
||||||
9:1/0 = 0
|
9:1/0 = 0
|
||||||
@@ -2128,11 +2141,17 @@ texture = ExtResource("5_q7rhw")
|
|||||||
56:1/0 = 0
|
56:1/0 = 0
|
||||||
57:1/0 = 0
|
57:1/0 = 0
|
||||||
0:2/0 = 0
|
0:2/0 = 0
|
||||||
|
0:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
1:2/0 = 0
|
1:2/0 = 0
|
||||||
|
1:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
2:2/0 = 0
|
2:2/0 = 0
|
||||||
|
2:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
3:2/0 = 0
|
3:2/0 = 0
|
||||||
|
3:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
4:2/0 = 0
|
4:2/0 = 0
|
||||||
|
4:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
6:2/0 = 0
|
6:2/0 = 0
|
||||||
|
6:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
7:2/0 = 0
|
7:2/0 = 0
|
||||||
8:2/0 = 0
|
8:2/0 = 0
|
||||||
9:2/0 = 0
|
9:2/0 = 0
|
||||||
@@ -2175,11 +2194,17 @@ texture = ExtResource("5_q7rhw")
|
|||||||
56:2/0 = 0
|
56:2/0 = 0
|
||||||
57:2/0 = 0
|
57:2/0 = 0
|
||||||
0:3/0 = 0
|
0:3/0 = 0
|
||||||
|
0:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
1:3/0 = 0
|
1:3/0 = 0
|
||||||
|
1:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
2:3/0 = 0
|
2:3/0 = 0
|
||||||
|
2:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
3:3/0 = 0
|
3:3/0 = 0
|
||||||
|
3:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
4:3/0 = 0
|
4:3/0 = 0
|
||||||
|
4:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
6:3/0 = 0
|
6:3/0 = 0
|
||||||
|
6:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
7:3/0 = 0
|
7:3/0 = 0
|
||||||
8:3/0 = 0
|
8:3/0 = 0
|
||||||
9:3/0 = 0
|
9:3/0 = 0
|
||||||
@@ -2229,8 +2254,11 @@ texture = ExtResource("5_q7rhw")
|
|||||||
56:3/0 = 0
|
56:3/0 = 0
|
||||||
57:3/0 = 0
|
57:3/0 = 0
|
||||||
1:4/0 = 0
|
1:4/0 = 0
|
||||||
|
1:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
2:4/0 = 0
|
2:4/0 = 0
|
||||||
|
2:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
3:4/0 = 0
|
3:4/0 = 0
|
||||||
|
3:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
7:4/0 = 0
|
7:4/0 = 0
|
||||||
8:4/0 = 0
|
8:4/0 = 0
|
||||||
9:4/0 = 0
|
9:4/0 = 0
|
||||||
@@ -2404,9 +2432,11 @@ texture = ExtResource("5_q7rhw")
|
|||||||
49:8/0 = 0
|
49:8/0 = 0
|
||||||
50:8/0 = 0
|
50:8/0 = 0
|
||||||
0:9/0 = 0
|
0:9/0 = 0
|
||||||
|
0:9/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
1:9/0 = 0
|
1:9/0 = 0
|
||||||
3:9/0 = 0
|
3:9/0 = 0
|
||||||
4:9/0 = 0
|
4:9/0 = 0
|
||||||
|
4:9/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
7:9/0 = 0
|
7:9/0 = 0
|
||||||
8:9/0 = 0
|
8:9/0 = 0
|
||||||
9:9/0 = 0
|
9:9/0 = 0
|
||||||
@@ -2441,10 +2471,15 @@ texture = ExtResource("5_q7rhw")
|
|||||||
49:9/0 = 0
|
49:9/0 = 0
|
||||||
50:9/0 = 0
|
50:9/0 = 0
|
||||||
0:10/0 = 0
|
0:10/0 = 0
|
||||||
|
0:10/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
1:10/0 = 0
|
1:10/0 = 0
|
||||||
|
1:10/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
2:10/0 = 0
|
2:10/0 = 0
|
||||||
|
2:10/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
3:10/0 = 0
|
3:10/0 = 0
|
||||||
|
3:10/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
4:10/0 = 0
|
4:10/0 = 0
|
||||||
|
4:10/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
6:10/0 = 0
|
6:10/0 = 0
|
||||||
7:10/0 = 0
|
7:10/0 = 0
|
||||||
8:10/0 = 0
|
8:10/0 = 0
|
||||||
@@ -2483,18 +2518,31 @@ texture = ExtResource("5_q7rhw")
|
|||||||
49:10/0 = 0
|
49:10/0 = 0
|
||||||
50:10/0 = 0
|
50:10/0 = 0
|
||||||
0:11/0 = 0
|
0:11/0 = 0
|
||||||
|
0:11/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
1:11/0 = 0
|
1:11/0 = 0
|
||||||
|
1:11/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
2:11/0 = 0
|
2:11/0 = 0
|
||||||
|
2:11/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
3:11/0 = 0
|
3:11/0 = 0
|
||||||
|
3:11/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
6:11/0 = 0
|
6:11/0 = 0
|
||||||
|
6:11/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
7:11/0 = 0
|
7:11/0 = 0
|
||||||
|
7:11/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
8:11/0 = 0
|
8:11/0 = 0
|
||||||
|
8:11/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
9:11/0 = 0
|
9:11/0 = 0
|
||||||
|
9:11/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
10:11/0 = 0
|
10:11/0 = 0
|
||||||
|
10:11/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
11:11/0 = 0
|
11:11/0 = 0
|
||||||
|
11:11/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
12:11/0 = 0
|
12:11/0 = 0
|
||||||
|
12:11/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
13:11/0 = 0
|
13:11/0 = 0
|
||||||
|
13:11/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
14:11/0 = 0
|
14:11/0 = 0
|
||||||
|
14:11/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
23:11/0 = 0
|
23:11/0 = 0
|
||||||
24:11/0 = 0
|
24:11/0 = 0
|
||||||
25:11/0 = 0
|
25:11/0 = 0
|
||||||
@@ -2518,15 +2566,25 @@ texture = ExtResource("5_q7rhw")
|
|||||||
45:11/0 = 0
|
45:11/0 = 0
|
||||||
46:11/0 = 0
|
46:11/0 = 0
|
||||||
0:12/0 = 0
|
0:12/0 = 0
|
||||||
|
0:12/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
1:12/0 = 0
|
1:12/0 = 0
|
||||||
|
1:12/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
2:12/0 = 0
|
2:12/0 = 0
|
||||||
|
2:12/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
3:12/0 = 0
|
3:12/0 = 0
|
||||||
|
3:12/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
4:12/0 = 0
|
4:12/0 = 0
|
||||||
|
4:12/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
5:12/0 = 0
|
5:12/0 = 0
|
||||||
|
5:12/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
6:12/0 = 0
|
6:12/0 = 0
|
||||||
|
6:12/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
7:12/0 = 0
|
7:12/0 = 0
|
||||||
|
7:12/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
8:12/0 = 0
|
8:12/0 = 0
|
||||||
|
8:12/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
9:12/0 = 0
|
9:12/0 = 0
|
||||||
|
9:12/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
17:12/0 = 0
|
17:12/0 = 0
|
||||||
18:12/0 = 0
|
18:12/0 = 0
|
||||||
19:12/0 = 0
|
19:12/0 = 0
|
||||||
@@ -2543,24 +2601,40 @@ texture = ExtResource("5_q7rhw")
|
|||||||
36:12/0 = 0
|
36:12/0 = 0
|
||||||
38:12/0 = 0
|
38:12/0 = 0
|
||||||
0:13/0 = 0
|
0:13/0 = 0
|
||||||
|
0:13/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
1:13/0 = 0
|
1:13/0 = 0
|
||||||
|
1:13/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
2:13/0 = 0
|
2:13/0 = 0
|
||||||
|
2:13/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
3:13/0 = 0
|
3:13/0 = 0
|
||||||
|
3:13/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
4:13/0 = 0
|
4:13/0 = 0
|
||||||
|
4:13/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
5:13/0 = 0
|
5:13/0 = 0
|
||||||
|
5:13/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
6:13/0 = 0
|
6:13/0 = 0
|
||||||
|
6:13/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
7:13/0 = 0
|
7:13/0 = 0
|
||||||
|
7:13/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
8:13/0 = 0
|
8:13/0 = 0
|
||||||
|
8:13/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
9:13/0 = 0
|
9:13/0 = 0
|
||||||
|
9:13/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
17:13/0 = 0
|
17:13/0 = 0
|
||||||
18:13/0 = 0
|
18:13/0 = 0
|
||||||
19:13/0 = 0
|
19:13/0 = 0
|
||||||
20:13/0 = 0
|
20:13/0 = 0
|
||||||
|
20:13/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
21:13/0 = 0
|
21:13/0 = 0
|
||||||
|
21:13/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
22:13/0 = 0
|
22:13/0 = 0
|
||||||
|
22:13/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
23:13/0 = 0
|
23:13/0 = 0
|
||||||
|
23:13/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
24:13/0 = 0
|
24:13/0 = 0
|
||||||
|
24:13/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
25:13/0 = 0
|
25:13/0 = 0
|
||||||
|
25:13/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
26:13/0 = 0
|
26:13/0 = 0
|
||||||
27:13/0 = 0
|
27:13/0 = 0
|
||||||
29:13/0 = 0
|
29:13/0 = 0
|
||||||
@@ -2583,24 +2657,40 @@ texture = ExtResource("5_q7rhw")
|
|||||||
46:13/0 = 0
|
46:13/0 = 0
|
||||||
47:13/0 = 0
|
47:13/0 = 0
|
||||||
0:14/0 = 0
|
0:14/0 = 0
|
||||||
|
0:14/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
1:14/0 = 0
|
1:14/0 = 0
|
||||||
|
1:14/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
2:14/0 = 0
|
2:14/0 = 0
|
||||||
|
2:14/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
3:14/0 = 0
|
3:14/0 = 0
|
||||||
|
3:14/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
4:14/0 = 0
|
4:14/0 = 0
|
||||||
|
4:14/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
5:14/0 = 0
|
5:14/0 = 0
|
||||||
|
5:14/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
6:14/0 = 0
|
6:14/0 = 0
|
||||||
|
6:14/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
7:14/0 = 0
|
7:14/0 = 0
|
||||||
|
7:14/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
8:14/0 = 0
|
8:14/0 = 0
|
||||||
|
8:14/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
9:14/0 = 0
|
9:14/0 = 0
|
||||||
|
9:14/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
10:14/0 = 0
|
10:14/0 = 0
|
||||||
|
10:14/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
17:14/0 = 0
|
17:14/0 = 0
|
||||||
18:14/0 = 0
|
18:14/0 = 0
|
||||||
19:14/0 = 0
|
19:14/0 = 0
|
||||||
20:14/0 = 0
|
20:14/0 = 0
|
||||||
|
20:14/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
21:14/0 = 0
|
21:14/0 = 0
|
||||||
|
21:14/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
22:14/0 = 0
|
22:14/0 = 0
|
||||||
|
22:14/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
23:14/0 = 0
|
23:14/0 = 0
|
||||||
|
23:14/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
25:14/0 = 0
|
25:14/0 = 0
|
||||||
|
25:14/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
26:14/0 = 0
|
26:14/0 = 0
|
||||||
29:14/0 = 0
|
29:14/0 = 0
|
||||||
30:14/0 = 0
|
30:14/0 = 0
|
||||||
@@ -2622,25 +2712,42 @@ texture = ExtResource("5_q7rhw")
|
|||||||
46:14/0 = 0
|
46:14/0 = 0
|
||||||
47:14/0 = 0
|
47:14/0 = 0
|
||||||
0:15/0 = 0
|
0:15/0 = 0
|
||||||
|
0:15/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
1:15/0 = 0
|
1:15/0 = 0
|
||||||
|
1:15/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
2:15/0 = 0
|
2:15/0 = 0
|
||||||
|
2:15/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
3:15/0 = 0
|
3:15/0 = 0
|
||||||
|
3:15/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
4:15/0 = 0
|
4:15/0 = 0
|
||||||
|
4:15/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
5:15/0 = 0
|
5:15/0 = 0
|
||||||
|
5:15/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
6:15/0 = 0
|
6:15/0 = 0
|
||||||
|
6:15/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
7:15/0 = 0
|
7:15/0 = 0
|
||||||
|
7:15/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
8:15/0 = 0
|
8:15/0 = 0
|
||||||
|
8:15/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
9:15/0 = 0
|
9:15/0 = 0
|
||||||
|
9:15/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
10:15/0 = 0
|
10:15/0 = 0
|
||||||
|
10:15/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
17:15/0 = 0
|
17:15/0 = 0
|
||||||
18:15/0 = 0
|
18:15/0 = 0
|
||||||
19:15/0 = 0
|
19:15/0 = 0
|
||||||
20:15/0 = 0
|
20:15/0 = 0
|
||||||
|
20:15/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
21:15/0 = 0
|
21:15/0 = 0
|
||||||
|
21:15/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
22:15/0 = 0
|
22:15/0 = 0
|
||||||
|
22:15/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
23:15/0 = 0
|
23:15/0 = 0
|
||||||
|
23:15/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
24:15/0 = 0
|
24:15/0 = 0
|
||||||
|
24:15/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
25:15/0 = 0
|
25:15/0 = 0
|
||||||
|
25:15/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
26:15/0 = 0
|
26:15/0 = 0
|
||||||
29:15/0 = 0
|
29:15/0 = 0
|
||||||
30:15/0 = 0
|
30:15/0 = 0
|
||||||
@@ -2662,19 +2769,33 @@ texture = ExtResource("5_q7rhw")
|
|||||||
46:15/0 = 0
|
46:15/0 = 0
|
||||||
47:15/0 = 0
|
47:15/0 = 0
|
||||||
4:16/0 = 0
|
4:16/0 = 0
|
||||||
|
4:16/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
5:16/0 = 0
|
5:16/0 = 0
|
||||||
|
5:16/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
6:16/0 = 0
|
6:16/0 = 0
|
||||||
|
6:16/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
7:16/0 = 0
|
7:16/0 = 0
|
||||||
|
7:16/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
8:16/0 = 0
|
8:16/0 = 0
|
||||||
|
8:16/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
17:16/0 = 0
|
17:16/0 = 0
|
||||||
|
17:16/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
18:16/0 = 0
|
18:16/0 = 0
|
||||||
|
18:16/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
19:16/0 = 0
|
19:16/0 = 0
|
||||||
|
19:16/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
20:16/0 = 0
|
20:16/0 = 0
|
||||||
|
20:16/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
21:16/0 = 0
|
21:16/0 = 0
|
||||||
|
21:16/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
22:16/0 = 0
|
22:16/0 = 0
|
||||||
|
22:16/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
23:16/0 = 0
|
23:16/0 = 0
|
||||||
|
23:16/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
24:16/0 = 0
|
24:16/0 = 0
|
||||||
|
24:16/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
25:16/0 = 0
|
25:16/0 = 0
|
||||||
|
25:16/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
26:16/0 = 0
|
26:16/0 = 0
|
||||||
29:16/0 = 0
|
29:16/0 = 0
|
||||||
30:16/0 = 0
|
30:16/0 = 0
|
||||||
@@ -2696,13 +2817,21 @@ texture = ExtResource("5_q7rhw")
|
|||||||
46:16/0 = 0
|
46:16/0 = 0
|
||||||
47:16/0 = 0
|
47:16/0 = 0
|
||||||
17:17/0 = 0
|
17:17/0 = 0
|
||||||
|
17:17/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
19:17/0 = 0
|
19:17/0 = 0
|
||||||
|
19:17/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
20:17/0 = 0
|
20:17/0 = 0
|
||||||
|
20:17/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
21:17/0 = 0
|
21:17/0 = 0
|
||||||
|
21:17/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
22:17/0 = 0
|
22:17/0 = 0
|
||||||
|
22:17/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
23:17/0 = 0
|
23:17/0 = 0
|
||||||
|
23:17/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
24:17/0 = 0
|
24:17/0 = 0
|
||||||
|
24:17/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
25:17/0 = 0
|
25:17/0 = 0
|
||||||
|
25:17/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
29:17/0 = 0
|
29:17/0 = 0
|
||||||
30:17/0 = 0
|
30:17/0 = 0
|
||||||
32:17/0 = 0
|
32:17/0 = 0
|
||||||
@@ -2727,14 +2856,23 @@ texture = ExtResource("5_q7rhw")
|
|||||||
4:18/0 = 0
|
4:18/0 = 0
|
||||||
5:18/0 = 0
|
5:18/0 = 0
|
||||||
17:18/0 = 0
|
17:18/0 = 0
|
||||||
|
17:18/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
18:18/0 = 0
|
18:18/0 = 0
|
||||||
|
18:18/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
19:18/0 = 0
|
19:18/0 = 0
|
||||||
|
19:18/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
20:18/0 = 0
|
20:18/0 = 0
|
||||||
|
20:18/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
21:18/0 = 0
|
21:18/0 = 0
|
||||||
|
21:18/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
22:18/0 = 0
|
22:18/0 = 0
|
||||||
|
22:18/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
23:18/0 = 0
|
23:18/0 = 0
|
||||||
|
23:18/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
24:18/0 = 0
|
24:18/0 = 0
|
||||||
|
24:18/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
25:18/0 = 0
|
25:18/0 = 0
|
||||||
|
25:18/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
27:18/0 = 0
|
27:18/0 = 0
|
||||||
29:18/0 = 0
|
29:18/0 = 0
|
||||||
30:18/0 = 0
|
30:18/0 = 0
|
||||||
@@ -2766,14 +2904,20 @@ texture = ExtResource("5_q7rhw")
|
|||||||
8:19/0 = 0
|
8:19/0 = 0
|
||||||
9:19/0 = 0
|
9:19/0 = 0
|
||||||
17:19/0 = 0
|
17:19/0 = 0
|
||||||
|
17:19/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
18:19/0 = 0
|
18:19/0 = 0
|
||||||
|
18:19/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
19:19/0 = 0
|
19:19/0 = 0
|
||||||
|
19:19/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
20:19/0 = 0
|
20:19/0 = 0
|
||||||
21:19/0 = 0
|
21:19/0 = 0
|
||||||
22:19/0 = 0
|
22:19/0 = 0
|
||||||
23:19/0 = 0
|
23:19/0 = 0
|
||||||
|
23:19/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
24:19/0 = 0
|
24:19/0 = 0
|
||||||
|
24:19/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
25:19/0 = 0
|
25:19/0 = 0
|
||||||
|
25:19/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
26:19/0 = 0
|
26:19/0 = 0
|
||||||
27:19/0 = 0
|
27:19/0 = 0
|
||||||
28:19/0 = 0
|
28:19/0 = 0
|
||||||
@@ -2805,13 +2949,18 @@ texture = ExtResource("5_q7rhw")
|
|||||||
6:20/0 = 0
|
6:20/0 = 0
|
||||||
7:20/0 = 0
|
7:20/0 = 0
|
||||||
17:20/0 = 0
|
17:20/0 = 0
|
||||||
|
17:20/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
18:20/0 = 0
|
18:20/0 = 0
|
||||||
|
18:20/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
19:20/0 = 0
|
19:20/0 = 0
|
||||||
|
19:20/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
20:20/0 = 0
|
20:20/0 = 0
|
||||||
21:20/0 = 0
|
21:20/0 = 0
|
||||||
22:20/0 = 0
|
22:20/0 = 0
|
||||||
23:20/0 = 0
|
23:20/0 = 0
|
||||||
|
23:20/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
25:20/0 = 0
|
25:20/0 = 0
|
||||||
|
25:20/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
26:20/0 = 0
|
26:20/0 = 0
|
||||||
27:20/0 = 0
|
27:20/0 = 0
|
||||||
28:20/0 = 0
|
28:20/0 = 0
|
||||||
@@ -2838,14 +2987,20 @@ texture = ExtResource("5_q7rhw")
|
|||||||
2:21/0 = 0
|
2:21/0 = 0
|
||||||
3:21/0 = 0
|
3:21/0 = 0
|
||||||
17:21/0 = 0
|
17:21/0 = 0
|
||||||
|
17:21/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
18:21/0 = 0
|
18:21/0 = 0
|
||||||
|
18:21/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
19:21/0 = 0
|
19:21/0 = 0
|
||||||
|
19:21/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
20:21/0 = 0
|
20:21/0 = 0
|
||||||
21:21/0 = 0
|
21:21/0 = 0
|
||||||
22:21/0 = 0
|
22:21/0 = 0
|
||||||
23:21/0 = 0
|
23:21/0 = 0
|
||||||
|
23:21/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
24:21/0 = 0
|
24:21/0 = 0
|
||||||
|
24:21/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
25:21/0 = 0
|
25:21/0 = 0
|
||||||
|
25:21/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
26:21/0 = 0
|
26:21/0 = 0
|
||||||
27:21/0 = 0
|
27:21/0 = 0
|
||||||
28:21/0 = 0
|
28:21/0 = 0
|
||||||
@@ -2871,14 +3026,20 @@ texture = ExtResource("5_q7rhw")
|
|||||||
2:22/0 = 0
|
2:22/0 = 0
|
||||||
3:22/0 = 0
|
3:22/0 = 0
|
||||||
17:22/0 = 0
|
17:22/0 = 0
|
||||||
|
17:22/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
18:22/0 = 0
|
18:22/0 = 0
|
||||||
|
18:22/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
19:22/0 = 0
|
19:22/0 = 0
|
||||||
|
19:22/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
20:22/0 = 0
|
20:22/0 = 0
|
||||||
21:22/0 = 0
|
21:22/0 = 0
|
||||||
22:22/0 = 0
|
22:22/0 = 0
|
||||||
23:22/0 = 0
|
23:22/0 = 0
|
||||||
|
23:22/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
24:22/0 = 0
|
24:22/0 = 0
|
||||||
|
24:22/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
25:22/0 = 0
|
25:22/0 = 0
|
||||||
|
25:22/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
26:22/0 = 0
|
26:22/0 = 0
|
||||||
27:22/0 = 0
|
27:22/0 = 0
|
||||||
28:22/0 = 0
|
28:22/0 = 0
|
||||||
@@ -2904,10 +3065,14 @@ texture = ExtResource("5_q7rhw")
|
|||||||
2:23/0 = 0
|
2:23/0 = 0
|
||||||
3:23/0 = 0
|
3:23/0 = 0
|
||||||
17:23/0 = 0
|
17:23/0 = 0
|
||||||
|
17:23/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
19:23/0 = 0
|
19:23/0 = 0
|
||||||
|
19:23/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
22:23/0 = 0
|
22:23/0 = 0
|
||||||
23:23/0 = 0
|
23:23/0 = 0
|
||||||
|
23:23/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
25:23/0 = 0
|
25:23/0 = 0
|
||||||
|
25:23/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
26:23/0 = 0
|
26:23/0 = 0
|
||||||
27:23/0 = 0
|
27:23/0 = 0
|
||||||
28:23/0 = 0
|
28:23/0 = 0
|
||||||
@@ -2930,14 +3095,20 @@ texture = ExtResource("5_q7rhw")
|
|||||||
45:23/0 = 0
|
45:23/0 = 0
|
||||||
47:23/0 = 0
|
47:23/0 = 0
|
||||||
17:24/0 = 0
|
17:24/0 = 0
|
||||||
|
17:24/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
18:24/0 = 0
|
18:24/0 = 0
|
||||||
|
18:24/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
19:24/0 = 0
|
19:24/0 = 0
|
||||||
|
19:24/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
20:24/0 = 0
|
20:24/0 = 0
|
||||||
21:24/0 = 0
|
21:24/0 = 0
|
||||||
22:24/0 = 0
|
22:24/0 = 0
|
||||||
23:24/0 = 0
|
23:24/0 = 0
|
||||||
|
23:24/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
24:24/0 = 0
|
24:24/0 = 0
|
||||||
|
24:24/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
25:24/0 = 0
|
25:24/0 = 0
|
||||||
|
25:24/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
26:24/0 = 0
|
26:24/0 = 0
|
||||||
27:24/0 = 0
|
27:24/0 = 0
|
||||||
28:24/0 = 0
|
28:24/0 = 0
|
||||||
@@ -2961,14 +3132,23 @@ texture = ExtResource("5_q7rhw")
|
|||||||
46:24/0 = 0
|
46:24/0 = 0
|
||||||
47:24/0 = 0
|
47:24/0 = 0
|
||||||
17:25/0 = 0
|
17:25/0 = 0
|
||||||
|
17:25/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
18:25/0 = 0
|
18:25/0 = 0
|
||||||
|
18:25/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
19:25/0 = 0
|
19:25/0 = 0
|
||||||
|
19:25/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
20:25/0 = 0
|
20:25/0 = 0
|
||||||
|
20:25/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
21:25/0 = 0
|
21:25/0 = 0
|
||||||
|
21:25/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
22:25/0 = 0
|
22:25/0 = 0
|
||||||
|
22:25/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
23:25/0 = 0
|
23:25/0 = 0
|
||||||
|
23:25/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
24:25/0 = 0
|
24:25/0 = 0
|
||||||
|
24:25/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
25:25/0 = 0
|
25:25/0 = 0
|
||||||
|
25:25/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
26:25/0 = 0
|
26:25/0 = 0
|
||||||
27:25/0 = 0
|
27:25/0 = 0
|
||||||
28:25/0 = 0
|
28:25/0 = 0
|
||||||
@@ -2992,13 +3172,21 @@ texture = ExtResource("5_q7rhw")
|
|||||||
46:25/0 = 0
|
46:25/0 = 0
|
||||||
47:25/0 = 0
|
47:25/0 = 0
|
||||||
17:26/0 = 0
|
17:26/0 = 0
|
||||||
|
17:26/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
18:26/0 = 0
|
18:26/0 = 0
|
||||||
|
18:26/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
19:26/0 = 0
|
19:26/0 = 0
|
||||||
|
19:26/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
20:26/0 = 0
|
20:26/0 = 0
|
||||||
|
20:26/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
21:26/0 = 0
|
21:26/0 = 0
|
||||||
|
21:26/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
22:26/0 = 0
|
22:26/0 = 0
|
||||||
|
22:26/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
23:26/0 = 0
|
23:26/0 = 0
|
||||||
|
23:26/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
25:26/0 = 0
|
25:26/0 = 0
|
||||||
|
25:26/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
26:26/0 = 0
|
26:26/0 = 0
|
||||||
27:26/0 = 0
|
27:26/0 = 0
|
||||||
28:26/0 = 0
|
28:26/0 = 0
|
||||||
@@ -3022,14 +3210,23 @@ texture = ExtResource("5_q7rhw")
|
|||||||
46:26/0 = 0
|
46:26/0 = 0
|
||||||
47:26/0 = 0
|
47:26/0 = 0
|
||||||
17:27/0 = 0
|
17:27/0 = 0
|
||||||
|
17:27/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
18:27/0 = 0
|
18:27/0 = 0
|
||||||
|
18:27/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
19:27/0 = 0
|
19:27/0 = 0
|
||||||
|
19:27/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
20:27/0 = 0
|
20:27/0 = 0
|
||||||
|
20:27/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
21:27/0 = 0
|
21:27/0 = 0
|
||||||
|
21:27/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
22:27/0 = 0
|
22:27/0 = 0
|
||||||
|
22:27/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
23:27/0 = 0
|
23:27/0 = 0
|
||||||
|
23:27/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
24:27/0 = 0
|
24:27/0 = 0
|
||||||
|
24:27/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
25:27/0 = 0
|
25:27/0 = 0
|
||||||
|
25:27/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
26:27/0 = 0
|
26:27/0 = 0
|
||||||
27:27/0 = 0
|
27:27/0 = 0
|
||||||
28:27/0 = 0
|
28:27/0 = 0
|
||||||
|
|||||||
159
scenes/level_tutorial_1.tscn
Normal file
159
scenes/level_tutorial_1.tscn
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=33 format=4 uid="uid://h60obxmju6mo"]
|
[gd_scene load_steps=34 format=4 uid="uid://h60obxmju6mo"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://dyp4i4ru2j2jh" path="res://objects/fxs/explosion_fx.tscn" id="1_p30ax"]
|
[ext_resource type="PackedScene" uid="uid://dyp4i4ru2j2jh" path="res://objects/fxs/explosion_fx.tscn" id="1_p30ax"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dx80ivlvuuew4" path="res://objects/fxs/fire_fx.tscn" id="2_a7yjf"]
|
[ext_resource type="PackedScene" uid="uid://dx80ivlvuuew4" path="res://objects/fxs/fire_fx.tscn" id="2_a7yjf"]
|
||||||
@@ -23,6 +23,7 @@
|
|||||||
[ext_resource type="PackedScene" uid="uid://bqom4cm7r18db" path="res://objects/entities/killzone.tscn" id="21_p30ax"]
|
[ext_resource type="PackedScene" uid="uid://bqom4cm7r18db" path="res://objects/entities/killzone.tscn" id="21_p30ax"]
|
||||||
[ext_resource type="PackedScene" uid="uid://12jnkdygpxwc" path="res://objects/entities/exit_level.tscn" id="22_a7yjf"]
|
[ext_resource type="PackedScene" uid="uid://12jnkdygpxwc" path="res://objects/entities/exit_level.tscn" id="22_a7yjf"]
|
||||||
[ext_resource type="PackedScene" uid="uid://t6h2ra7kjyq" path="res://objects/entities/small_heal_potion.tscn" id="23_m6h4x"]
|
[ext_resource type="PackedScene" uid="uid://t6h2ra7kjyq" path="res://objects/entities/small_heal_potion.tscn" id="23_m6h4x"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dk2cu8qs7odib" path="res://objects/entities/double_jump_skill_pickup.tscn" id="24_6fdf4"]
|
||||||
|
|
||||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_j7bvy"]
|
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_j7bvy"]
|
||||||
texture = ExtResource("7_uvxky")
|
texture = ExtResource("7_uvxky")
|
||||||
@@ -300,7 +301,7 @@ z_index = 5
|
|||||||
position = Vector2(903, -118)
|
position = Vector2(903, -118)
|
||||||
metadata/_edit_group_ = true
|
metadata/_edit_group_ = true
|
||||||
|
|
||||||
[node name="HitParticles" parent="Brick Player" index="24"]
|
[node name="HitParticles" parent="Brick Player" index="23"]
|
||||||
process_material = SubResource("ParticleProcessMaterial_lgb3u")
|
process_material = SubResource("ParticleProcessMaterial_lgb3u")
|
||||||
|
|
||||||
[node name="Camera2D" parent="." instance=ExtResource("12_qhkyq")]
|
[node name="Camera2D" parent="." instance=ExtResource("12_qhkyq")]
|
||||||
@@ -364,6 +365,9 @@ position = Vector2(1359, -42)
|
|||||||
[node name="Killzone" parent="." instance=ExtResource("21_p30ax")]
|
[node name="Killzone" parent="." instance=ExtResource("21_p30ax")]
|
||||||
position = Vector2(2456, 815)
|
position = Vector2(2456, 815)
|
||||||
|
|
||||||
|
[node name="SkillPickup" parent="." instance=ExtResource("24_6fdf4")]
|
||||||
|
position = Vector2(1136, -109)
|
||||||
|
|
||||||
[connection signal="Death" from="Brick Player/HealthComponent" to="UI Layer/DeathScreen" method="OnPlayerDeath"]
|
[connection signal="Death" from="Brick Player/HealthComponent" to="UI Layer/DeathScreen" method="OnPlayerDeath"]
|
||||||
[connection signal="Death" from="Brick Player/HealthComponent" to="UI Layer/GameOverScreen" method="OnPlayerDeath"]
|
[connection signal="Death" from="Brick Player/HealthComponent" to="UI Layer/GameOverScreen" method="OnPlayerDeath"]
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
123
scenes/level_village_6.tscn
Normal file
123
scenes/level_village_6.tscn
Normal file
File diff suppressed because one or more lines are too long
25
scripts/Constants.cs
Normal file
25
scripts/Constants.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
namespace Mr.BrickAdventures;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constants for autoload paths and other commonly used values.
|
||||||
|
/// </summary>
|
||||||
|
public static class Constants
|
||||||
|
{
|
||||||
|
// Autoload paths
|
||||||
|
public const string EventBusPath = "/root/EventBus";
|
||||||
|
public const string GameManagerPath = "/root/GameManager";
|
||||||
|
public const string GameStateStorePath = "/root/GameStateStore";
|
||||||
|
public const string SaveSystemPath = "/root/SaveSystem";
|
||||||
|
public const string SpeedRunManagerPath = "/root/SpeedRunManager";
|
||||||
|
public const string GhostManagerPath = "/root/GhostManager";
|
||||||
|
public const string AchievementManagerPath = "/root/AchievementManager";
|
||||||
|
public const string StatisticsManagerPath = "/root/StatisticsManager";
|
||||||
|
public const string SkillManagerPath = "/root/SkillManager";
|
||||||
|
public const string FloatingTextManagerPath = "/root/FloatingTextManager";
|
||||||
|
public const string UIManagerPath = "/root/UIManager";
|
||||||
|
public const string ConsoleManagerPath = "/root/ConsoleManager";
|
||||||
|
public const string ConfigFileHandlerPath = "/root/ConfigFileHandler";
|
||||||
|
|
||||||
|
// Group names
|
||||||
|
public const string CoinsGroup = "coins";
|
||||||
|
}
|
||||||
1
scripts/Constants.cs.uid
Normal file
1
scripts/Constants.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://bn7o3n3bomvrd
|
||||||
29
scripts/Events/CoinStateHandler.cs
Normal file
29
scripts/Events/CoinStateHandler.cs
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
using Godot;
|
||||||
|
using Mr.BrickAdventures.Autoloads;
|
||||||
|
|
||||||
|
namespace Mr.BrickAdventures.scripts.Events;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handles coin collection events and updates the GameStateStore.
|
||||||
|
/// Replaces the manual coin logic in GameManager.
|
||||||
|
/// </summary>
|
||||||
|
public partial class CoinStateHandler : Node
|
||||||
|
{
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
EventBus.Instance.CoinCollected += OnCoinCollected;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void _ExitTree()
|
||||||
|
{
|
||||||
|
if (EventBus.Instance != null)
|
||||||
|
{
|
||||||
|
EventBus.Instance.CoinCollected -= OnCoinCollected;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnCoinCollected(int amount, Vector2 position)
|
||||||
|
{
|
||||||
|
GameStateStore.Instance?.AddSessionCoins(amount);
|
||||||
|
}
|
||||||
|
}
|
||||||
1
scripts/Events/CoinStateHandler.cs.uid
Normal file
1
scripts/Events/CoinStateHandler.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://1qg3q53kkh0k
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using Godot;
|
using Godot;
|
||||||
|
using Mr.BrickAdventures;
|
||||||
using Mr.BrickAdventures.Autoloads;
|
using Mr.BrickAdventures.Autoloads;
|
||||||
|
|
||||||
namespace Mr.BrickAdventures.scripts.Events;
|
namespace Mr.BrickAdventures.scripts.Events;
|
||||||
@@ -10,11 +11,10 @@ public partial class GhostEventHandler : Node
|
|||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
_ghostManager = GetNode<GhostManager>("/root/GhostManager");
|
_ghostManager = GetNode<GhostManager>(Constants.GhostManagerPath);
|
||||||
var eventBus = GetNode<EventBus>("/root/EventBus");
|
|
||||||
|
EventBus.Instance.LevelStarted += OnLevelStarted;
|
||||||
eventBus.LevelStarted += OnLevelStarted;
|
EventBus.Instance.LevelCompleted += OnLevelCompleted;
|
||||||
eventBus.LevelCompleted += OnLevelCompleted;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnLevelStarted(int levelIndex, Node currentScene)
|
private void OnLevelStarted(int levelIndex, Node currentScene)
|
||||||
@@ -23,7 +23,7 @@ public partial class GhostEventHandler : Node
|
|||||||
_ghostManager.StartRecording(levelIndex);
|
_ghostManager.StartRecording(levelIndex);
|
||||||
_ghostManager.SpawnGhostPlayer(levelIndex, currentScene);
|
_ghostManager.SpawnGhostPlayer(levelIndex, currentScene);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnLevelCompleted(int levelIndex, Node currentScene, double completionTime)
|
private void OnLevelCompleted(int levelIndex, Node currentScene, double completionTime)
|
||||||
{
|
{
|
||||||
_ghostManager.StopRecording(true, completionTime);
|
_ghostManager.StopRecording(true, completionTime);
|
||||||
|
|||||||
39
scripts/Events/LevelStateHandler.cs
Normal file
39
scripts/Events/LevelStateHandler.cs
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
using Godot;
|
||||||
|
using Mr.BrickAdventures.Autoloads;
|
||||||
|
|
||||||
|
namespace Mr.BrickAdventures.scripts.Events;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handles level completion events and updates GameStateStore.
|
||||||
|
/// </summary>
|
||||||
|
public partial class LevelStateHandler : Node
|
||||||
|
{
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
EventBus.Instance.LevelCompleted += OnLevelCompleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void _ExitTree()
|
||||||
|
{
|
||||||
|
if (EventBus.Instance != null)
|
||||||
|
{
|
||||||
|
EventBus.Instance.LevelCompleted -= OnLevelCompleted;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnLevelCompleted(int levelIndex, Node currentScene, double completionTime)
|
||||||
|
{
|
||||||
|
var store = GameStateStore.Instance;
|
||||||
|
if (store == null) return;
|
||||||
|
|
||||||
|
// Mark level complete and unlock next
|
||||||
|
store.MarkLevelComplete(levelIndex);
|
||||||
|
|
||||||
|
// Commit session data to persistent state
|
||||||
|
store.CommitSessionCoins();
|
||||||
|
store.CommitSessionSkills();
|
||||||
|
|
||||||
|
// Reset session for next level
|
||||||
|
store.ResetSession();
|
||||||
|
}
|
||||||
|
}
|
||||||
1
scripts/Events/LevelStateHandler.cs.uid
Normal file
1
scripts/Events/LevelStateHandler.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://gx5vn7viphv
|
||||||
29
scripts/Events/LivesStateHandler.cs
Normal file
29
scripts/Events/LivesStateHandler.cs
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
using Godot;
|
||||||
|
using Mr.BrickAdventures.Autoloads;
|
||||||
|
|
||||||
|
namespace Mr.BrickAdventures.scripts.Events;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handles player death events and updates lives in GameStateStore.
|
||||||
|
/// </summary>
|
||||||
|
public partial class LivesStateHandler : Node
|
||||||
|
{
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
EventBus.Instance.PlayerDied += OnPlayerDied;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void _ExitTree()
|
||||||
|
{
|
||||||
|
if (EventBus.Instance != null)
|
||||||
|
{
|
||||||
|
EventBus.Instance.PlayerDied -= OnPlayerDied;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnPlayerDied(Vector2 position)
|
||||||
|
{
|
||||||
|
GameStateStore.Instance?.RemoveLife();
|
||||||
|
GameStateStore.Instance?.ResetSession();
|
||||||
|
}
|
||||||
|
}
|
||||||
1
scripts/Events/LivesStateHandler.cs.uid
Normal file
1
scripts/Events/LivesStateHandler.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://b4ocg7g8vmtvp
|
||||||
43
scripts/Events/SkillCollectHandler.cs
Normal file
43
scripts/Events/SkillCollectHandler.cs
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
using Godot;
|
||||||
|
using Mr.BrickAdventures.Autoloads;
|
||||||
|
using Mr.BrickAdventures.scripts.Resources;
|
||||||
|
|
||||||
|
namespace Mr.BrickAdventures.scripts.Events;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handles skill collection events and unlocks skills via GameStateStore.
|
||||||
|
/// Skills are immediately activated but only persisted on level complete.
|
||||||
|
/// </summary>
|
||||||
|
public partial class SkillCollectHandler : Node
|
||||||
|
{
|
||||||
|
private SkillManager _skillManager;
|
||||||
|
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
_skillManager = SkillManager.Instance;
|
||||||
|
EventBus.Instance.SkillCollected += OnSkillCollected;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void _ExitTree()
|
||||||
|
{
|
||||||
|
if (EventBus.Instance != null)
|
||||||
|
{
|
||||||
|
EventBus.Instance.SkillCollected -= OnSkillCollected;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnSkillCollected(SkillData skill, Vector2 position)
|
||||||
|
{
|
||||||
|
if (skill == null) return;
|
||||||
|
|
||||||
|
// Unlock in session (will be committed on level complete, lost on death)
|
||||||
|
GameStateStore.Instance?.UnlockSkillInSession(skill);
|
||||||
|
|
||||||
|
// Immediately activate the skill for the player
|
||||||
|
skill.Level = 1;
|
||||||
|
_skillManager?.AddSkill(skill);
|
||||||
|
|
||||||
|
// Emit skill unlocked event for UI/achievements
|
||||||
|
EventBus.EmitSkillUnlocked(skill.Name, skill.Level);
|
||||||
|
}
|
||||||
|
}
|
||||||
1
scripts/Events/SkillCollectHandler.cs.uid
Normal file
1
scripts/Events/SkillCollectHandler.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://c1po4hjvqbslm
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using Godot;
|
using Godot;
|
||||||
|
using Mr.BrickAdventures;
|
||||||
using Mr.BrickAdventures.Autoloads;
|
using Mr.BrickAdventures.Autoloads;
|
||||||
|
|
||||||
namespace Mr.BrickAdventures.scripts.Events;
|
namespace Mr.BrickAdventures.scripts.Events;
|
||||||
@@ -10,10 +11,9 @@ public partial class SpeedRunEventHandler : Node
|
|||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
_speedRunManager = GetNode<SpeedRunManager>("/root/SpeedRunManager");
|
_speedRunManager = GetNode<SpeedRunManager>(Constants.SpeedRunManagerPath);
|
||||||
var eventBus = GetNode<EventBus>("/root/EventBus");
|
|
||||||
|
EventBus.Instance.LevelCompleted += OnLevelCompleted;
|
||||||
eventBus.LevelCompleted += OnLevelCompleted;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnLevelCompleted(int levelIndex, Node currentScene, double completionTime)
|
private void OnLevelCompleted(int levelIndex, Node currentScene, double completionTime)
|
||||||
|
|||||||
62
scripts/Events/StatisticsEventHandler.cs
Normal file
62
scripts/Events/StatisticsEventHandler.cs
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
using Godot;
|
||||||
|
using Mr.BrickAdventures;
|
||||||
|
using Mr.BrickAdventures.Autoloads;
|
||||||
|
|
||||||
|
namespace Mr.BrickAdventures.scripts.Events;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handles game events and updates statistics accordingly.
|
||||||
|
/// Listens to EventBus signals and increments relevant stats.
|
||||||
|
/// </summary>
|
||||||
|
public partial class StatisticsEventHandler : Node
|
||||||
|
{
|
||||||
|
private StatisticsManager _statisticsManager;
|
||||||
|
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
_statisticsManager = GetNode<StatisticsManager>(Constants.StatisticsManagerPath);
|
||||||
|
|
||||||
|
// Subscribe to events
|
||||||
|
EventBus.Instance.CoinCollected += OnCoinCollected;
|
||||||
|
EventBus.Instance.EnemyDefeated += OnEnemyDefeated;
|
||||||
|
EventBus.Instance.PlayerDied += OnPlayerDied;
|
||||||
|
EventBus.Instance.LevelCompleted += OnLevelCompleted;
|
||||||
|
EventBus.Instance.ChildRescued += OnChildRescued;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void _ExitTree()
|
||||||
|
{
|
||||||
|
if (EventBus.Instance == null) return;
|
||||||
|
|
||||||
|
EventBus.Instance.CoinCollected -= OnCoinCollected;
|
||||||
|
EventBus.Instance.EnemyDefeated -= OnEnemyDefeated;
|
||||||
|
EventBus.Instance.PlayerDied -= OnPlayerDied;
|
||||||
|
EventBus.Instance.LevelCompleted -= OnLevelCompleted;
|
||||||
|
EventBus.Instance.ChildRescued -= OnChildRescued;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnCoinCollected(int amount, Vector2 position)
|
||||||
|
{
|
||||||
|
_statisticsManager.IncrementStat("coins_collected", amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnEnemyDefeated(Node enemy, Vector2 position)
|
||||||
|
{
|
||||||
|
_statisticsManager.IncrementStat("enemies_defeated");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnPlayerDied(Vector2 position)
|
||||||
|
{
|
||||||
|
_statisticsManager.IncrementStat("deaths");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnLevelCompleted(int levelIndex, Node currentScene, double completionTime)
|
||||||
|
{
|
||||||
|
_statisticsManager.IncrementStat("levels_completed");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnChildRescued(Vector2 position)
|
||||||
|
{
|
||||||
|
_statisticsManager.IncrementStat("children_rescued");
|
||||||
|
}
|
||||||
|
}
|
||||||
1
scripts/Events/StatisticsEventHandler.cs.uid
Normal file
1
scripts/Events/StatisticsEventHandler.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://l68tjau3k6bw
|
||||||
@@ -6,4 +6,9 @@ public partial class CollectableResource : Resource
|
|||||||
{
|
{
|
||||||
[Export] public float Amount { get; set; } = 0.0f;
|
[Export] public float Amount { get; set; } = 0.0f;
|
||||||
[Export] public CollectableType Type { get; set; }
|
[Export] public CollectableType Type { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The skill to unlock when collected. Only used when Type is Skill.
|
||||||
|
/// </summary>
|
||||||
|
[Export] public SkillData Skill { get; set; }
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,9 @@ namespace Mr.BrickAdventures.scripts.Resources;
|
|||||||
|
|
||||||
public enum CollectableType
|
public enum CollectableType
|
||||||
{
|
{
|
||||||
|
None, // when no collectable type is specified
|
||||||
Coin,
|
Coin,
|
||||||
Kid,
|
Kid,
|
||||||
Health,
|
Health,
|
||||||
|
Skill,
|
||||||
}
|
}
|
||||||
@@ -10,11 +10,10 @@ public partial class SkillData : Resource
|
|||||||
[Export] public string Name { get; set; } = "New Skill";
|
[Export] public string Name { get; set; } = "New Skill";
|
||||||
[Export] public string Description { get; set; } = "New Skill";
|
[Export] public string Description { get; set; } = "New Skill";
|
||||||
[Export] public Texture2D Icon { get; set; }
|
[Export] public Texture2D Icon { get; set; }
|
||||||
[Export] public bool IsActive { get; set; } = false;
|
|
||||||
[Export] public int Level { get; set; } = 1;
|
[Export] public int Level { get; set; } = 1;
|
||||||
[Export] public SkillType Type { get; set; } = SkillType.Throw;
|
[Export] public SkillType Type { get; set; } = SkillType.Throw;
|
||||||
[Export] public PackedScene Node { get; set; }
|
[Export] public PackedScene Node { get; set; }
|
||||||
[Export] public Array<SkillUpgrade> Upgrades { get; set; } = [];
|
[Export] public Array<SkillUpgrade> Upgrades { get; set; } = [];
|
||||||
|
|
||||||
public int MaxLevel => Upgrades.Count;
|
public int MaxLevel => Upgrades.Count;
|
||||||
}
|
}
|
||||||
73
scripts/State/PlayerState.cs
Normal file
73
scripts/State/PlayerState.cs
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Mr.BrickAdventures.scripts.Resources;
|
||||||
|
|
||||||
|
namespace Mr.BrickAdventures.scripts.State;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Persistent player data that survives across sessions.
|
||||||
|
/// This is a POCO (Plain Old C# Object) for predictable state management.
|
||||||
|
/// </summary>
|
||||||
|
public class PlayerState
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Saved coins (not including current session).
|
||||||
|
/// </summary>
|
||||||
|
public int Coins { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Remaining lives.
|
||||||
|
/// </summary>
|
||||||
|
public int Lives { get; set; } = 3;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indices of completed levels.
|
||||||
|
/// </summary>
|
||||||
|
public List<int> CompletedLevels { get; set; } = new();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indices of levels the player can access.
|
||||||
|
/// </summary>
|
||||||
|
public List<int> UnlockedLevels { get; set; } = new() { 0 };
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Skills the player has permanently unlocked.
|
||||||
|
/// </summary>
|
||||||
|
public List<SkillData> UnlockedSkills { get; set; } = new();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Statistics dictionary for tracking game stats.
|
||||||
|
/// </summary>
|
||||||
|
public Dictionary<string, int> Statistics { get; set; } = new();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// IDs of unlocked achievements.
|
||||||
|
/// </summary>
|
||||||
|
public List<string> UnlockedAchievements { get; set; } = new();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a fresh default player state.
|
||||||
|
/// </summary>
|
||||||
|
public static PlayerState CreateDefault() => new()
|
||||||
|
{
|
||||||
|
Coins = 0,
|
||||||
|
Lives = 3,
|
||||||
|
CompletedLevels = new List<int>(),
|
||||||
|
UnlockedLevels = new List<int> { 0 },
|
||||||
|
UnlockedSkills = new List<SkillData>(),
|
||||||
|
Statistics = new Dictionary<string, int>()
|
||||||
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resets this state to default values.
|
||||||
|
/// </summary>
|
||||||
|
public void Reset()
|
||||||
|
{
|
||||||
|
Coins = 0;
|
||||||
|
Lives = 3;
|
||||||
|
CompletedLevels.Clear();
|
||||||
|
UnlockedLevels.Clear();
|
||||||
|
UnlockedLevels.Add(0);
|
||||||
|
UnlockedSkills.Clear();
|
||||||
|
Statistics.Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
1
scripts/State/PlayerState.cs.uid
Normal file
1
scripts/State/PlayerState.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://gtr1e60jq7iv
|
||||||
55
scripts/State/SessionState.cs
Normal file
55
scripts/State/SessionState.cs
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Mr.BrickAdventures.scripts.Resources;
|
||||||
|
|
||||||
|
namespace Mr.BrickAdventures.scripts.State;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Data for the current gameplay session.
|
||||||
|
/// Reset when player dies or completes a level.
|
||||||
|
/// </summary>
|
||||||
|
public class SessionState
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Current level index being played.
|
||||||
|
/// </summary>
|
||||||
|
public int CurrentLevel { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Coins collected during this session (not yet saved).
|
||||||
|
/// </summary>
|
||||||
|
public int CoinsCollected { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Skills unlocked during this session (not yet saved).
|
||||||
|
/// </summary>
|
||||||
|
public List<SkillData> SkillsUnlocked { get; set; } = new();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a fresh session state.
|
||||||
|
/// </summary>
|
||||||
|
public static SessionState CreateDefault() => new()
|
||||||
|
{
|
||||||
|
CurrentLevel = 0,
|
||||||
|
CoinsCollected = 0,
|
||||||
|
SkillsUnlocked = new List<SkillData>()
|
||||||
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resets session state to defaults.
|
||||||
|
/// </summary>
|
||||||
|
public void Reset()
|
||||||
|
{
|
||||||
|
CoinsCollected = 0;
|
||||||
|
SkillsUnlocked.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resets completely including level.
|
||||||
|
/// </summary>
|
||||||
|
public void ResetAll()
|
||||||
|
{
|
||||||
|
CurrentLevel = 0;
|
||||||
|
CoinsCollected = 0;
|
||||||
|
SkillsUnlocked.Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
1
scripts/State/SessionState.cs.uid
Normal file
1
scripts/State/SessionState.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://chqsdleqrnl7b
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using Godot;
|
using Godot;
|
||||||
|
using Mr.BrickAdventures;
|
||||||
using Mr.BrickAdventures.Autoloads;
|
using Mr.BrickAdventures.Autoloads;
|
||||||
|
|
||||||
namespace Mr.BrickAdventures.scripts.UI;
|
namespace Mr.BrickAdventures.scripts.UI;
|
||||||
@@ -10,19 +11,19 @@ public partial class AudioSettings : Control
|
|||||||
[Export] public Slider SfxVolumeSlider { get; set; }
|
[Export] public Slider SfxVolumeSlider { get; set; }
|
||||||
[Export] public Control AudioSettingsControl { get; set; }
|
[Export] public Control AudioSettingsControl { get; set; }
|
||||||
[Export] public float MuteThreshold { get; set; } = -20f;
|
[Export] public float MuteThreshold { get; set; } = -20f;
|
||||||
|
|
||||||
private UIManager _uiManager;
|
private UIManager _uiManager;
|
||||||
private ConfigFileHandler _configFileHandler;
|
private ConfigFileHandler _configFileHandler;
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
_uiManager = GetNode<UIManager>("/root/UIManager");
|
_uiManager = GetNode<UIManager>(Constants.UIManagerPath);
|
||||||
_configFileHandler = GetNode<ConfigFileHandler>("/root/ConfigFileHandler");
|
_configFileHandler = GetNode<ConfigFileHandler>(Constants.ConfigFileHandlerPath);
|
||||||
Initialize();
|
Initialize();
|
||||||
MasterVolumeSlider.ValueChanged += OnMasterVolumeChanged;
|
MasterVolumeSlider.ValueChanged += OnMasterVolumeChanged;
|
||||||
MusicVolumeSlider.ValueChanged += OnMusicVolumeChanged;
|
MusicVolumeSlider.ValueChanged += OnMusicVolumeChanged;
|
||||||
SfxVolumeSlider.ValueChanged += OnSfxVolumeChanged;
|
SfxVolumeSlider.ValueChanged += OnSfxVolumeChanged;
|
||||||
|
|
||||||
LoadSettings();
|
LoadSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,7 +36,7 @@ public partial class AudioSettings : Control
|
|||||||
{
|
{
|
||||||
if (!@event.IsActionReleased("ui_cancel")) return;
|
if (!@event.IsActionReleased("ui_cancel")) return;
|
||||||
if (!_uiManager.IsScreenOnTop(AudioSettingsControl)) return;
|
if (!_uiManager.IsScreenOnTop(AudioSettingsControl)) return;
|
||||||
|
|
||||||
SaveSettings();
|
SaveSettings();
|
||||||
_uiManager.PopScreen();
|
_uiManager.PopScreen();
|
||||||
}
|
}
|
||||||
@@ -64,12 +65,12 @@ public partial class AudioSettings : Control
|
|||||||
MasterVolumeSlider.Value = volumeDb;
|
MasterVolumeSlider.Value = volumeDb;
|
||||||
MasterVolumeSlider.MinValue = MuteThreshold;
|
MasterVolumeSlider.MinValue = MuteThreshold;
|
||||||
MasterVolumeSlider.MaxValue = 0f;
|
MasterVolumeSlider.MaxValue = 0f;
|
||||||
|
|
||||||
var musicVolumeDb = AudioServer.GetBusVolumeDb(AudioServer.GetBusIndex("music"));
|
var musicVolumeDb = AudioServer.GetBusVolumeDb(AudioServer.GetBusIndex("music"));
|
||||||
MusicVolumeSlider.Value = musicVolumeDb;
|
MusicVolumeSlider.Value = musicVolumeDb;
|
||||||
MusicVolumeSlider.MinValue = MuteThreshold;
|
MusicVolumeSlider.MinValue = MuteThreshold;
|
||||||
MusicVolumeSlider.MaxValue = 0f;
|
MusicVolumeSlider.MaxValue = 0f;
|
||||||
|
|
||||||
var sfxVolumeDb = AudioServer.GetBusVolumeDb(AudioServer.GetBusIndex("sfx"));
|
var sfxVolumeDb = AudioServer.GetBusVolumeDb(AudioServer.GetBusIndex("sfx"));
|
||||||
SfxVolumeSlider.Value = sfxVolumeDb;
|
SfxVolumeSlider.Value = sfxVolumeDb;
|
||||||
SfxVolumeSlider.MinValue = MuteThreshold;
|
SfxVolumeSlider.MinValue = MuteThreshold;
|
||||||
@@ -95,12 +96,12 @@ public partial class AudioSettings : Control
|
|||||||
{
|
{
|
||||||
var settingsConfig = _configFileHandler.SettingsConfig;
|
var settingsConfig = _configFileHandler.SettingsConfig;
|
||||||
if (!settingsConfig.HasSection("audio_settings")) return;
|
if (!settingsConfig.HasSection("audio_settings")) return;
|
||||||
|
|
||||||
var masterVolume = (float)settingsConfig.GetValue("audio_settings", "master_volume", MasterVolumeSlider.Value);
|
var masterVolume = (float)settingsConfig.GetValue("audio_settings", "master_volume", MasterVolumeSlider.Value);
|
||||||
var musicVolume = (float)settingsConfig.GetValue("audio_settings", "music_volume", MusicVolumeSlider.Value);
|
var musicVolume = (float)settingsConfig.GetValue("audio_settings", "music_volume", MusicVolumeSlider.Value);
|
||||||
var sfxVolume = (float)settingsConfig.GetValue("audio_settings", "sfx_volume", SfxVolumeSlider.Value);
|
var sfxVolume = (float)settingsConfig.GetValue("audio_settings", "sfx_volume", SfxVolumeSlider.Value);
|
||||||
var muteThreshold = (float)settingsConfig.GetValue("audio_settings", "mute_threshold", MuteThreshold);
|
var muteThreshold = (float)settingsConfig.GetValue("audio_settings", "mute_threshold", MuteThreshold);
|
||||||
|
|
||||||
MasterVolumeSlider.Value = masterVolume;
|
MasterVolumeSlider.Value = masterVolume;
|
||||||
MusicVolumeSlider.Value = musicVolume;
|
MusicVolumeSlider.Value = musicVolume;
|
||||||
SfxVolumeSlider.Value = sfxVolume;
|
SfxVolumeSlider.Value = sfxVolume;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Godot;
|
using Godot;
|
||||||
|
using Mr.BrickAdventures;
|
||||||
using Mr.BrickAdventures.Autoloads;
|
using Mr.BrickAdventures.Autoloads;
|
||||||
using Mr.BrickAdventures.scripts.components;
|
using Mr.BrickAdventures.scripts.components;
|
||||||
using Mr.BrickAdventures.scripts.Resources;
|
using Mr.BrickAdventures.scripts.Resources;
|
||||||
@@ -17,15 +18,15 @@ public partial class ChargeProgressBar : ProgressBar
|
|||||||
{
|
{
|
||||||
ProgressBar.Hide();
|
ProgressBar.Hide();
|
||||||
|
|
||||||
_skillManager = GetNodeOrNull<SkillManager>("/root/SkillManager");
|
_skillManager = GetNodeOrNull<SkillManager>(Constants.SkillManagerPath);
|
||||||
if (_skillManager == null)
|
if (_skillManager == null)
|
||||||
{
|
{
|
||||||
GD.PrintErr("ChargeProgressBar: SkillManager autoload not found.");
|
GD.PrintErr("ChargeProgressBar: SkillManager autoload not found.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_skillManager.ActiveThrowSkillChanged += OnActiveThrowSkillChanged;
|
_skillManager.ActiveThrowSkillChanged += OnActiveThrowSkillChanged;
|
||||||
|
|
||||||
SetupDependencies();
|
SetupDependencies();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,7 +44,7 @@ public partial class ChargeProgressBar : ProgressBar
|
|||||||
OnOwnerExiting();
|
OnOwnerExiting();
|
||||||
|
|
||||||
if (throwComponent == null || !IsInstanceValid(throwComponent)) return;
|
if (throwComponent == null || !IsInstanceValid(throwComponent)) return;
|
||||||
|
|
||||||
_throwComponent = throwComponent;
|
_throwComponent = throwComponent;
|
||||||
_throwComponent.TreeExiting += OnOwnerExiting;
|
_throwComponent.TreeExiting += OnOwnerExiting;
|
||||||
SetupDependencies();
|
SetupDependencies();
|
||||||
@@ -60,7 +61,7 @@ public partial class ChargeProgressBar : ProgressBar
|
|||||||
}
|
}
|
||||||
_throwComponent = null;
|
_throwComponent = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void SetupDependencies()
|
private void SetupDependencies()
|
||||||
{
|
{
|
||||||
@@ -68,7 +69,7 @@ public partial class ChargeProgressBar : ProgressBar
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_throwComponent.ThrowInputBehavior is ChargeThrowInputResource throwInput)
|
if (_throwComponent.ThrowInputBehavior is ChargeThrowInputResource throwInput)
|
||||||
{
|
{
|
||||||
_throwInput = throwInput;
|
_throwInput = throwInput;
|
||||||
@@ -77,7 +78,7 @@ public partial class ChargeProgressBar : ProgressBar
|
|||||||
{
|
{
|
||||||
_throwInput = null;
|
_throwInput = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_throwInput == null)
|
if (_throwInput == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -88,9 +89,9 @@ public partial class ChargeProgressBar : ProgressBar
|
|||||||
ProgressBar.Hide();
|
ProgressBar.Hide();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetupProgressBar();
|
SetupProgressBar();
|
||||||
|
|
||||||
_throwInput.ChargeStarted += OnChargeStarted;
|
_throwInput.ChargeStarted += OnChargeStarted;
|
||||||
_throwInput.ChargeStopped += OnChargeStopped;
|
_throwInput.ChargeStopped += OnChargeStopped;
|
||||||
_throwInput.ChargeUpdated += OnChargeUpdated;
|
_throwInput.ChargeUpdated += OnChargeUpdated;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Godot;
|
using Godot;
|
||||||
|
using Mr.BrickAdventures;
|
||||||
using Mr.BrickAdventures.Autoloads;
|
using Mr.BrickAdventures.Autoloads;
|
||||||
|
|
||||||
namespace Mr.BrickAdventures.scripts.UI;
|
namespace Mr.BrickAdventures.scripts.UI;
|
||||||
@@ -9,7 +10,7 @@ public partial class Credits : Control
|
|||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
_uiManager = GetNode<UIManager>("/root/UIManager");
|
_uiManager = GetNode<UIManager>(Constants.UIManagerPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void _UnhandledInput(InputEvent @event)
|
public override void _UnhandledInput(InputEvent @event)
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
using Godot;
|
using Godot;
|
||||||
|
using Mr.BrickAdventures;
|
||||||
using Mr.BrickAdventures.Autoloads;
|
using Mr.BrickAdventures.Autoloads;
|
||||||
using Mr.BrickAdventures.scripts.Resources;
|
using Mr.BrickAdventures.scripts.Resources;
|
||||||
|
using Mr.BrickAdventures.scripts.State;
|
||||||
|
|
||||||
namespace Mr.BrickAdventures.scripts.UI;
|
namespace Mr.BrickAdventures.scripts.UI;
|
||||||
|
|
||||||
@@ -12,27 +14,44 @@ public partial class DeathScreen : Control
|
|||||||
[Export] public Label LivesLeftLabel { get; set; }
|
[Export] public Label LivesLeftLabel { get; set; }
|
||||||
[Export] public float TimeoutTime { get; set; } = 2.0f;
|
[Export] public float TimeoutTime { get; set; } = 2.0f;
|
||||||
[Export] public Godot.Collections.Array<Node> NodesToDisable { get; set; } = new();
|
[Export] public Godot.Collections.Array<Node> NodesToDisable { get; set; } = new();
|
||||||
|
|
||||||
private GameManager _gameManager;
|
private GameManager _gameManager;
|
||||||
private Timer _timer;
|
private Timer _timer;
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
_gameManager = GetNode<GameManager>("/root/GameManager");
|
_gameManager = GameManager.Instance;
|
||||||
SetLabels();
|
|
||||||
|
// Subscribe to lives changed event for reactive updates
|
||||||
|
EventBus.Instance.LivesChanged += OnLivesChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void _ExitTree()
|
||||||
|
{
|
||||||
|
if (EventBus.Instance != null)
|
||||||
|
{
|
||||||
|
EventBus.Instance.LivesChanged -= OnLivesChanged;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnLivesChanged(int lives)
|
||||||
|
{
|
||||||
|
// Update the label when lives change
|
||||||
|
LivesLeftLabel.Text = $" x {lives}";
|
||||||
|
}
|
||||||
|
|
||||||
private void SetLabels()
|
private void SetLabels()
|
||||||
{
|
{
|
||||||
if (_gameManager == null) return;
|
|
||||||
|
|
||||||
if (CurrentLevel != null)
|
if (CurrentLevel != null)
|
||||||
{
|
{
|
||||||
CurrentLevelLabel.Text = CurrentLevel.LevelName;
|
CurrentLevelLabel.Text = CurrentLevel.LevelName;
|
||||||
}
|
}
|
||||||
LivesLeftLabel.Text = $" x {_gameManager.GetLives()}";
|
|
||||||
|
// Read current lives from store
|
||||||
|
var lives = GameStateStore.Instance?.Player.Lives ?? 0;
|
||||||
|
LivesLeftLabel.Text = $" x {lives}";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetupTimer()
|
private void SetupTimer()
|
||||||
{
|
{
|
||||||
_timer = new Timer();
|
_timer = new Timer();
|
||||||
@@ -42,31 +61,32 @@ public partial class DeathScreen : Control
|
|||||||
AddChild(_timer);
|
AddChild(_timer);
|
||||||
_timer.Start();
|
_timer.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ToggleNodes()
|
private void ToggleNodes()
|
||||||
{
|
{
|
||||||
foreach (var node in NodesToDisable)
|
foreach (var node in NodesToDisable)
|
||||||
{
|
{
|
||||||
node.ProcessMode = node.ProcessMode == ProcessModeEnum.Disabled
|
node.ProcessMode = node.ProcessMode == ProcessModeEnum.Disabled
|
||||||
? ProcessModeEnum.Inherit
|
? ProcessModeEnum.Inherit
|
||||||
: ProcessModeEnum.Disabled;
|
: ProcessModeEnum.Disabled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnPlayerDeath()
|
public void OnPlayerDeath()
|
||||||
{
|
{
|
||||||
if (_gameManager == null) return;
|
if (_gameManager == null) return;
|
||||||
|
|
||||||
ToggleNodes();
|
ToggleNodes();
|
||||||
SetLabels();
|
SetLabels();
|
||||||
Show();
|
Show();
|
||||||
SetupTimer();
|
SetupTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnTimeout()
|
private void OnTimeout()
|
||||||
{
|
{
|
||||||
if (_gameManager == null || _gameManager.GetLives() == 0) return;
|
var lives = GameStateStore.Instance?.Player.Lives ?? 0;
|
||||||
|
if (lives == 0) return;
|
||||||
|
|
||||||
GetTree().ReloadCurrentScene();
|
GetTree().ReloadCurrentScene();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using Godot;
|
using Godot;
|
||||||
|
using Mr.BrickAdventures;
|
||||||
using Mr.BrickAdventures.Autoloads;
|
using Mr.BrickAdventures.Autoloads;
|
||||||
|
|
||||||
namespace Mr.BrickAdventures.scripts.UI;
|
namespace Mr.BrickAdventures.scripts.UI;
|
||||||
@@ -9,14 +10,14 @@ public partial class GameOverScreen : Control
|
|||||||
[Export] public Button RestartButton { get; set; }
|
[Export] public Button RestartButton { get; set; }
|
||||||
[Export] public Button MainMenuButton { get; set; }
|
[Export] public Button MainMenuButton { get; set; }
|
||||||
[Export] public PackedScene MainMenuScene { get; set; }
|
[Export] public PackedScene MainMenuScene { get; set; }
|
||||||
|
|
||||||
private GameManager _gameManager;
|
private GameManager _gameManager;
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
_gameManager = GetNode<GameManager>("/root/GameManager");
|
_gameManager = GameManager.Instance;
|
||||||
RestartButton.Pressed += OnRestartClicked;
|
RestartButton.Pressed += OnRestartClicked;
|
||||||
MainMenuButton.Pressed += OnMainMenuClicked;
|
MainMenuButton.Pressed += OnMainMenuClicked;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnMainMenuClicked()
|
private void OnMainMenuClicked()
|
||||||
@@ -33,7 +34,7 @@ public partial class GameOverScreen : Control
|
|||||||
public void OnPlayerDeath()
|
public void OnPlayerDeath()
|
||||||
{
|
{
|
||||||
if (_gameManager == null || _gameManager.GetLives() != 0) return;
|
if (_gameManager == null || _gameManager.GetLives() != 0) return;
|
||||||
|
|
||||||
GameOverPanel.Show();
|
GameOverPanel.Show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using Godot;
|
using Godot;
|
||||||
|
using Mr.BrickAdventures;
|
||||||
using Mr.BrickAdventures.Autoloads;
|
using Mr.BrickAdventures.Autoloads;
|
||||||
using Mr.BrickAdventures.scripts.components;
|
using Mr.BrickAdventures.scripts.components;
|
||||||
|
|
||||||
@@ -15,7 +16,7 @@ public partial class Hud : Control
|
|||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
_gameManager = GetNode<GameManager>("/root/GameManager");
|
_gameManager = GameManager.Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void _Process(double delta)
|
public override void _Process(double delta)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Godot;
|
using Godot;
|
||||||
|
using Mr.BrickAdventures;
|
||||||
using Mr.BrickAdventures.Autoloads;
|
using Mr.BrickAdventures.Autoloads;
|
||||||
|
|
||||||
namespace Mr.BrickAdventures.scripts.UI;
|
namespace Mr.BrickAdventures.scripts.UI;
|
||||||
@@ -14,16 +15,16 @@ public partial class MainMenu : Control
|
|||||||
[Export] public Label VersionLabel { get; set; }
|
[Export] public Label VersionLabel { get; set; }
|
||||||
[Export] public Control SettingsControl { get; set; }
|
[Export] public Control SettingsControl { get; set; }
|
||||||
[Export] public Control CreditsControl { get; set; }
|
[Export] public Control CreditsControl { get; set; }
|
||||||
|
|
||||||
private SaveSystem _saveSystem;
|
private SaveSystem _saveSystem;
|
||||||
private GameManager _gameManager;
|
private GameManager _gameManager;
|
||||||
private UIManager _uiManager;
|
private UIManager _uiManager;
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
_saveSystem = GetNode<SaveSystem>("/root/SaveSystem");
|
_saveSystem = SaveSystem.Instance;
|
||||||
_gameManager = GetNode<GameManager>("/root/GameManager");
|
_gameManager = GameManager.Instance;
|
||||||
_uiManager = GetNode<UIManager>("/root/UIManager");
|
_uiManager = GetNode<UIManager>(Constants.UIManagerPath);
|
||||||
|
|
||||||
NewGameButton.Pressed += OnNewGamePressed;
|
NewGameButton.Pressed += OnNewGamePressed;
|
||||||
ContinueButton.Pressed += OnContinuePressed;
|
ContinueButton.Pressed += OnContinuePressed;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Godot;
|
using Godot;
|
||||||
using Godot.Collections;
|
using Godot.Collections;
|
||||||
|
using Mr.BrickAdventures;
|
||||||
using Mr.BrickAdventures.Autoloads;
|
using Mr.BrickAdventures.Autoloads;
|
||||||
using Mr.BrickAdventures.scripts.components;
|
using Mr.BrickAdventures.scripts.components;
|
||||||
using Mr.BrickAdventures.scripts.Resources;
|
using Mr.BrickAdventures.scripts.Resources;
|
||||||
@@ -17,7 +18,7 @@ public partial class Marketplace : Control
|
|||||||
[Export] public Array<Node> ComponentsToDisable { get; set; } = [];
|
[Export] public Array<Node> ComponentsToDisable { get; set; } = [];
|
||||||
[Export] public PackedScene MarketplaceButtonScene { get; set; }
|
[Export] public PackedScene MarketplaceButtonScene { get; set; }
|
||||||
[Export] public PackedScene SkillButtonScene { get; set; }
|
[Export] public PackedScene SkillButtonScene { get; set; }
|
||||||
|
|
||||||
private GameManager _gameManager;
|
private GameManager _gameManager;
|
||||||
private SkillManager _skillManager;
|
private SkillManager _skillManager;
|
||||||
private readonly List<Button> _unlockButtons = [];
|
private readonly List<Button> _unlockButtons = [];
|
||||||
@@ -25,33 +26,37 @@ public partial class Marketplace : Control
|
|||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
_gameManager = GetNode<GameManager>("/root/GameManager");
|
_gameManager = GameManager.Instance;
|
||||||
_skillManager = GetNode<SkillManager>("/root/SkillManager");
|
_skillManager = SkillManager.Instance;
|
||||||
_skillManager.SkillRemoved += OnSkillRemoved;
|
|
||||||
|
|
||||||
Skills = _skillManager.AvailableSkills;
|
Skills = _skillManager.AvailableSkills;
|
||||||
|
|
||||||
var skillsToUnlock = new List<SkillData>();
|
var skillsToUnlock = new List<SkillData>();
|
||||||
|
|
||||||
foreach (var skill in Skills) skillsToUnlock.Add(skill);
|
foreach (var skill in Skills) skillsToUnlock.Add(skill);
|
||||||
|
|
||||||
foreach (var skill in skillsToUnlock) CreateUpgradeButton(skill);
|
foreach (var skill in skillsToUnlock) CreateUpgradeButton(skill);
|
||||||
|
|
||||||
var unlockedSkills = _gameManager.GetUnlockedSkills();
|
var unlockedSkills = _gameManager.GetUnlockedSkills();
|
||||||
foreach (var skill in unlockedSkills) CreateSkillButton(skill);
|
foreach (var skill in unlockedSkills) CreateSkillButton(skill);
|
||||||
|
|
||||||
SkillUnlockerComponent.SkillUnlocked += OnSkillUnlocked;
|
SkillUnlockerComponent.SkillUnlocked += OnSkillUnlocked;
|
||||||
|
EventBus.Instance.SkillCollected += OnGlobalSkillCollected;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void _ExitTree()
|
public override void _ExitTree()
|
||||||
{
|
{
|
||||||
SkillUnlockerComponent.SkillUnlocked -= OnSkillUnlocked;
|
SkillUnlockerComponent.SkillUnlocked -= OnSkillUnlocked;
|
||||||
|
if (EventBus.Instance != null)
|
||||||
|
{
|
||||||
|
EventBus.Instance.SkillCollected -= OnGlobalSkillCollected;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void _Input(InputEvent @event)
|
public override void _Input(InputEvent @event)
|
||||||
{
|
{
|
||||||
if (!@event.IsActionPressed("show_marketplace")) return;
|
if (!@event.IsActionPressed("show_marketplace")) return;
|
||||||
|
|
||||||
if (IsVisible())
|
if (IsVisible())
|
||||||
{
|
{
|
||||||
Hide();
|
Hide();
|
||||||
@@ -75,12 +80,12 @@ public partial class Marketplace : Control
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!buttonExists) CreateSkillButton(skill);
|
if (!buttonExists) CreateSkillButton(skill);
|
||||||
|
|
||||||
foreach (var btn in _skillButtons)
|
foreach (var btn in _skillButtons)
|
||||||
{
|
{
|
||||||
if (btn.Data.IsActive) btn.Activate();
|
if (_skillManager.IsSkillActive(btn.Data)) btn.Activate();
|
||||||
else btn.Deactivate();
|
else btn.Deactivate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -92,7 +97,7 @@ public partial class Marketplace : Control
|
|||||||
button.Setup();
|
button.Setup();
|
||||||
button.Pressed += () => OnSkillButtonPressed(button);
|
button.Pressed += () => OnSkillButtonPressed(button);
|
||||||
button.Activate();
|
button.Activate();
|
||||||
|
|
||||||
_skillButtons.Add(button);
|
_skillButtons.Add(button);
|
||||||
UnlockedGrid.AddChild(button);
|
UnlockedGrid.AddChild(button);
|
||||||
UnlockedGrid.QueueSort();
|
UnlockedGrid.QueueSort();
|
||||||
@@ -104,7 +109,7 @@ public partial class Marketplace : Control
|
|||||||
button.Data = skill;
|
button.Data = skill;
|
||||||
button.Icon = skill.Icon;
|
button.Icon = skill.Icon;
|
||||||
button.Pressed += () => OnUpgradeButtonPressed(skill);
|
button.Pressed += () => OnUpgradeButtonPressed(skill);
|
||||||
|
|
||||||
_unlockButtons.Add(button);
|
_unlockButtons.Add(button);
|
||||||
ToUnlockGrid.AddChild(button);
|
ToUnlockGrid.AddChild(button);
|
||||||
ToUnlockGrid.QueueSort();
|
ToUnlockGrid.QueueSort();
|
||||||
@@ -117,7 +122,7 @@ public partial class Marketplace : Control
|
|||||||
if (skill.Level < skill.MaxLevel)
|
if (skill.Level < skill.MaxLevel)
|
||||||
{
|
{
|
||||||
SkillUnlockerComponent.TryUpgradeSkill(skill);
|
SkillUnlockerComponent.TryUpgradeSkill(skill);
|
||||||
if (!skill.IsActive) SkillUnlockerComponent.SkillManager.ToggleSkillActivation(skill);
|
if (!SkillUnlockerComponent.SkillManager.IsSkillActive(skill)) SkillUnlockerComponent.SkillManager.ToggleSkillActivation(skill);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -133,31 +138,18 @@ public partial class Marketplace : Control
|
|||||||
private void OnSkillButtonPressed(SkillButton button)
|
private void OnSkillButtonPressed(SkillButton button)
|
||||||
{
|
{
|
||||||
SkillUnlockerComponent.SkillManager.ToggleSkillActivation(button.Data);
|
SkillUnlockerComponent.SkillManager.ToggleSkillActivation(button.Data);
|
||||||
|
|
||||||
foreach (var btn in _skillButtons)
|
foreach (var btn in _skillButtons)
|
||||||
{
|
{
|
||||||
if (btn.Data.IsActive)
|
if (SkillUnlockerComponent.SkillManager.IsSkillActive(btn.Data))
|
||||||
btn.Activate();
|
btn.Activate();
|
||||||
else
|
else
|
||||||
btn.Deactivate();
|
btn.Deactivate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnSkillRemoved(SkillData skill)
|
private void OnGlobalSkillCollected(SkillData skill, Vector2 position)
|
||||||
{
|
{
|
||||||
SkillButton buttonToRemove = null;
|
OnSkillUnlocked(skill);
|
||||||
foreach (var button in _skillButtons)
|
|
||||||
{
|
|
||||||
if (button.Data == skill)
|
|
||||||
{
|
|
||||||
buttonToRemove = button;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (buttonToRemove != null)
|
|
||||||
{
|
|
||||||
_skillButtons.Remove(buttonToRemove);
|
|
||||||
buttonToRemove.QueueFree();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using Godot;
|
using Godot;
|
||||||
|
using Mr.BrickAdventures;
|
||||||
using Mr.BrickAdventures.Autoloads;
|
using Mr.BrickAdventures.Autoloads;
|
||||||
using Mr.BrickAdventures.scripts.components;
|
using Mr.BrickAdventures.scripts.components;
|
||||||
using Mr.BrickAdventures.scripts.Resources;
|
using Mr.BrickAdventures.scripts.Resources;
|
||||||
@@ -11,26 +12,26 @@ public partial class MarketplaceButton : Button
|
|||||||
[Export] public Texture2D UnlockedSkillIcon { get; set; }
|
[Export] public Texture2D UnlockedSkillIcon { get; set; }
|
||||||
[Export] public Texture2D LockedSkillIcon { get; set; }
|
[Export] public Texture2D LockedSkillIcon { get; set; }
|
||||||
[Export] public Container SkillLevelContainer { get; set; }
|
[Export] public Container SkillLevelContainer { get; set; }
|
||||||
|
|
||||||
private GameManager _gameManager;
|
private GameManager _gameManager;
|
||||||
private SkillUnlockerComponent _skillUnlockerComponent;
|
private SkillUnlockerComponent _skillUnlockerComponent;
|
||||||
private SkillManager _skillManager;
|
private SkillManager _skillManager;
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
_gameManager = GetNode<GameManager>("/root/GameManager");
|
_gameManager = GameManager.Instance;
|
||||||
var player = _gameManager.Player;
|
var player = _gameManager.Player;
|
||||||
if (player == null) return;
|
if (player == null) return;
|
||||||
|
|
||||||
_skillUnlockerComponent = player.GetNodeOrNull<SkillUnlockerComponent>("SkillUnlockerComponent");
|
_skillUnlockerComponent = player.GetNodeOrNull<SkillUnlockerComponent>("SkillUnlockerComponent");
|
||||||
if (_skillUnlockerComponent != null)
|
if (_skillUnlockerComponent != null)
|
||||||
{
|
{
|
||||||
_skillUnlockerComponent.SkillUnlocked += OnSkillStateChanged;
|
_skillUnlockerComponent.SkillUnlocked += OnSkillStateChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
_skillManager = GetNode<SkillManager>("/root/SkillManager");
|
_skillManager = SkillManager.Instance;
|
||||||
_skillManager.SkillRemoved += OnSkillStateChanged;
|
_skillManager.SkillRemoved += OnSkillStateChanged;
|
||||||
|
|
||||||
UpdateButtonState();
|
UpdateButtonState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,7 +42,7 @@ public partial class MarketplaceButton : Button
|
|||||||
_skillUnlockerComponent.SkillUnlocked -= OnSkillStateChanged;
|
_skillUnlockerComponent.SkillUnlocked -= OnSkillStateChanged;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnSkillStateChanged(SkillData skill)
|
private void OnSkillStateChanged(SkillData skill)
|
||||||
{
|
{
|
||||||
if (skill.Name == Data.Name)
|
if (skill.Name == Data.Name)
|
||||||
@@ -59,7 +60,7 @@ public partial class MarketplaceButton : Button
|
|||||||
}
|
}
|
||||||
|
|
||||||
var isUnlocked = _gameManager.IsSkillUnlocked(Data);
|
var isUnlocked = _gameManager.IsSkillUnlocked(Data);
|
||||||
|
|
||||||
for (var i = 0; i < SkillLevelContainer.GetChildCount(); i++)
|
for (var i = 0; i < SkillLevelContainer.GetChildCount(); i++)
|
||||||
{
|
{
|
||||||
SkillLevelContainer.GetChild(i).QueueFree();
|
SkillLevelContainer.GetChild(i).QueueFree();
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Godot;
|
using Godot;
|
||||||
|
using Mr.BrickAdventures;
|
||||||
using Mr.BrickAdventures.Autoloads;
|
using Mr.BrickAdventures.Autoloads;
|
||||||
|
|
||||||
namespace Mr.BrickAdventures.scripts.UI;
|
namespace Mr.BrickAdventures.scripts.UI;
|
||||||
@@ -18,8 +19,8 @@ public partial class PauseMenu : Control
|
|||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
_gameManager = GetNode<GameManager>("/root/GameManager");
|
_gameManager = GameManager.Instance;
|
||||||
_uiManager = GetNode<UIManager>("/root/UIManager");
|
_uiManager = GetNode<UIManager>(Constants.UIManagerPath);
|
||||||
|
|
||||||
ResumeButton.Pressed += OnResumePressed;
|
ResumeButton.Pressed += OnResumePressed;
|
||||||
MainMenuButton.Pressed += OnMainMenuPressed;
|
MainMenuButton.Pressed += OnMainMenuPressed;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Godot;
|
using Godot;
|
||||||
|
using Mr.BrickAdventures;
|
||||||
using Mr.BrickAdventures.Autoloads;
|
using Mr.BrickAdventures.Autoloads;
|
||||||
|
|
||||||
namespace Mr.BrickAdventures.scripts.UI;
|
namespace Mr.BrickAdventures.scripts.UI;
|
||||||
@@ -14,18 +15,18 @@ public partial class SettingsMenu : Control
|
|||||||
[Export] public Button AudioSettingsButton { get; set; }
|
[Export] public Button AudioSettingsButton { get; set; }
|
||||||
[Export] public Button DisplaySettingsButton { get; set; }
|
[Export] public Button DisplaySettingsButton { get; set; }
|
||||||
[Export] public Button GameplaySettingsButton { get; set; }
|
[Export] public Button GameplaySettingsButton { get; set; }
|
||||||
|
|
||||||
private UIManager _uiManager;
|
private UIManager _uiManager;
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
_uiManager = GetNode<UIManager>("/root/UIManager");
|
_uiManager = GetNode<UIManager>(Constants.UIManagerPath);
|
||||||
|
|
||||||
InputSettingsButton.Pressed += OnInputSettingsPressed;
|
InputSettingsButton.Pressed += OnInputSettingsPressed;
|
||||||
AudioSettingsButton.Pressed += OnAudioSettingsPressed;
|
AudioSettingsButton.Pressed += OnAudioSettingsPressed;
|
||||||
DisplaySettingsButton.Pressed += OnDisplaySettingsPressed;
|
DisplaySettingsButton.Pressed += OnDisplaySettingsPressed;
|
||||||
GameplaySettingsButton.Pressed += OnGameplaySettingsPressed;
|
GameplaySettingsButton.Pressed += OnGameplaySettingsPressed;
|
||||||
|
|
||||||
InputSettingsControl?.Hide();
|
InputSettingsControl?.Hide();
|
||||||
AudioSettingsControl?.Hide();
|
AudioSettingsControl?.Hide();
|
||||||
DisplaySettingsControl?.Hide();
|
DisplaySettingsControl?.Hide();
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Godot;
|
using Godot;
|
||||||
|
using Mr.BrickAdventures;
|
||||||
using Mr.BrickAdventures.Autoloads;
|
using Mr.BrickAdventures.Autoloads;
|
||||||
|
|
||||||
namespace Mr.BrickAdventures.scripts.UI;
|
namespace Mr.BrickAdventures.scripts.UI;
|
||||||
@@ -7,15 +8,15 @@ namespace Mr.BrickAdventures.scripts.UI;
|
|||||||
public partial class SpeedRunHud : Control
|
public partial class SpeedRunHud : Control
|
||||||
{
|
{
|
||||||
[Export] private Label _timerLabel;
|
[Export] private Label _timerLabel;
|
||||||
|
|
||||||
private SpeedRunManager _speedRunManager;
|
private SpeedRunManager _speedRunManager;
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
_speedRunManager = GetNode<SpeedRunManager>("/root/SpeedRunManager");
|
_speedRunManager = GetNode<SpeedRunManager>(Constants.SpeedRunManagerPath);
|
||||||
|
|
||||||
_speedRunManager.TimeUpdated += OnTimerUpdated;
|
_speedRunManager.TimeUpdated += OnTimerUpdated;
|
||||||
|
|
||||||
Visible = _speedRunManager.IsVisible;
|
Visible = _speedRunManager.IsVisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,26 +5,27 @@ using Mr.BrickAdventures.scripts.Resources;
|
|||||||
namespace Mr.BrickAdventures.scripts.components;
|
namespace Mr.BrickAdventures.scripts.components;
|
||||||
|
|
||||||
[GlobalClass]
|
[GlobalClass]
|
||||||
public partial class BrickArmorSkillComponent : Node, ISkill
|
public partial class BrickArmorSkillComponent : SkillComponentBase
|
||||||
{
|
{
|
||||||
private HealthComponent _healthComponent;
|
private HealthComponent _healthComponent;
|
||||||
private SkillData _skillData;
|
|
||||||
private float _armorBonus = 0;
|
private float _armorBonus = 0;
|
||||||
|
|
||||||
public void Initialize(Node owner, SkillData data)
|
public override void Initialize(Node owner, SkillData data)
|
||||||
{
|
{
|
||||||
if (owner is not PlayerController player) return;
|
base.Initialize(owner, data);
|
||||||
_healthComponent = player.GetNode<HealthComponent>("HealthComponent");
|
if (Player != null)
|
||||||
_skillData = data;
|
{
|
||||||
|
_healthComponent = Player.GetNode<HealthComponent>("HealthComponent");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Activate()
|
public override void Activate()
|
||||||
{
|
{
|
||||||
if (_healthComponent == null || _skillData == null) return;
|
if (_healthComponent == null || Data == null) return;
|
||||||
ApplyUpgrade(_skillData.Upgrades[_skillData.Level - 1]);
|
ApplyUpgrade(Data.Upgrades[Data.Level - 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Deactivate()
|
public override void Deactivate()
|
||||||
{
|
{
|
||||||
if (_healthComponent == null) return;
|
if (_healthComponent == null) return;
|
||||||
_healthComponent.MaxHealth -= _armorBonus;
|
_healthComponent.MaxHealth -= _armorBonus;
|
||||||
@@ -35,7 +36,7 @@ public partial class BrickArmorSkillComponent : Node, ISkill
|
|||||||
_armorBonus = 0;
|
_armorBonus = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ApplyUpgrade(SkillUpgrade upgrade)
|
public override void ApplyUpgrade(SkillUpgrade upgrade)
|
||||||
{
|
{
|
||||||
if (_healthComponent == null || upgrade == null) return;
|
if (_healthComponent == null || upgrade == null) return;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Godot;
|
using Godot;
|
||||||
|
using Mr.BrickAdventures;
|
||||||
using Mr.BrickAdventures.Autoloads;
|
using Mr.BrickAdventures.Autoloads;
|
||||||
using Mr.BrickAdventures.scripts.interfaces;
|
using Mr.BrickAdventures.scripts.interfaces;
|
||||||
using Mr.BrickAdventures.scripts.Resources;
|
using Mr.BrickAdventures.scripts.Resources;
|
||||||
@@ -6,41 +7,33 @@ using Mr.BrickAdventures.scripts.Resources;
|
|||||||
namespace Mr.BrickAdventures.scripts.components;
|
namespace Mr.BrickAdventures.scripts.components;
|
||||||
|
|
||||||
[GlobalClass]
|
[GlobalClass]
|
||||||
public partial class BrickShieldSkillComponent : Node, ISkill
|
public partial class BrickShieldSkillComponent : SkillComponentBase
|
||||||
{
|
{
|
||||||
[Export] public PackedScene ShieldScene { get; set; }
|
[Export] public PackedScene ShieldScene { get; set; }
|
||||||
|
|
||||||
private PlayerController _player;
|
|
||||||
private Node2D _shieldInstance;
|
private Node2D _shieldInstance;
|
||||||
private SkillData _skillData;
|
|
||||||
private GameManager _gameManager;
|
private GameManager _gameManager;
|
||||||
private SkillManager _skillManager;
|
private SkillManager _skillManager;
|
||||||
private HealthComponent _shieldHealth;
|
private HealthComponent _shieldHealth;
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
_gameManager = GetNode<GameManager>("/root/GameManager");
|
_gameManager = GameManager.Instance;
|
||||||
_skillManager = GetNode<SkillManager>("/root/SkillManager");
|
_skillManager = SkillManager.Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialize(Node owner, SkillData data)
|
public override void Activate()
|
||||||
{
|
{
|
||||||
_player = owner as PlayerController;
|
if (Player == null || ShieldScene == null || _shieldInstance != null) return;
|
||||||
_skillData = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Activate()
|
|
||||||
{
|
|
||||||
if (_player == null || ShieldScene == null || _shieldInstance != null) return;
|
|
||||||
|
|
||||||
_shieldInstance = ShieldScene.Instantiate<Node2D>();
|
_shieldInstance = ShieldScene.Instantiate<Node2D>();
|
||||||
_player.AddChild(_shieldInstance);
|
Player.AddChild(_shieldInstance);
|
||||||
_shieldInstance.Position = Vector2.Zero;
|
_shieldInstance.Position = Vector2.Zero;
|
||||||
_shieldInstance.TreeExiting += OnShieldDestroyed;
|
_shieldInstance.TreeExiting += OnShieldDestroyed;
|
||||||
_shieldHealth = _shieldInstance.GetNode<HealthComponent>("HealthComponent");
|
_shieldHealth = _shieldInstance.GetNode<HealthComponent>("HealthComponent");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Deactivate()
|
public override void Deactivate()
|
||||||
{
|
{
|
||||||
if (_shieldInstance != null && IsInstanceValid(_shieldInstance))
|
if (_shieldInstance != null && IsInstanceValid(_shieldInstance))
|
||||||
{
|
{
|
||||||
@@ -50,7 +43,7 @@ public partial class BrickShieldSkillComponent : Node, ISkill
|
|||||||
_shieldInstance = null;
|
_shieldInstance = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ApplyUpgrade(SkillUpgrade upgrade)
|
public override void ApplyUpgrade(SkillUpgrade upgrade)
|
||||||
{
|
{
|
||||||
upgrade.Properties.TryGetValue("shield_health", out var newHealth);
|
upgrade.Properties.TryGetValue("shield_health", out var newHealth);
|
||||||
if (_shieldHealth != null)
|
if (_shieldHealth != null)
|
||||||
@@ -59,13 +52,13 @@ public partial class BrickShieldSkillComponent : Node, ISkill
|
|||||||
_shieldHealth.MaxHealth = (float)newHealth;
|
_shieldHealth.MaxHealth = (float)newHealth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnShieldDestroyed()
|
private void OnShieldDestroyed()
|
||||||
{
|
{
|
||||||
if (_gameManager != null && _skillData != null && _skillManager != null)
|
if (_gameManager != null && Data != null && _skillManager != null)
|
||||||
{
|
{
|
||||||
_gameManager.RemoveSkill(_skillData.Name);
|
_gameManager.RemoveSkill(Data.Name);
|
||||||
_skillManager.RemoveSkill(_skillData.Name);
|
_skillManager.RemoveSkill(Data.Name);
|
||||||
}
|
}
|
||||||
_shieldInstance = null;
|
_shieldInstance = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,16 +5,14 @@ using Mr.BrickAdventures.scripts.Resources;
|
|||||||
namespace Mr.BrickAdventures.scripts.components;
|
namespace Mr.BrickAdventures.scripts.components;
|
||||||
|
|
||||||
[GlobalClass]
|
[GlobalClass]
|
||||||
public partial class BrickThrowComponent : Node, ISkill
|
public partial class BrickThrowComponent : SkillComponentBase
|
||||||
{
|
{
|
||||||
[Export] public PackedScene BrickScene { get; set; }
|
[Export] public PackedScene BrickScene { get; set; }
|
||||||
[Export] public float FireRate { get; set; } = 1.0f;
|
[Export] public float FireRate { get; set; } = 1.0f;
|
||||||
[Export] public PlayerController PlayerController { get; set; }
|
|
||||||
[Export] public ThrowInputResource ThrowInputBehavior { get; set; }
|
[Export] public ThrowInputResource ThrowInputBehavior { get; set; }
|
||||||
|
|
||||||
private bool _canThrow = true;
|
private bool _canThrow = true;
|
||||||
private Timer _timer;
|
private Timer _timer;
|
||||||
private SkillData _skillData;
|
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
@@ -59,60 +57,54 @@ public partial class BrickThrowComponent : Node, ISkill
|
|||||||
|
|
||||||
private void ThrowBrick(float powerMultiplier = 1f)
|
private void ThrowBrick(float powerMultiplier = 1f)
|
||||||
{
|
{
|
||||||
if (!_canThrow || PlayerController == null || BrickScene == null)
|
if (!_canThrow || Player == null || BrickScene == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var instance = BrickScene.Instantiate<Node2D>();
|
var instance = BrickScene.Instantiate<Node2D>();
|
||||||
var init = instance.GetNodeOrNull<ProjectileInitComponent>("ProjectileInitComponent");
|
var init = instance.GetNodeOrNull<ProjectileInitComponent>("ProjectileInitComponent");
|
||||||
|
|
||||||
if (init != null)
|
if (init != null)
|
||||||
{
|
{
|
||||||
var @params = new ProjectileInitParams()
|
var @params = new ProjectileInitParams()
|
||||||
{
|
{
|
||||||
Position = PlayerController.GlobalPosition,
|
Position = Player.GlobalPosition,
|
||||||
Rotation = PlayerController.Rotation,
|
Rotation = Player.Rotation,
|
||||||
Direction = PlayerController.LastDirection,
|
Direction = Player.LastDirection,
|
||||||
PowerMultiplier = powerMultiplier,
|
PowerMultiplier = powerMultiplier,
|
||||||
};
|
};
|
||||||
|
|
||||||
init.Initialize(@params);
|
init.Initialize(@params);
|
||||||
}
|
}
|
||||||
|
|
||||||
GetTree().CurrentScene.AddChild(instance);
|
GetTree().CurrentScene.AddChild(instance);
|
||||||
_canThrow = false;
|
_canThrow = false;
|
||||||
_timer.Start();
|
_timer.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialize(Node owner, SkillData data)
|
public override void Initialize(Node owner, SkillData data)
|
||||||
{
|
{
|
||||||
PlayerController = owner as PlayerController;
|
base.Initialize(owner, data);
|
||||||
_skillData = data;
|
|
||||||
|
|
||||||
ThrowInputBehavior = (ThrowInputResource)ThrowInputBehavior?.Duplicate();
|
ThrowInputBehavior = (ThrowInputResource)ThrowInputBehavior?.Duplicate();
|
||||||
|
|
||||||
if (PlayerController == null)
|
if (Data.Level > 0 && Data.Upgrades.Count >= Data.Level)
|
||||||
{
|
{
|
||||||
GD.PushError("BrickThrowComponent: Owner is not a PlayerController.");
|
ApplyUpgrade(Data.Upgrades[Data.Level - 1]);
|
||||||
}
|
|
||||||
|
|
||||||
if (_skillData.Level > 0 && _skillData.Upgrades.Count >= _skillData.Level)
|
|
||||||
{
|
|
||||||
ApplyUpgrade(_skillData.Upgrades[_skillData.Level - 1]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Activate()
|
public override void Activate()
|
||||||
{
|
{
|
||||||
if (ThrowInputBehavior != null) ThrowInputBehavior.ThrowRequested += ThrowBrick;
|
if (ThrowInputBehavior != null) ThrowInputBehavior.ThrowRequested += ThrowBrick;
|
||||||
SetProcessInput(true);
|
SetProcessInput(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Deactivate()
|
public override void Deactivate()
|
||||||
{
|
{
|
||||||
if (ThrowInputBehavior != null) ThrowInputBehavior.ThrowRequested -= ThrowBrick;
|
if (ThrowInputBehavior != null) ThrowInputBehavior.ThrowRequested -= ThrowBrick;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ApplyUpgrade(SkillUpgrade upgrade)
|
public override void ApplyUpgrade(SkillUpgrade upgrade)
|
||||||
{
|
{
|
||||||
foreach (var property in upgrade.Properties)
|
foreach (var property in upgrade.Properties)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
using Mr.BrickAdventures;
|
||||||
using Mr.BrickAdventures.Autoloads;
|
using Mr.BrickAdventures.Autoloads;
|
||||||
using Mr.BrickAdventures.scripts.Resources;
|
using Mr.BrickAdventures.scripts.Resources;
|
||||||
|
|
||||||
@@ -22,9 +23,7 @@ public partial class CollectableComponent : Node
|
|||||||
/// Return false to prevent collection.
|
/// Return false to prevent collection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Func<Node2D, bool> CanCollect { get; set; }
|
public Func<Node2D, bool> CanCollect { get; set; }
|
||||||
|
|
||||||
private FloatingTextManager _floatingTextManager;
|
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
if (Area2D != null)
|
if (Area2D != null)
|
||||||
@@ -34,8 +33,6 @@ public partial class CollectableComponent : Node
|
|||||||
|
|
||||||
if (Owner.HasNode("FadeAwayComponent"))
|
if (Owner.HasNode("FadeAwayComponent"))
|
||||||
_hasFadeAway = true;
|
_hasFadeAway = true;
|
||||||
|
|
||||||
_floatingTextManager = GetNode<FloatingTextManager>("/root/FloatingTextManager");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void OnArea2DBodyEntered(Node2D body)
|
private async void OnArea2DBodyEntered(Node2D body)
|
||||||
@@ -52,13 +49,26 @@ public partial class CollectableComponent : Node
|
|||||||
switch (Data.Type)
|
switch (Data.Type)
|
||||||
{
|
{
|
||||||
case CollectableType.Coin:
|
case CollectableType.Coin:
|
||||||
_floatingTextManager?.ShowCoin((int)Data.Amount, ownerNode.GlobalPosition);
|
FloatingTextManager.Instance?.ShowCoin((int)Data.Amount, ownerNode.GlobalPosition);
|
||||||
|
EventBus.EmitCoinCollected((int)Data.Amount, ownerNode.GlobalPosition);
|
||||||
break;
|
break;
|
||||||
case CollectableType.Health:
|
case CollectableType.Health:
|
||||||
_floatingTextManager?.ShowMessage("Healed!", ownerNode.GlobalPosition);
|
FloatingTextManager.Instance?.ShowMessage("Healed!", ownerNode.GlobalPosition);
|
||||||
|
EventBus.EmitItemCollected(Data.Type, Data.Amount, ownerNode.GlobalPosition);
|
||||||
break;
|
break;
|
||||||
case CollectableType.Kid:
|
case CollectableType.Kid:
|
||||||
_floatingTextManager?.ShowMessage("Rescued!", ownerNode.GlobalPosition);
|
FloatingTextManager.Instance?.ShowMessage("Rescued!", ownerNode.GlobalPosition);
|
||||||
|
EventBus.EmitChildRescued(ownerNode.GlobalPosition);
|
||||||
|
break;
|
||||||
|
case CollectableType.Skill:
|
||||||
|
if (Data.Skill != null)
|
||||||
|
{
|
||||||
|
FloatingTextManager.Instance?.ShowMessage($"{Data.Skill.Name} Unlocked!", ownerNode.GlobalPosition);
|
||||||
|
EventBus.EmitSkillCollected(Data.Skill, ownerNode.GlobalPosition);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
EventBus.EmitItemCollected(Data.Type, Data.Amount, ownerNode.GlobalPosition);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,40 +6,25 @@ using Mr.BrickAdventures.scripts.Resources;
|
|||||||
namespace Mr.BrickAdventures.scripts.components;
|
namespace Mr.BrickAdventures.scripts.components;
|
||||||
|
|
||||||
[GlobalClass]
|
[GlobalClass]
|
||||||
public partial class DoubleJumpSkillComponent : Node, ISkill
|
public partial class DoubleJumpSkillComponent : SkillComponentBase
|
||||||
{
|
{
|
||||||
[Export] private PackedScene _doubleJumpAbilityScene;
|
[Export] private PackedScene _doubleJumpAbilityScene;
|
||||||
private PlayerController _playerController;
|
|
||||||
|
|
||||||
public void Initialize(Node owner, SkillData data)
|
|
||||||
{
|
|
||||||
_playerController = owner as PlayerController;
|
|
||||||
if (_playerController == null)
|
|
||||||
{
|
|
||||||
GD.PrintErr("DoubleJumpSkillComponent must be a child of a PlayerController.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Activate()
|
public override void Activate()
|
||||||
{
|
{
|
||||||
if (_playerController == null) return;
|
if (Player == null) return;
|
||||||
|
|
||||||
var hasAbility = _playerController.GetActiveAbilities().Any(ability => ability is DoubleJumpAbility);
|
var hasAbility = Player.GetActiveAbilities().Any(ability => ability is DoubleJumpAbility);
|
||||||
|
|
||||||
if (!hasAbility)
|
if (!hasAbility)
|
||||||
{
|
{
|
||||||
var abilityInstance = _doubleJumpAbilityScene.Instantiate<DoubleJumpAbility>();
|
var abilityInstance = _doubleJumpAbilityScene.Instantiate<DoubleJumpAbility>();
|
||||||
_playerController.AddAbility(abilityInstance);
|
Player.AddAbility(abilityInstance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Deactivate()
|
public override void Deactivate()
|
||||||
{
|
{
|
||||||
_playerController?.RemoveAbility<DoubleJumpAbility>();
|
Player?.RemoveAbility<DoubleJumpAbility>();
|
||||||
}
|
|
||||||
|
|
||||||
public void ApplyUpgrade(SkillUpgrade upgrade)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
using Mr.BrickAdventures.Autoloads;
|
||||||
|
|
||||||
namespace Mr.BrickAdventures.scripts.components;
|
namespace Mr.BrickAdventures.scripts.components;
|
||||||
|
|
||||||
@@ -23,7 +24,7 @@ public partial class EnemyDeathComponent : Node
|
|||||||
GD.PushError("EnemyDeathComponent: Health is not set.");
|
GD.PushError("EnemyDeathComponent: Health is not set.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Health.Death += OnDeath;
|
Health.Death += OnDeath;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,6 +35,12 @@ public partial class EnemyDeathComponent : Node
|
|||||||
|
|
||||||
private async Task Die()
|
private async Task Die()
|
||||||
{
|
{
|
||||||
|
// Emit enemy defeated event for statistics and other systems
|
||||||
|
if (Owner is Node2D ownerNode)
|
||||||
|
{
|
||||||
|
EventBus.EmitEnemyDefeated(Owner, ownerNode.GlobalPosition);
|
||||||
|
}
|
||||||
|
|
||||||
CollisionShape.SetDisabled(true);
|
CollisionShape.SetDisabled(true);
|
||||||
var tween = CreateTween();
|
var tween = CreateTween();
|
||||||
tween.TweenProperty(Owner, "scale", Vector2.Zero, TweenDuration);
|
tween.TweenProperty(Owner, "scale", Vector2.Zero, TweenDuration);
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
using Godot;
|
using Godot;
|
||||||
|
using Mr.BrickAdventures;
|
||||||
using Mr.BrickAdventures.Autoloads;
|
using Mr.BrickAdventures.Autoloads;
|
||||||
using Mr.BrickAdventures.scripts.interfaces;
|
using Mr.BrickAdventures.scripts.interfaces;
|
||||||
|
using Mr.BrickAdventures.scripts.State;
|
||||||
|
|
||||||
namespace Mr.BrickAdventures.scripts.components;
|
namespace Mr.BrickAdventures.scripts.components;
|
||||||
|
|
||||||
@@ -12,28 +14,30 @@ public partial class ExitDoorComponent : Area2D, IUnlockable
|
|||||||
[Export] public AudioStreamPlayer2D OpenDoorSfx { get; set; }
|
[Export] public AudioStreamPlayer2D OpenDoorSfx { get; set; }
|
||||||
[Export] public int OpenedDoorFrame { get; set; } = 0;
|
[Export] public int OpenedDoorFrame { get; set; } = 0;
|
||||||
[Export] public string AchievementId = "level_complete_1";
|
[Export] public string AchievementId = "level_complete_1";
|
||||||
|
|
||||||
[Signal] public delegate void ExitTriggeredEventHandler();
|
[Signal] public delegate void ExitTriggeredEventHandler();
|
||||||
|
|
||||||
private GameManager _gameManager;
|
private GameManager _gameManager;
|
||||||
private AchievementManager _achievementManager;
|
private AchievementManager _achievementManager;
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
_gameManager = GetNode<GameManager>("/root/GameManager");
|
_gameManager = GameManager.Instance;
|
||||||
_achievementManager = GetNode<AchievementManager>("/root/AchievementManager");
|
_achievementManager = GetNode<AchievementManager>(Constants.AchievementManagerPath);
|
||||||
|
|
||||||
BodyEntered += OnExitAreaBodyEntered;
|
BodyEntered += OnExitAreaBodyEntered;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnExitAreaBodyEntered(Node2D body)
|
private void OnExitAreaBodyEntered(Node2D body)
|
||||||
{
|
{
|
||||||
if (Locked) return;
|
if (Locked) return;
|
||||||
|
|
||||||
EmitSignalExitTriggered();
|
EmitSignalExitTriggered();
|
||||||
_achievementManager.UnlockAchievement(AchievementId);
|
_achievementManager.UnlockAchievement(AchievementId);
|
||||||
_gameManager.UnlockLevel((int)_gameManager.PlayerState["current_level"] + 1);
|
// Get current level from GameStateStore
|
||||||
|
var currentLevel = GameStateStore.Instance?.Session.CurrentLevel ?? 0;
|
||||||
|
_gameManager.UnlockLevel(currentLevel + 1);
|
||||||
CallDeferred(nameof(GoToNextLevel));
|
CallDeferred(nameof(GoToNextLevel));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,62 +5,59 @@ using Mr.BrickAdventures.scripts.Resources;
|
|||||||
namespace Mr.BrickAdventures.scripts.components;
|
namespace Mr.BrickAdventures.scripts.components;
|
||||||
|
|
||||||
[GlobalClass]
|
[GlobalClass]
|
||||||
public partial class GroundPoundSkillComponent : Node, ISkill
|
public partial class GroundPoundSkillComponent : SkillComponentBase
|
||||||
{
|
{
|
||||||
[Export] public float PoundForce { get; set; } = 1200f;
|
[Export] public float PoundForce { get; set; } = 1200f;
|
||||||
[Export] public PackedScene ShockwaveScene { get; set; }
|
[Export] public PackedScene ShockwaveScene { get; set; }
|
||||||
|
|
||||||
private PlayerController _player;
|
|
||||||
private PlayerInputHandler _input;
|
private PlayerInputHandler _input;
|
||||||
private bool _isPounding = false;
|
private bool _isPounding = false;
|
||||||
|
|
||||||
public void Initialize(Node owner, SkillData data)
|
public override void Initialize(Node owner, SkillData data)
|
||||||
{
|
{
|
||||||
_player = owner as PlayerController;
|
base.Initialize(owner, data);
|
||||||
if (_player != null)
|
if (Player != null)
|
||||||
{
|
{
|
||||||
_input = _player.GetNode<PlayerInputHandler>("PlayerInputHandler");
|
_input = Player.GetNode<PlayerInputHandler>("PlayerInputHandler");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void _PhysicsProcess(double delta)
|
public override void _PhysicsProcess(double delta)
|
||||||
{
|
{
|
||||||
if (_player == null || _input == null)
|
if (Player == null || _input == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if we just landed from a ground pound to create the shockwave.
|
// Check if we just landed from a ground pound to create the shockwave.
|
||||||
if (_isPounding && _player.IsOnFloor())
|
if (_isPounding && Player.IsOnFloor())
|
||||||
{
|
{
|
||||||
_isPounding = false;
|
_isPounding = false;
|
||||||
if (ShockwaveScene != null)
|
if (ShockwaveScene != null)
|
||||||
{
|
{
|
||||||
var shockwave = ShockwaveScene.Instantiate<Node2D>();
|
var shockwave = ShockwaveScene.Instantiate<Node2D>();
|
||||||
_player.GetParent()?.AddChild(shockwave);
|
Player.GetParent()?.AddChild(shockwave);
|
||||||
shockwave.GlobalPosition = _player.GlobalPosition;
|
shockwave.GlobalPosition = Player.GlobalPosition;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check to initiate a ground pound. The player must be in the air.
|
// Check to initiate a ground pound. The player must be in the air.
|
||||||
if (_input.DownHeld && !_player.IsOnFloor() && !_isPounding)
|
if (_input.DownHeld && !Player.IsOnFloor() && !_isPounding)
|
||||||
{
|
{
|
||||||
// Apply a strong downward force, zeroing out horizontal movement.
|
// Apply a strong downward force, zeroing out horizontal movement.
|
||||||
_player.Velocity = new Vector2(0, PoundForce);
|
Player.Velocity = new Vector2(0, PoundForce);
|
||||||
_isPounding = true;
|
_isPounding = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Activate()
|
public override void Activate()
|
||||||
{
|
{
|
||||||
SetPhysicsProcess(true);
|
SetPhysicsProcess(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Deactivate()
|
public override void Deactivate()
|
||||||
{
|
{
|
||||||
SetPhysicsProcess(false);
|
SetPhysicsProcess(false);
|
||||||
_isPounding = false;
|
_isPounding = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ApplyUpgrade(SkillUpgrade upgrade) { }
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
using Mr.BrickAdventures;
|
||||||
using Mr.BrickAdventures.Autoloads;
|
using Mr.BrickAdventures.Autoloads;
|
||||||
|
|
||||||
namespace Mr.BrickAdventures.scripts.components;
|
namespace Mr.BrickAdventures.scripts.components;
|
||||||
@@ -11,22 +12,22 @@ public partial class HealthComponent : Node2D
|
|||||||
[Export] public float MaxHealth { get; set; } = 1.0f;
|
[Export] public float MaxHealth { get; set; } = 1.0f;
|
||||||
[Export] public AudioStreamPlayer2D HurtSfx { get; set; }
|
[Export] public AudioStreamPlayer2D HurtSfx { get; set; }
|
||||||
[Export] public AudioStreamPlayer2D HealSfx { get; set; }
|
[Export] public AudioStreamPlayer2D HealSfx { get; set; }
|
||||||
|
|
||||||
[Signal] public delegate void HealthChangedEventHandler(float delta, float totalHealth);
|
[Signal] public delegate void HealthChangedEventHandler(float delta, float totalHealth);
|
||||||
[Signal] public delegate void DeathEventHandler();
|
[Signal] public delegate void DeathEventHandler();
|
||||||
|
|
||||||
private FloatingTextManager _floatingTextManager;
|
private FloatingTextManager _floatingTextManager;
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
_floatingTextManager = GetNode<FloatingTextManager>("/root/FloatingTextManager");
|
_floatingTextManager = GetNode<FloatingTextManager>(Constants.FloatingTextManagerPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetHealth(float newValue)
|
public void SetHealth(float newValue)
|
||||||
{
|
{
|
||||||
_ = ApplyHealthChange(newValue);
|
_ = ApplyHealthChange(newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void IncreaseHealth(float delta)
|
public void IncreaseHealth(float delta)
|
||||||
{
|
{
|
||||||
_ = ApplyHealthChange(Health + delta);
|
_ = ApplyHealthChange(Health + delta);
|
||||||
@@ -46,7 +47,7 @@ public partial class HealthComponent : Node2D
|
|||||||
|
|
||||||
if (delta == 0.0f)
|
if (delta == 0.0f)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (delta < 0.0f)
|
if (delta < 0.0f)
|
||||||
_floatingTextManager?.ShowDamage(Mathf.Abs(delta), GlobalPosition);
|
_floatingTextManager?.ShowDamage(Mathf.Abs(delta), GlobalPosition);
|
||||||
else
|
else
|
||||||
@@ -64,16 +65,27 @@ public partial class HealthComponent : Node2D
|
|||||||
await HurtSfx.ToSignal(HurtSfx, AudioStreamPlayer2D.SignalName.Finished);
|
await HurtSfx.ToSignal(HurtSfx, AudioStreamPlayer2D.SignalName.Finished);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Health = newHealth;
|
Health = newHealth;
|
||||||
|
|
||||||
if (Health <= 0f)
|
if (Health <= 0f)
|
||||||
{
|
{
|
||||||
EmitSignalDeath();
|
EmitSignalDeath();
|
||||||
|
// Emit global event if this is the player
|
||||||
|
if (Owner is PlayerController)
|
||||||
|
EventBus.EmitPlayerDied(GlobalPosition);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
EmitSignalHealthChanged(delta, Health);
|
EmitSignalHealthChanged(delta, Health);
|
||||||
|
// Emit global events if this is the player
|
||||||
|
if (Owner is PlayerController)
|
||||||
|
{
|
||||||
|
if (delta < 0f)
|
||||||
|
EventBus.EmitPlayerDamaged(Mathf.Abs(delta), Health, GlobalPosition);
|
||||||
|
else
|
||||||
|
EventBus.EmitPlayerHealed(delta, Health, GlobalPosition);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
using Mr.BrickAdventures;
|
||||||
using Mr.BrickAdventures.Autoloads;
|
using Mr.BrickAdventures.Autoloads;
|
||||||
|
|
||||||
namespace Mr.BrickAdventures.scripts.components;
|
namespace Mr.BrickAdventures.scripts.components;
|
||||||
@@ -15,25 +16,25 @@ public partial class LeverComponent : Node
|
|||||||
|
|
||||||
[Signal]
|
[Signal]
|
||||||
public delegate void ActivatedEventHandler();
|
public delegate void ActivatedEventHandler();
|
||||||
|
|
||||||
private FloatingTextManager _floatingTextManager;
|
private FloatingTextManager _floatingTextManager;
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
_floatingTextManager = GetNode<FloatingTextManager>("/root/FloatingTextManager");
|
_floatingTextManager = GetNode<FloatingTextManager>(Constants.FloatingTextManagerPath);
|
||||||
|
|
||||||
if (Area == null)
|
if (Area == null)
|
||||||
{
|
{
|
||||||
GD.PushError("LeverComponent: Area is not set.");
|
GD.PushError("LeverComponent: Area is not set.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Sprite == null)
|
if (Sprite == null)
|
||||||
{
|
{
|
||||||
GD.PushError("LeverComponent: Sprite is not set.");
|
GD.PushError("LeverComponent: Sprite is not set.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Area.BodyEntered += OnBodyEntered;
|
Area.BodyEntered += OnBodyEntered;
|
||||||
Area.AreaEntered += OnAreaEntered;
|
Area.AreaEntered += OnAreaEntered;
|
||||||
}
|
}
|
||||||
@@ -58,7 +59,7 @@ public partial class LeverComponent : Node
|
|||||||
await timer.ToSignal(timer, Timer.SignalName.Timeout);
|
await timer.ToSignal(timer, Timer.SignalName.Timeout);
|
||||||
Sprite.Frame = StartAnimationIndex;
|
Sprite.Frame = StartAnimationIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleTriggerLogic(Node2D obj)
|
private void HandleTriggerLogic(Node2D obj)
|
||||||
{
|
{
|
||||||
var triggerLever = obj.GetNodeOrNull<TriggerLeverComponent>("TriggerLeverComponent");
|
var triggerLever = obj.GetNodeOrNull<TriggerLeverComponent>("TriggerLeverComponent");
|
||||||
|
|||||||
@@ -7,14 +7,12 @@ using Mr.BrickAdventures.scripts.Resources;
|
|||||||
namespace Mr.BrickAdventures.scripts.components;
|
namespace Mr.BrickAdventures.scripts.components;
|
||||||
|
|
||||||
[GlobalClass]
|
[GlobalClass]
|
||||||
public partial class MagneticSkillComponent : Node, ISkill
|
public partial class MagneticSkillComponent : SkillComponentBase
|
||||||
{
|
{
|
||||||
[Export] public Area2D MagneticArea { get; set; }
|
[Export] public Area2D MagneticArea { get; set; }
|
||||||
[Export] public float MagneticMoveDuration { get; set; } = 1.25f;
|
[Export] public float MagneticMoveDuration { get; set; } = 1.25f;
|
||||||
|
|
||||||
private Array<Node2D> _collectablesToPickUp = [];
|
private Array<Node2D> _collectablesToPickUp = [];
|
||||||
private Node2D _owner;
|
|
||||||
private SkillData _skillData;
|
|
||||||
|
|
||||||
public override void _Process(double delta)
|
public override void _Process(double delta)
|
||||||
{
|
{
|
||||||
@@ -25,11 +23,11 @@ public partial class MagneticSkillComponent : Node, ISkill
|
|||||||
_collectablesToPickUp.Remove(collectable);
|
_collectablesToPickUp.Remove(collectable);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
MoveCollectableToOwner(collectable);
|
MoveCollectableToOwner(collectable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnBodyEntered(Node2D body)
|
private void OnBodyEntered(Node2D body)
|
||||||
{
|
{
|
||||||
if (!HasComponentInChildren(body, "CollectableComponent")) return;
|
if (!HasComponentInChildren(body, "CollectableComponent")) return;
|
||||||
@@ -37,11 +35,11 @@ public partial class MagneticSkillComponent : Node, ISkill
|
|||||||
if (_collectablesToPickUp.Contains(body)) return;
|
if (_collectablesToPickUp.Contains(body)) return;
|
||||||
_collectablesToPickUp.Add(body);
|
_collectablesToPickUp.Add(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnAreaEntered(Area2D area)
|
private void OnAreaEntered(Area2D area)
|
||||||
{
|
{
|
||||||
if (!HasComponentInChildren(area, "CollectableComponent")) return;
|
if (!HasComponentInChildren(area, "CollectableComponent")) return;
|
||||||
|
|
||||||
if (_collectablesToPickUp.Contains(area)) return;
|
if (_collectablesToPickUp.Contains(area)) return;
|
||||||
_collectablesToPickUp.Add(area);
|
_collectablesToPickUp.Add(area);
|
||||||
}
|
}
|
||||||
@@ -49,7 +47,7 @@ public partial class MagneticSkillComponent : Node, ISkill
|
|||||||
private bool HasComponentInChildren(Node node, string componentName)
|
private bool HasComponentInChildren(Node node, string componentName)
|
||||||
{
|
{
|
||||||
if (node == null) return false;
|
if (node == null) return false;
|
||||||
|
|
||||||
if (node.HasNode(componentName)) return true;
|
if (node.HasNode(componentName)) return true;
|
||||||
|
|
||||||
foreach (var child in node.GetChildren())
|
foreach (var child in node.GetChildren())
|
||||||
@@ -59,28 +57,27 @@ public partial class MagneticSkillComponent : Node, ISkill
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MoveCollectableToOwner(Node2D collectable)
|
private void MoveCollectableToOwner(Node2D collectable)
|
||||||
{
|
{
|
||||||
if (!IsInstanceValid(collectable) || !IsInstanceValid(_owner)) return;
|
if (!IsInstanceValid(collectable) || !IsInstanceValid(Player)) return;
|
||||||
|
|
||||||
var direction = (_owner.GlobalPosition - collectable.GlobalPosition).Normalized();
|
var direction = (Player.GlobalPosition - collectable.GlobalPosition).Normalized();
|
||||||
var speed = direction.Length() / MagneticMoveDuration;
|
var speed = direction.Length() / MagneticMoveDuration;
|
||||||
|
|
||||||
collectable.GlobalPosition += direction.Normalized() * speed;
|
collectable.GlobalPosition += direction.Normalized() * speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialize(Node owner, SkillData data)
|
public override void Initialize(Node owner, SkillData data)
|
||||||
{
|
{
|
||||||
_owner = owner as Node2D;
|
base.Initialize(owner, data);
|
||||||
_skillData = data;
|
|
||||||
|
if (Player == null)
|
||||||
if (_owner == null)
|
|
||||||
{
|
{
|
||||||
GD.PushWarning("MagneticSkillComponent: Owner is not a Node2D.");
|
GD.PushWarning("MagneticSkillComponent: Owner is not a Player/Node2D.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MagneticArea == null)
|
if (MagneticArea == null)
|
||||||
@@ -96,34 +93,34 @@ public partial class MagneticSkillComponent : Node, ISkill
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_skillData.Level > 0 && _skillData.Upgrades.Count >= _skillData.Level)
|
if (Data.Level > 0 && Data.Upgrades.Count >= Data.Level)
|
||||||
{
|
{
|
||||||
ApplyUpgrade(_skillData.Upgrades[_skillData.Level - 1]);
|
ApplyUpgrade(Data.Upgrades[Data.Level - 1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Activate()
|
public override void Activate()
|
||||||
{
|
{
|
||||||
if (MagneticArea == null)
|
if (MagneticArea == null)
|
||||||
{
|
{
|
||||||
GD.PushError("MagneticSkillComponent: MagneticArea is not set.");
|
GD.PushError("MagneticSkillComponent: MagneticArea is not set.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MagneticArea.BodyEntered += OnBodyEntered;
|
MagneticArea.BodyEntered += OnBodyEntered;
|
||||||
MagneticArea.AreaEntered += OnAreaEntered;
|
MagneticArea.AreaEntered += OnAreaEntered;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Deactivate()
|
public override void Deactivate()
|
||||||
{
|
{
|
||||||
if (MagneticArea == null) return;
|
if (MagneticArea == null) return;
|
||||||
|
|
||||||
MagneticArea.BodyEntered -= OnBodyEntered;
|
MagneticArea.BodyEntered -= OnBodyEntered;
|
||||||
MagneticArea.AreaEntered -= OnAreaEntered;
|
MagneticArea.AreaEntered -= OnAreaEntered;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ApplyUpgrade(SkillUpgrade upgrade)
|
public override void ApplyUpgrade(SkillUpgrade upgrade)
|
||||||
{
|
{
|
||||||
foreach (var property in upgrade.Properties)
|
foreach (var property in upgrade.Properties)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
using Mr.BrickAdventures;
|
||||||
using Mr.BrickAdventures.Autoloads;
|
using Mr.BrickAdventures.Autoloads;
|
||||||
|
|
||||||
namespace Mr.BrickAdventures.scripts.components;
|
namespace Mr.BrickAdventures.scripts.components;
|
||||||
@@ -10,7 +11,7 @@ namespace Mr.BrickAdventures.scripts.components;
|
|||||||
public partial class PlayerController : CharacterBody2D
|
public partial class PlayerController : CharacterBody2D
|
||||||
{
|
{
|
||||||
[Export] private Node MovementAbilitiesContainer { get; set; }
|
[Export] private Node MovementAbilitiesContainer { get; set; }
|
||||||
|
|
||||||
[ExportGroup("Movement Ability Scenes")]
|
[ExportGroup("Movement Ability Scenes")]
|
||||||
[Export] public PackedScene GroundMovementScene { get; set; }
|
[Export] public PackedScene GroundMovementScene { get; set; }
|
||||||
[Export] public PackedScene JumpMovementScene { get; set; }
|
[Export] public PackedScene JumpMovementScene { get; set; }
|
||||||
@@ -19,23 +20,23 @@ public partial class PlayerController : CharacterBody2D
|
|||||||
[Export] public PackedScene SpaceshipMovementScene { get; set; }
|
[Export] public PackedScene SpaceshipMovementScene { get; set; }
|
||||||
[Export] public PackedScene WallJumpScene { get; set; }
|
[Export] public PackedScene WallJumpScene { get; set; }
|
||||||
[Export] public PackedScene GridMovementScene { get; set; }
|
[Export] public PackedScene GridMovementScene { get; set; }
|
||||||
|
|
||||||
[Signal] public delegate void JumpInitiatedEventHandler();
|
[Signal] public delegate void JumpInitiatedEventHandler();
|
||||||
[Signal] public delegate void MovementAbilitiesChangedEventHandler();
|
[Signal] public delegate void MovementAbilitiesChangedEventHandler();
|
||||||
|
|
||||||
public Vector2 LastDirection { get; private set; } = Vector2.Right;
|
public Vector2 LastDirection { get; private set; } = Vector2.Right;
|
||||||
public Vector2 PreviousVelocity { get; private set; } = Vector2.Zero;
|
public Vector2 PreviousVelocity { get; private set; } = Vector2.Zero;
|
||||||
|
|
||||||
private List<MovementAbility> _abilities = [];
|
private List<MovementAbility> _abilities = [];
|
||||||
private PlayerInputHandler _inputHandler;
|
private PlayerInputHandler _inputHandler;
|
||||||
|
|
||||||
public IReadOnlyList<MovementAbility> GetActiveAbilities() => _abilities;
|
public IReadOnlyList<MovementAbility> GetActiveAbilities() => _abilities;
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
var skillManager = GetNodeOrNull<SkillManager>("/root/SkillManager");
|
var skillManager = GetNodeOrNull<SkillManager>(Constants.SkillManagerPath);
|
||||||
skillManager?.RegisterPlayer(this);
|
skillManager?.RegisterPlayer(this);
|
||||||
|
|
||||||
_inputHandler = GetNode<PlayerInputHandler>("PlayerInputHandler");
|
_inputHandler = GetNode<PlayerInputHandler>("PlayerInputHandler");
|
||||||
foreach (var child in MovementAbilitiesContainer.GetChildren())
|
foreach (var child in MovementAbilitiesContainer.GetChildren())
|
||||||
{
|
{
|
||||||
@@ -45,20 +46,20 @@ public partial class PlayerController : CharacterBody2D
|
|||||||
_abilities.Add(ability);
|
_abilities.Add(ability);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_ = ConnectJumpAndGravityAbilities();
|
_ = ConnectJumpAndGravityAbilities();
|
||||||
EmitSignalMovementAbilitiesChanged();
|
EmitSignalMovementAbilitiesChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void _PhysicsProcess(double delta)
|
public override void _PhysicsProcess(double delta)
|
||||||
{
|
{
|
||||||
var velocity = Velocity;
|
var velocity = Velocity;
|
||||||
|
|
||||||
foreach (var ability in _abilities)
|
foreach (var ability in _abilities)
|
||||||
{
|
{
|
||||||
velocity = ability.ProcessMovement(velocity, delta);
|
velocity = ability.ProcessMovement(velocity, delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_inputHandler.MoveDirection.X != 0)
|
if (_inputHandler.MoveDirection.X != 0)
|
||||||
{
|
{
|
||||||
LastDirection = new Vector2(_inputHandler.MoveDirection.X > 0 ? 1 : -1, 0);
|
LastDirection = new Vector2(_inputHandler.MoveDirection.X > 0 ? 1 : -1, 0);
|
||||||
@@ -68,14 +69,14 @@ public partial class PlayerController : CharacterBody2D
|
|||||||
Velocity = velocity;
|
Velocity = velocity;
|
||||||
MoveAndSlide();
|
MoveAndSlide();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddAbility(MovementAbility ability)
|
public void AddAbility(MovementAbility ability)
|
||||||
{
|
{
|
||||||
MovementAbilitiesContainer.AddChild(ability);
|
MovementAbilitiesContainer.AddChild(ability);
|
||||||
ability.Initialize(this);
|
ability.Initialize(this);
|
||||||
_abilities.Add(ability);
|
_abilities.Add(ability);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClearMovementAbilities()
|
public void ClearMovementAbilities()
|
||||||
{
|
{
|
||||||
foreach (var ability in _abilities)
|
foreach (var ability in _abilities)
|
||||||
@@ -84,7 +85,7 @@ public partial class PlayerController : CharacterBody2D
|
|||||||
}
|
}
|
||||||
_abilities.Clear();
|
_abilities.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveAbility<T>() where T : MovementAbility
|
public void RemoveAbility<T>() where T : MovementAbility
|
||||||
{
|
{
|
||||||
for (var i = _abilities.Count - 1; i >= 0; i--)
|
for (var i = _abilities.Count - 1; i >= 0; i--)
|
||||||
@@ -102,20 +103,20 @@ public partial class PlayerController : CharacterBody2D
|
|||||||
public void SetPlatformMovement()
|
public void SetPlatformMovement()
|
||||||
{
|
{
|
||||||
ClearMovementAbilities();
|
ClearMovementAbilities();
|
||||||
|
|
||||||
if (GroundMovementScene != null) AddAbility(GroundMovementScene.Instantiate<MovementAbility>());
|
if (GroundMovementScene != null) AddAbility(GroundMovementScene.Instantiate<MovementAbility>());
|
||||||
if (JumpMovementScene != null) AddAbility(JumpMovementScene.Instantiate<MovementAbility>());
|
if (JumpMovementScene != null) AddAbility(JumpMovementScene.Instantiate<MovementAbility>());
|
||||||
if (GravityScene != null) AddAbility(GravityScene.Instantiate<MovementAbility>());
|
if (GravityScene != null) AddAbility(GravityScene.Instantiate<MovementAbility>());
|
||||||
if (OneWayPlatformScene != null) AddAbility(OneWayPlatformScene.Instantiate<MovementAbility>());
|
if (OneWayPlatformScene != null) AddAbility(OneWayPlatformScene.Instantiate<MovementAbility>());
|
||||||
|
|
||||||
_ = ConnectJumpAndGravityAbilities();
|
_ = ConnectJumpAndGravityAbilities();
|
||||||
EmitSignalMovementAbilitiesChanged();
|
EmitSignalMovementAbilitiesChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetSpaceshipMovement()
|
public void SetSpaceshipMovement()
|
||||||
{
|
{
|
||||||
ClearMovementAbilities();
|
ClearMovementAbilities();
|
||||||
|
|
||||||
if (SpaceshipMovementScene != null) AddAbility(SpaceshipMovementScene.Instantiate<MovementAbility>());
|
if (SpaceshipMovementScene != null) AddAbility(SpaceshipMovementScene.Instantiate<MovementAbility>());
|
||||||
EmitSignalMovementAbilitiesChanged();
|
EmitSignalMovementAbilitiesChanged();
|
||||||
}
|
}
|
||||||
@@ -130,10 +131,10 @@ public partial class PlayerController : CharacterBody2D
|
|||||||
private async Task ConnectJumpAndGravityAbilities()
|
private async Task ConnectJumpAndGravityAbilities()
|
||||||
{
|
{
|
||||||
await ToSignal(GetTree(), SceneTree.SignalName.ProcessFrame);
|
await ToSignal(GetTree(), SceneTree.SignalName.ProcessFrame);
|
||||||
|
|
||||||
var jumpAbility = _abilities.OfType<VariableJumpAbility>().FirstOrDefault();
|
var jumpAbility = _abilities.OfType<VariableJumpAbility>().FirstOrDefault();
|
||||||
var gravityAbility = _abilities.OfType<GravityAbility>().FirstOrDefault();
|
var gravityAbility = _abilities.OfType<GravityAbility>().FirstOrDefault();
|
||||||
|
|
||||||
if (jumpAbility != null && gravityAbility != null)
|
if (jumpAbility != null && gravityAbility != null)
|
||||||
{
|
{
|
||||||
gravityAbility.AscendGravity = jumpAbility.AscendGravity;
|
gravityAbility.AscendGravity = jumpAbility.AscendGravity;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Godot;
|
using Godot;
|
||||||
|
using Mr.BrickAdventures;
|
||||||
using Mr.BrickAdventures.Autoloads;
|
using Mr.BrickAdventures.Autoloads;
|
||||||
|
|
||||||
namespace Mr.BrickAdventures.scripts.components;
|
namespace Mr.BrickAdventures.scripts.components;
|
||||||
@@ -10,12 +11,12 @@ public partial class PlayerDeathComponent : Node2D
|
|||||||
[Export] public PackedScene DeathEffect { get; set; }
|
[Export] public PackedScene DeathEffect { get; set; }
|
||||||
[Export] public HealthComponent HealthComponent { get; set; }
|
[Export] public HealthComponent HealthComponent { get; set; }
|
||||||
[Export] public Vector2 EffectScale { get; set; } = new Vector2(1.5f, 1.5f);
|
[Export] public Vector2 EffectScale { get; set; } = new Vector2(1.5f, 1.5f);
|
||||||
|
|
||||||
private GameManager _gameManager;
|
private GameManager _gameManager;
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
_gameManager = GetNode<GameManager>("/root/GameManager");
|
_gameManager = GameManager.Instance;
|
||||||
HealthComponent.Death += OnDeath;
|
HealthComponent.Death += OnDeath;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,8 +31,8 @@ public partial class PlayerDeathComponent : Node2D
|
|||||||
effect.GlobalPosition = GlobalPosition;
|
effect.GlobalPosition = GlobalPosition;
|
||||||
effect.Scale = EffectScale;
|
effect.Scale = EffectScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
_gameManager.RemoveLives(1);
|
// Lives are now decremented by LivesStateHandler via PlayerDied event
|
||||||
_gameManager.ResetCurrentSessionState();
|
// Session state is reset by LivesStateHandler as well
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -18,6 +18,11 @@ public partial class RequirementComponent : Node
|
|||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
|
if (RequirementType == CollectableType.None)
|
||||||
|
{
|
||||||
|
EmitSignalRequirementMet(RequirementType);
|
||||||
|
}
|
||||||
|
|
||||||
var collectables = GetTree().GetNodesInGroup(CollectableGroupName);
|
var collectables = GetTree().GetNodesInGroup(CollectableGroupName);
|
||||||
foreach (var collectable in collectables)
|
foreach (var collectable in collectables)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
using Godot;
|
|
||||||
using Mr.BrickAdventures.Autoloads;
|
|
||||||
using Mr.BrickAdventures.scripts.Resources;
|
|
||||||
|
|
||||||
namespace Mr.BrickAdventures.scripts.components;
|
|
||||||
|
|
||||||
[GlobalClass]
|
|
||||||
public partial class ScoreComponent : Node
|
|
||||||
{
|
|
||||||
private GameManager _gameManager;
|
|
||||||
private const string CoinsGroupName = "coins";
|
|
||||||
|
|
||||||
public override async void _Ready()
|
|
||||||
{
|
|
||||||
await ToSignal(GetTree(), SceneTree.SignalName.ProcessFrame);
|
|
||||||
|
|
||||||
_gameManager = GetNode<GameManager>("/root/GameManager");
|
|
||||||
if (_gameManager == null)
|
|
||||||
{
|
|
||||||
GD.PrintErr("GameManager not found in the scene tree.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var coins = GetTree().GetNodesInGroup(CoinsGroupName);
|
|
||||||
foreach (var coin in coins)
|
|
||||||
{
|
|
||||||
var c = coin.GetNodeOrNull<CollectableComponent>("CollectableComponent");
|
|
||||||
if (c != null)
|
|
||||||
{
|
|
||||||
c.Collected += OnCollected;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnCollected(float amount, CollectableType type, Node2D body)
|
|
||||||
{
|
|
||||||
if (type != CollectableType.Coin) return;
|
|
||||||
|
|
||||||
var coinAmount = (int)amount;
|
|
||||||
var currentCoins = (int)_gameManager.CurrentSessionState["coins_collected"];
|
|
||||||
_gameManager.CurrentSessionState["coins_collected"] = currentCoins + coinAmount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://ccqb8kd5m0eh7
|
|
||||||
29
scripts/components/SkillComponentBase.cs
Normal file
29
scripts/components/SkillComponentBase.cs
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
using Godot;
|
||||||
|
using Mr.BrickAdventures.scripts.interfaces;
|
||||||
|
using Mr.BrickAdventures.scripts.Resources;
|
||||||
|
|
||||||
|
namespace Mr.BrickAdventures.scripts.components;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Base class for all skill components to reduce boilerplate.
|
||||||
|
/// </summary>
|
||||||
|
public abstract partial class SkillComponentBase : Node, ISkill
|
||||||
|
{
|
||||||
|
protected PlayerController Player { get; private set; }
|
||||||
|
protected SkillData Data { get; private set; }
|
||||||
|
|
||||||
|
public virtual void Initialize(Node owner, SkillData data)
|
||||||
|
{
|
||||||
|
Player = owner as PlayerController;
|
||||||
|
Data = data;
|
||||||
|
|
||||||
|
if (Player == null)
|
||||||
|
{
|
||||||
|
GD.PrintErr($"{GetType().Name} must be a child of a PlayerController.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void Activate();
|
||||||
|
public abstract void Deactivate();
|
||||||
|
public virtual void ApplyUpgrade(SkillUpgrade upgrade) { }
|
||||||
|
}
|
||||||
1
scripts/components/SkillComponentBase.cs.uid
Normal file
1
scripts/components/SkillComponentBase.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://dvuevrf5vr5jk
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
using Godot;
|
using Godot;
|
||||||
using Godot.Collections;
|
using Godot.Collections;
|
||||||
|
using Mr.BrickAdventures;
|
||||||
using Mr.BrickAdventures.Autoloads;
|
using Mr.BrickAdventures.Autoloads;
|
||||||
using Mr.BrickAdventures.scripts.interfaces;
|
using Mr.BrickAdventures.scripts.interfaces;
|
||||||
using Mr.BrickAdventures.scripts.Resources;
|
using Mr.BrickAdventures.scripts.Resources;
|
||||||
|
using Mr.BrickAdventures.scripts.State;
|
||||||
|
|
||||||
namespace Mr.BrickAdventures.scripts.components;
|
namespace Mr.BrickAdventures.scripts.components;
|
||||||
|
|
||||||
@@ -18,8 +20,8 @@ public partial class SkillUnlockerComponent : Node
|
|||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
_gameManager = GetNode<GameManager>("/root/GameManager");
|
_gameManager = GameManager.Instance;
|
||||||
SkillManager = GetNode<SkillManager>("/root/SkillManager");
|
SkillManager = SkillManager.Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool HasEnoughCoins(int amount)
|
private bool HasEnoughCoins(int amount)
|
||||||
@@ -34,11 +36,10 @@ public partial class SkillUnlockerComponent : Node
|
|||||||
if (!HasEnoughCoins(skill.Upgrades[0].Cost)) return false;
|
if (!HasEnoughCoins(skill.Upgrades[0].Cost)) return false;
|
||||||
|
|
||||||
skill.Level = 1;
|
skill.Level = 1;
|
||||||
skill.IsActive = true;
|
|
||||||
_gameManager.RemoveCoins(skill.Upgrades[0].Cost);
|
_gameManager.RemoveCoins(skill.Upgrades[0].Cost);
|
||||||
|
|
||||||
var skillsUnlocked = (Array<SkillData>)_gameManager.CurrentSessionState["skills_unlocked"];
|
// Add to session state via GameStateStore
|
||||||
skillsUnlocked.Add(skill);
|
GameStateStore.Instance?.UnlockSkillInSession(skill);
|
||||||
SkillManager.AddSkill(skill);
|
SkillManager.AddSkill(skill);
|
||||||
EmitSignalSkillUnlocked(skill);
|
EmitSignalSkillUnlocked(skill);
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,11 @@ public partial class UnlockOnRequirementComponent : Node
|
|||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
RequirementComponent.RequirementMet += OnRequirementMet;
|
RequirementComponent.RequirementMet += OnRequirementMet;
|
||||||
|
|
||||||
|
if (RequirementComponent.RequirementType == CollectableType.None)
|
||||||
|
{
|
||||||
|
OnRequirementMet(RequirementComponent.RequirementType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnRequirementMet(CollectableType requirementType)
|
private void OnRequirementMet(CollectableType requirementType)
|
||||||
|
|||||||
@@ -5,18 +5,19 @@ using Mr.BrickAdventures.scripts.Resources;
|
|||||||
namespace Mr.BrickAdventures.scripts.components;
|
namespace Mr.BrickAdventures.scripts.components;
|
||||||
|
|
||||||
[GlobalClass]
|
[GlobalClass]
|
||||||
public partial class XRayVisionSkillComponent : Node, ISkill
|
public partial class XRayVisionSkillComponent : SkillComponentBase
|
||||||
{
|
{
|
||||||
[Export(PropertyHint.Layers2DRender)] public uint SecretLayer { get; set; }
|
[Export(PropertyHint.Layers2DRender)] public uint SecretLayer { get; set; }
|
||||||
[Export] public float Duration { get; set; } = 5.0f;
|
[Export] public float Duration { get; set; } = 5.0f;
|
||||||
|
|
||||||
private Camera2D _camera;
|
private Camera2D _camera;
|
||||||
private Viewport _viewport;
|
private Viewport _viewport;
|
||||||
private uint _originalVisibilityLayer;
|
private uint _originalVisibilityLayer;
|
||||||
private Timer _timer;
|
private Timer _timer;
|
||||||
|
|
||||||
public void Initialize(Node owner, SkillData data)
|
public override void Initialize(Node owner, SkillData data)
|
||||||
{
|
{
|
||||||
|
base.Initialize(owner, data);
|
||||||
_viewport = GetViewport();
|
_viewport = GetViewport();
|
||||||
_camera = GetViewport().GetCamera2D();
|
_camera = GetViewport().GetCamera2D();
|
||||||
_timer = new Timer { OneShot = true };
|
_timer = new Timer { OneShot = true };
|
||||||
@@ -24,16 +25,16 @@ public partial class XRayVisionSkillComponent : Node, ISkill
|
|||||||
_timer.Timeout += Deactivate;
|
_timer.Timeout += Deactivate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Activate()
|
public override void Activate()
|
||||||
{
|
{
|
||||||
if (_camera == null) return;
|
if (_camera == null) return;
|
||||||
|
|
||||||
_originalVisibilityLayer = _camera.VisibilityLayer;
|
_originalVisibilityLayer = _camera.VisibilityLayer;
|
||||||
_camera.VisibilityLayer |= SecretLayer;
|
_camera.VisibilityLayer |= SecretLayer;
|
||||||
_timer.Start(Duration);
|
_timer.Start(Duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Deactivate()
|
public override void Deactivate()
|
||||||
{
|
{
|
||||||
if (_camera != null)
|
if (_camera != null)
|
||||||
{
|
{
|
||||||
@@ -41,7 +42,7 @@ public partial class XRayVisionSkillComponent : Node, ISkill
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ApplyUpgrade(SkillUpgrade upgrade)
|
public override void ApplyUpgrade(SkillUpgrade upgrade)
|
||||||
{
|
{
|
||||||
if (upgrade.Properties.TryGetValue("duration", out var newDuration))
|
if (upgrade.Properties.TryGetValue("duration", out var newDuration))
|
||||||
{
|
{
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user