feat: Enemies

This commit is contained in:
2026-11-05 08:59:08 +01:00
parent cd65f702ae
commit 743703c6bd
109 changed files with 75286 additions and 15238 deletions

View File

@@ -3,7 +3,7 @@ using UnityEngine;
namespace Arena.Combat
{
/// <summary>
/// Everything a hit carries: amount, type and source. Passed to IDamageable.TakeDamage.
/// Everything a hit carries: amount, type, source and targeted team. Passed to IDamageable.TakeDamage.
/// </summary>
public readonly struct DamageInfo
{
@@ -16,11 +16,33 @@ namespace Arena.Combat
/// </summary>
public readonly GameObject Source;
public DamageInfo(int amount, DamageType type, GameObject source = null)
/// <summary>
/// Team hurt by this damage: Allied for enemy shots, Enemy for player shots, All for everyone.
/// </summary>
public readonly Team Target;
public DamageInfo(int amount, DamageType type, GameObject source = null, Team target = Team.All)
{
Amount = amount;
Type = type;
Source = source;
Target = target;
}
/// <summary>
/// True if this damage can hurt an IDamageable of the given team.
/// </summary>
public bool CanHit(Team team)
{
return CanHit(Target, team);
}
/// <summary>
/// True if a damage targeting a team can hurt an IDamageable of another team.
/// </summary>
public static bool CanHit(Team target, Team team)
{
return target == Team.All || team == Team.All || team == target;
}
}
}