diff options
Diffstat (limited to 'scripts/entities/actors')
20 files changed, 0 insertions, 551 deletions
diff --git a/scripts/entities/actors/AI/BaseAI.cs b/scripts/entities/actors/AI/BaseAI.cs deleted file mode 100644 index 733a61a..0000000 --- a/scripts/entities/actors/AI/BaseAI.cs +++ /dev/null @@ -1,41 +0,0 @@ -using Godot; - -/// <summary> -/// base para as IAs do jogo. -/// </summary> -public abstract partial class BaseAI : Node { - /// <summary> - /// Corpo controlado pela IA. - /// O corpo é a marionete da alma. - /// </summary> - protected Actor body; - - public override void _Ready() - { - base._Ready(); - // Por padrão, a IA é filha do nó de seu corpo. - body = GetParent<Actor>(); - } - - /// <summary> - /// Computa um único turno para o ator controlado. - /// Aviso: NPCs não possuem ações gratuitas. - /// A IA SEMPRE precisa executar uma ação que custe energia. - /// </summary> - public abstract void Perform(); - - /// <summary> - /// Utiliza o pathfinder do mapa para obter um caminho - /// da posição atual do ator para um destino qualquer. - /// </summary> - /// <param name="destination">Destino</param> - /// <returns>Vetor com vetores, passo a passo para chegar no destino.</returns> - public Godot.Collections.Array<Vector2> GetPathTo(Vector2I destination) { - // Arrays do Godot são muito mais confortáveis de manipular, então - // eu converto o Array do C# em um array do Godot antes de retornar o caminho. - Godot.Collections.Array<Vector2> list = []; - Vector2[] path = body.Map_Data.Pathfinder.GetPointPath(body.GridPosition, destination); - list.AddRange(path); - return list; - } -}
\ No newline at end of file diff --git a/scripts/entities/actors/AI/BaseAI.cs.uid b/scripts/entities/actors/AI/BaseAI.cs.uid deleted file mode 100644 index b23724c..0000000 --- a/scripts/entities/actors/AI/BaseAI.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://jgm5qk02hism diff --git a/scripts/entities/actors/AI/HostileEnemyAI.cs b/scripts/entities/actors/AI/HostileEnemyAI.cs deleted file mode 100644 index e7efd26..0000000 --- a/scripts/entities/actors/AI/HostileEnemyAI.cs +++ /dev/null @@ -1,76 +0,0 @@ -using Godot; - -/// <summary> -/// Uma IA simples. Sempre tentará atacar o jogador com ataques corpo a corpo. -/// </summary> -public partial class HostileEnemyAI : BaseAI -{ - /// <summary> - /// Caminho até a última posição conhecida do jogador. - /// </summary> - private Godot.Collections.Array<Vector2> path = []; - - public override void Perform() - { - // O alvo da IA sempre é o jogador. - Player target = body.Map_Data.Player; - // Vetor que parte do inimigo até o jogador. - Vector2I offset = target.GridPosition - body.GridPosition; - // Distância entre o inimigo e o jogador. Leva em consideração somente - // um dos eixos. - int distance = int.Max(int.Abs(offset.X), int.Abs(offset.Y)); - - // A ação executada no turno pode ser de ataque ou de movimento. - Action action; - - // Só faz sentido atacar o jogador se o inimigo estiver visível. - if (body.Map_Data.GetTile(body.GridPosition).IsInView) { - // Se o inimigo consegue ver que o jogador está morto, - // IT'S OVER. - if (!target.IsAlive) { - action = new WaitAction(body); - action.Perform(); - return; - } - - // Se estiver do lado do jogador, ataque. - if (distance <= 1) { - action = new MeleeAction(body, offset); - action.Perform(); - // Executada a ação, acabamos nosso turno aqui. - return; - } - - // Se o inimigo estiver visível para o jogador, - // consideramos que ele também consiga ver o jogador. - // Logo, atualizamos o caminho para a posição atual do jogador. - path = GetPathTo(target.GridPosition); - // O primeiro passo é a posição atual do inimigo, podemos remover. - path.RemoveAt(0); - } - - // Se existir um caminho conhecido para o jogador. - if (path.Count > 0) { - // Pegamos o próximo passo para o destino. - Vector2I destination = (Vector2I) path[0]; - // Se tiver o caminho estiver bloqueado, paramos o nosso turno aqui. - if (body.Map_Data.GetBlockingEntityAtPosition(destination) != null) { - action = new WaitAction(body); - action.Perform(); - return; - } - - // Caso o contrário, criamos uma nova ação de movimentação e a executamos. - action = new MovementAction(body, destination - body.GridPosition); - action.Perform(); - // Podemos remover o passo do caminho. - path.RemoveAt(0); - return; - } - - // Senão, espere. - action = new WaitAction(body); - action.Perform(); - return; - } -}
\ No newline at end of file diff --git a/scripts/entities/actors/AI/HostileEnemyAI.cs.uid b/scripts/entities/actors/AI/HostileEnemyAI.cs.uid deleted file mode 100644 index 0fa2c32..0000000 --- a/scripts/entities/actors/AI/HostileEnemyAI.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://db28cxff4pl3t diff --git a/scripts/entities/actors/Actor.cs b/scripts/entities/actors/Actor.cs deleted file mode 100644 index 1cb1f37..0000000 --- a/scripts/entities/actors/Actor.cs +++ /dev/null @@ -1,215 +0,0 @@ -using Godot; - -/// <summary> -/// A classe de ator define um personagem no jogo. -/// </summary> -[GlobalClass] -public partial class Actor : Entity -{ - /// <summary> - /// Sinal emitido toda vez que o HP mudar. - /// </summary> - /// <param name="hp">Novo HP</param> - /// <param name="maxHp">Quantidade máxima de HP.</param> - [Signal] - public delegate void HealthChangedEventHandler(int hp, int maxHp); - - /// <summary> - /// Sinal emitido se o ator morrer. - /// </summary> - [Signal] - public delegate void DiedEventHandler(); - - - /// <summary> - /// A definição do ator possui caracterísitcas padrões que definem - /// o ator em questão. - /// </summary> - private ActorDefinition definition; - - /// <summary> - /// Se o ator está vivo. - /// </summary> - public bool IsAlive { get => Hp > 0; } - - private int energy; - /// <summary> - /// Utilizado no sistema de turnos. - /// Enquanto o ator tiver energia, ele poderá realizar turnos. - /// </summary> - public int Energy - { - get => energy; - set - { - if (value > Speed) { - energy = Speed; - } else { - energy = value; - } - } - } - /// <summary> - /// Taxa de recarga de energia. - /// </summary> - public int Speed { get => definition.Speed; } - - /// <summary> - /// Executado uma vez por turno, - /// </summary> - public void RechargeEnergy() { - Energy += Speed; - } - - private int hp; - /// <summary> - /// HP máximo do ator. - /// </summary> - public int MaxHp { get; private set; } - /// <summary> - /// HP atual do ator. - /// </summary> - public int Hp { - get => hp; - set { - // Esta propriedade impede que o HP seja maior que o máximo. - hp = int.Clamp(value, 0, MaxHp); - EmitSignal(SignalName.HealthChanged, Hp, MaxHp); - if (hp <= 0) { - Die(); - } - } - } - - private int mp; - /// <summary> - /// Máximo de mana do ator. - /// </summary> - public int MaxMp { get; private set; } - /// <summary> - /// Mana atual do ator. - /// </summary> - public int Mp { - get => mp; - set { - mp = int.Clamp(value, 0, MaxMp); - } - } - - /// <summary> - /// Estatística de ataque - /// </summary> - public int Atk { get; private set; } - - /// <summary> - /// Estatística de defesa. - /// </summary> - public int Def { get; private set; } - - /// <summary> - /// Estatística mental. - /// </summary> - public int Men { get; private set; } - - /// <summary> - /// Move o ator para uma localização. Veja MovementAction. - /// </summary> - /// <param name="offset">Vetor que parte da posição do ator até o seu destino.</param> - public void Walk(Vector2I offset) { - // Cada ator tem um peso no sistema de pathfinding. - // Sempre que ele se mover, removemos seu peso da posição antiga - Map_Data.UnregisterBlockingEntity(this); - GridPosition += offset; - // E colocamos na próxima. - Map_Data.RegisterBlockingEntity(this); - // Este peso influencia o algoritmo de pathfinding. - // Atores evitam caminhos bloqueados. por outros atores. - } - - public Actor(Vector2I initialPosition, MapData map, ActorDefinition definition) : base(initialPosition, map, definition) { - - SetDefinition(definition); - } - - /// <summary> - /// Recupera uma quantidade de HP do ator. - /// </summary> - /// <param name="amount">HP para recuperar</param> - /// <returns>Quanto HP foi realmente recuperado.</returns> - public int Heal(int amount) { - int neoHp = Hp + amount; - - if (neoHp > MaxHp) neoHp = MaxHp; - - int recovered = neoHp - Hp; - Hp = neoHp; - return recovered; - } - - /// <summary> - /// Aplica uma definição de NPC para o ator. - /// Se o ator for um boneco de barro, este método é como um - /// sopro de vida. - /// </summary> - /// <param name="definition">A definição do ator.</param> - public virtual void SetDefinition(ActorDefinition definition) { - base.SetDefinition(definition); - this.definition = definition; - - Type = definition.Type; - - MaxHp = definition.Hp; - Hp = definition.Hp; - MaxMp = definition.Mp; - Mp = definition.Mp; - - Atk = definition.Atk; - Def = definition.Def; - Men = definition.Men; - } - - public virtual void Die() { - //⠀⠀⠀⠀⢠⣤⣤⣤⢠⣤⣤⣤⣤⣄⢀⣠⣤⣤⣄⠀⠀⠀⢀⣠⣤⣤⣄⠀⣤⣤⠀⠀⣠⣤⣤⣤⣤⣤⡄⢠⣤⣤⣤⣄⠀⠀ - //⠀⠀⠀⠀⠈⢹⣿⠉⠈⠉⣿⣿⠉⠉⢾⣿⣉⣉⠙⠀⠀⢀⣾⡟⠉⠉⣿⣧⢸⣿⡄⢠⣿⠏⣿⣿⣉⣉⡁⢸⣿⡏⢉⣿⡷⠀ - //⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⣿⣿⠀⠀⠈⠿⠿⣿⣿⡀⠀⠸⣿⡇⠀⠀⣾⣿⠀⢿⣿⣸⡿⠀⣿⣿⠿⠿⠇⢸⣿⣿⣿⣿⠀⠀ - //⠀⠀⠀⠀⢠⣼⣿⣤⠀⠀⣿⣿⠀⠀⢷⣦⣤⣼⡿⠁⠀⠀⠹⣿⣤⣴⡿⠋⠀⠘⣿⣿⠃⠀⣿⣿⣤⣤⡄⢸⣿⡇⠙⢿⣦⡀ - //⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ - //⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ - //⠀⠀⠀⠀⠀⠀⠀⠀⢀⣰⣶⣶⣶⣿⣿⣿⣿⣷⣶⣤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ - //⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ - //⠀⠀⠀⠀⠀⠀⢀⣾⣿⣿⣿⣿⣿⠿⠛⠛⠻⢿⣿⣿⣿⣿⣿⣿⣿⣶⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ - //⠀⠀⠀⠀⠀⢀⢾⣿⣿⣿⣿⠟⠁⠀⠀⠀⠀⠀⠈⠉⠉⠉⠻⢿⢿⣿⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ - //⠀⠀⠀⠀⢠⠏⢸⣿⣿⡿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠛⠿⢻⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ - //⠀⠀⠀⢀⠇⠀⠈⠿⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⡿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ - //⠀⠀⢀⡞⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠰⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ - //⠀⠀⡸⠀⠀⠀⠀⠀⠀⠀⠀⡼⠛⠳⣄⡀⠀⠐⢿⣦⡀⠀⠀⠀⢠⠃⠀⣸⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ - //⠀⢠⠇⠀⠀⠀⠀⠀⠀⠀⠀⠉⠀⠀⠀⠉⣳⠟⠒⠻⣿⣦⡀⠀⡘⠀⢰⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ - //⢀⠞⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⠃⢠⣄⡀⠈⠙⢿⡌⠁⠀⡞⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ - //⠞⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠳⣄⣈⢻⡿⠃⢰⠟⠲⣼⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ - //⠀⠀⠀⡰⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⡶⢴⠋⠀⠀⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ - //⠀⠀⡴⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠞⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ - //⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⡴⢟⠒⠀⠀⠀⠀⢰⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ - //⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⠏⠀⠀⠈⠉⣿⠇⠀⢀⡎⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ - //⣷⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠠⣤⣤⣀⢰⠏⠉⠙⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ - //⣿⣿⣆⠀⠀⠀⠀⠀⠀⠀⣀⣀⣀⣀⣠⠴⠢⠦⠽⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ - //⣿⣿⣿⣷⡄⣀⡀⠈⠉⠋⢹⠋⠁⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ - //⠿⠿⠿⠿⠿⠦⠈⠀⠀⠀⠸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ - - string deathMessage; - - if (Map_Data.Player == this) { - deathMessage = "Você morreu!"; - } else { - deathMessage = $"{DisplayName} morreu!"; - } - - MessageLogData.Instance.AddMessage(deathMessage); - - Texture = definition.deathTexture; - BlocksMovement = false; - Type = EntityType.CORPSE; - DisplayName= $"Restos mortais de {DisplayName}"; - Map_Data.UnregisterBlockingEntity(this); - EmitSignal(SignalName.Died); - } -}
\ No newline at end of file diff --git a/scripts/entities/actors/Actor.cs.uid b/scripts/entities/actors/Actor.cs.uid deleted file mode 100644 index cf29b40..0000000 --- a/scripts/entities/actors/Actor.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://c0cm4woy8lawl diff --git a/scripts/entities/actors/ActorDefinition.cs b/scripts/entities/actors/ActorDefinition.cs deleted file mode 100644 index 540ede0..0000000 --- a/scripts/entities/actors/ActorDefinition.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Godot; - -/// <summary> -/// Define de forma genérica as características de um ator. -/// </summary> -[GlobalClass] -public partial class ActorDefinition : EntityDefinition -{ - [ExportCategory("Visuals")] - // Sprite de morto - [Export] - public Texture2D deathTexture; - - [ExportCategory("Mechanics")] - [Export] - public int Speed { get; set;} = 10; - - // Estatísticas padrão do ator. - [ExportCategory("Stats")] - [Export] - public int Hp; - [Export] - public int Mp; - [Export] - public int Atk; - [Export] - public int Def; - [Export] - public int Men; -} diff --git a/scripts/entities/actors/ActorDefinition.cs.uid b/scripts/entities/actors/ActorDefinition.cs.uid deleted file mode 100644 index ddcfe02..0000000 --- a/scripts/entities/actors/ActorDefinition.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://crxw1e37xlrrt diff --git a/scripts/entities/actors/Enemy.cs b/scripts/entities/actors/Enemy.cs deleted file mode 100644 index 9c06417..0000000 --- a/scripts/entities/actors/Enemy.cs +++ /dev/null @@ -1,57 +0,0 @@ -using Godot; -using System; - -/// <summary> -/// Enum das diferentes IAs disponíveis. -/// </summary> -public enum AIType -{ - None, - DefaultHostile -}; - -/// <summary> -/// Um inimigo é uma espécie de ator que é -/// hostil ao jogador. Inimigos são controlados por IA. -/// </summary> -public partial class Enemy : Actor -{ - private EnemyDefinition definition; - /// <summary> - /// A alma do ator. Gera ações que são executadas todo turno. - /// </summary> - public BaseAI Soul { get; private set; } - - public Enemy(Vector2I initialPosition, MapData map, EnemyDefinition definition) : base(initialPosition, map, definition) - { - this.definition = definition; - SetDefinition(definition); - } - - /// <summary> - /// Além de definir as características gerais de um ator, - /// também define qual IA utilizar. - /// </summary> - /// <param name="definition">Definição do inimigo.</param> - public void SetDefinition(EnemyDefinition definition) - { - // Definimos as características do ator. - base.SetDefinition(definition); - - // Definimos qual IA utilizar. - switch(definition.AI) { - case AIType.None: - break; - case AIType.DefaultHostile: - Soul = new HostileEnemyAI(); - AddChild(Soul); - break; - } - } - - public override void Die() { - Soul.QueueFree(); - Soul = null; - base.Die(); - } -} diff --git a/scripts/entities/actors/Enemy.cs.uid b/scripts/entities/actors/Enemy.cs.uid deleted file mode 100644 index 93255b7..0000000 --- a/scripts/entities/actors/Enemy.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://bef1fo3vgvxej diff --git a/scripts/entities/actors/EnemyDefinition.cs b/scripts/entities/actors/EnemyDefinition.cs deleted file mode 100644 index e372e3a..0000000 --- a/scripts/entities/actors/EnemyDefinition.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Godot; - -/// <summary> -/// Além das configurações do ator, também possui qual IA utilizar. -/// </summary> -[GlobalClass] -public partial class EnemyDefinition : ActorDefinition { - [ExportCategory("AI")] - [Export] - public AIType AI; -}
\ No newline at end of file diff --git a/scripts/entities/actors/EnemyDefinition.cs.uid b/scripts/entities/actors/EnemyDefinition.cs.uid deleted file mode 100644 index 1ba03e1..0000000 --- a/scripts/entities/actors/EnemyDefinition.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://dkfdm2m2scyks diff --git a/scripts/entities/actors/Inspector.cs b/scripts/entities/actors/Inspector.cs deleted file mode 100644 index e340543..0000000 --- a/scripts/entities/actors/Inspector.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Godot; - -/// <summary> -/// Isto é uma abominação -/// </summary> -public partial class Inspector : Sprite2D -{ - private Vector2I gridPosition = Vector2I.Zero; - /// <summary> - /// Posição do inspetor no espaço. Diferentemente de Position, GridPosition tem como formato - /// os tiles do mapa. - /// </summary> - public Vector2I GridPosition { - set { - gridPosition = value; - // O sistema de coordenadas do Godot é em pixels, mas faz mais sentido para o jogo utilizar coordenadas em tiles. - // Esta propriedade converte um sistema para o outro automaticamente. - Position = Grid.GridToWorld(value); - } - get => gridPosition; - } - - public override void _Ready() { - base._Ready(); - Camera2D camera = GetNode<Camera2D>("Camera2D"); - camera.Enabled = true; - camera.MakeCurrent(); - - SignalBus.Instance.EmitSignal(SignalBus.SignalName.InspectorMoved, GridPosition); - } - - /// <summary> - /// O Inspetor não faz parte do mapa. - /// </summary> - /// <param name="offset"></param> - public void Walk(Vector2I offset) { - GridPosition += offset; - SignalBus.Instance.EmitSignal(SignalBus.SignalName.InspectorMoved, GridPosition); - } -}
\ No newline at end of file diff --git a/scripts/entities/actors/Inspector.cs.uid b/scripts/entities/actors/Inspector.cs.uid deleted file mode 100644 index ca411e4..0000000 --- a/scripts/entities/actors/Inspector.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://dxsrtu4b3pi08 diff --git a/scripts/entities/actors/Inventory.cs b/scripts/entities/actors/Inventory.cs deleted file mode 100644 index f1cff2a..0000000 --- a/scripts/entities/actors/Inventory.cs +++ /dev/null @@ -1,39 +0,0 @@ -using Godot; - -public partial class Inventory : Node { - private Player player; - - public Godot.Collections.Array<ConsumableItem> Items { get; private set; } = []; - - public int Capacity { get; private set; } - - public Inventory(int capacity) { - Capacity = capacity; - } - - public override void _Ready() { - base._Ready(); - player = GetParent<Player>(); - } - - public void Drop(ConsumableItem item) { - Items.Remove(item); - MapData data = player.Map_Data; - data.InsertEntity(item); - data.EmitSignal(MapData.SignalName.EntityPlaced, item); - item.Map_Data = data; - item.GridPosition = player.GridPosition; - - MessageLogData.Instance.AddMessage($"Você descarta {item.DisplayName}."); - } - - public void Add(ConsumableItem item) { - if (Items.Count >= Capacity) return; - - Items.Add(item); - } - - public void RemoveItem(ConsumableItem item) { - Items.Remove(item); - } -}
\ No newline at end of file diff --git a/scripts/entities/actors/Inventory.cs.uid b/scripts/entities/actors/Inventory.cs.uid deleted file mode 100644 index 05c2beb..0000000 --- a/scripts/entities/actors/Inventory.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://isaqxdpou22h diff --git a/scripts/entities/actors/Player.cs b/scripts/entities/actors/Player.cs deleted file mode 100644 index 71812e8..0000000 --- a/scripts/entities/actors/Player.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Godot; -using System; - -/// <summary> -/// Classe do jogador. Por enquanto não é diferente do Ator, mas isso pode mudar. -/// </summary> -[GlobalClass] -public partial class Player : Actor -{ - private PlayerDefinition definition; - public Inventory inventory; - - public Player(Vector2I initialPosition, MapData map, PlayerDefinition definition) : base(initialPosition, map, definition) - { - this.definition = definition; - SetDefinition(definition); - } - - public void SetDefinition(PlayerDefinition definition) { - inventory = new(definition.InventoryCapacity); - - AddChild(inventory); - } -} diff --git a/scripts/entities/actors/Player.cs.uid b/scripts/entities/actors/Player.cs.uid deleted file mode 100644 index 8229b7f..0000000 --- a/scripts/entities/actors/Player.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://c840l08453pu2 diff --git a/scripts/entities/actors/PlayerDefinition.cs b/scripts/entities/actors/PlayerDefinition.cs deleted file mode 100644 index aca07e1..0000000 --- a/scripts/entities/actors/PlayerDefinition.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Godot; - -[GlobalClass] -public partial class PlayerDefinition : ActorDefinition { - [ExportCategory("Player Mechanics")] - [Export] - public int InventoryCapacity = 0; -}
\ No newline at end of file diff --git a/scripts/entities/actors/PlayerDefinition.cs.uid b/scripts/entities/actors/PlayerDefinition.cs.uid deleted file mode 100644 index 9d01ab9..0000000 --- a/scripts/entities/actors/PlayerDefinition.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://bd78nfh1tsjq6 |
