Implement basic structure for combat system and refactor code
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using KernelPanic.Data;
|
||||
|
||||
namespace KernelPanic.Run
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides post-wave reward choice generation contracts.
|
||||
/// </summary>
|
||||
public sealed class RewardService
|
||||
{
|
||||
public IReadOnlyList<RewardChoice> GeneratePostWaveChoices(RunConfig runConfig, int waveNumber)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one selectable reward option after clearing a wave.
|
||||
/// </summary>
|
||||
public readonly struct RewardChoice
|
||||
{
|
||||
public RewardChoice(RewardChoiceType type, CardDefinition card)
|
||||
{
|
||||
Type = type;
|
||||
Card = card;
|
||||
}
|
||||
|
||||
public RewardChoiceType Type { get; }
|
||||
public CardDefinition Card { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Identifies the type of reward choice offered after a wave.
|
||||
/// </summary>
|
||||
public enum RewardChoiceType
|
||||
{
|
||||
AddCard,
|
||||
UpgradeCard,
|
||||
Skip
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a06eada6fbafd6e44ae1d21238a64750
|
||||
@@ -0,0 +1,25 @@
|
||||
using System.Collections.Generic;
|
||||
using KernelPanic.Core;
|
||||
using KernelPanic.Data;
|
||||
|
||||
namespace KernelPanic.Run
|
||||
{
|
||||
/// <summary>
|
||||
/// Describes the player choices and starting deck used to begin a run.
|
||||
/// </summary>
|
||||
public sealed class RunConfig
|
||||
{
|
||||
public RunConfig(DistroDefinition distro, Language primaryLanguage, Language secondaryLanguage, IReadOnlyList<CardDefinition> startingDeck)
|
||||
{
|
||||
Distro = distro;
|
||||
PrimaryLanguage = primaryLanguage;
|
||||
SecondaryLanguage = secondaryLanguage;
|
||||
StartingDeck = startingDeck;
|
||||
}
|
||||
|
||||
public DistroDefinition Distro { get; }
|
||||
public Language PrimaryLanguage { get; }
|
||||
public Language SecondaryLanguage { get; }
|
||||
public IReadOnlyList<CardDefinition> StartingDeck { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0c3d34a2ce0e53b4b8f9a77feb60fb95
|
||||
@@ -0,0 +1,56 @@
|
||||
using KernelPanic.Combat;
|
||||
using KernelPanic.Core;
|
||||
using UnityEngine;
|
||||
|
||||
namespace KernelPanic.Run
|
||||
{
|
||||
/// <summary>
|
||||
/// Coordinates run lifecycle, wave progression, and run-level event handling.
|
||||
/// </summary>
|
||||
public sealed class RunManager : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private CombatManager combatManager;
|
||||
[SerializeField] private int currentWaveNumber;
|
||||
[SerializeField] private bool isRunActive;
|
||||
[SerializeField] private bool isPlayerDead;
|
||||
|
||||
public int CurrentWaveNumber => currentWaveNumber;
|
||||
public bool IsRunActive => isRunActive;
|
||||
public bool IsPlayerDead => isPlayerDead;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
GameEvents.WaveCleared += HandleWaveCleared;
|
||||
GameEvents.RunEnded += HandleRunEnded;
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
GameEvents.WaveCleared -= HandleWaveCleared;
|
||||
GameEvents.RunEnded -= HandleRunEnded;
|
||||
}
|
||||
|
||||
public void StartRun(RunConfig config)
|
||||
{
|
||||
isRunActive = true;
|
||||
isPlayerDead = false;
|
||||
currentWaveNumber = 1;
|
||||
StartCombat();
|
||||
}
|
||||
|
||||
public void StartCombat()
|
||||
{
|
||||
combatManager?.StartCombat();
|
||||
}
|
||||
|
||||
private void HandleWaveCleared(WaveClearedEvent payload)
|
||||
{
|
||||
}
|
||||
|
||||
private void HandleRunEnded(RunEndedEvent payload)
|
||||
{
|
||||
isRunActive = false;
|
||||
isPlayerDead = payload.PlayerDied;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 234cc6c5ca577b64ea44020f5514cebe
|
||||
Reference in New Issue
Block a user