Implement Fort Fight minigame (#75)
Co-authored-by: Michal Pikulski <michal.a.pikulski@gmail.com> Reviewed-on: #75
This commit is contained in:
94
Assets/Scripts/Minigames/FortFight/Data/ProjectileConfig.cs
Normal file
94
Assets/Scripts/Minigames/FortFight/Data/ProjectileConfig.cs
Normal file
@@ -0,0 +1,94 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Minigames.FortFight.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Configuration data for a projectile type.
|
||||
/// Stored centrally in FortFightSettings instead of individual ScriptableObject assets.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class ProjectileConfig
|
||||
{
|
||||
[Header("Identity")]
|
||||
[Tooltip("Type of projectile this config represents")]
|
||||
public ProjectileType projectileType;
|
||||
|
||||
[Tooltip("Unique string identifier (auto-generated from type)")]
|
||||
public string projectileId;
|
||||
|
||||
[Header("Prefab")]
|
||||
[Tooltip("Prefab for this projectile (should have ProjectileBase component)")]
|
||||
public GameObject prefab;
|
||||
|
||||
[Header("Ammunition System")]
|
||||
[Tooltip("Cooldown in turns after use")]
|
||||
public int cooldownTurns = 2;
|
||||
|
||||
[Header("UI")]
|
||||
[Tooltip("Icon sprite for ammunition UI")]
|
||||
public Sprite icon;
|
||||
|
||||
[Tooltip("Display name for this projectile type")]
|
||||
public string displayName;
|
||||
|
||||
[Tooltip("Description of projectile behavior")]
|
||||
[TextArea(2, 4)]
|
||||
public string description;
|
||||
|
||||
[Header("Combat Stats")]
|
||||
[Tooltip("Damage dealt on impact")]
|
||||
public float damage = 20f;
|
||||
|
||||
[Header("Physics")]
|
||||
[Tooltip("Mass for physics simulation (affects trajectory and force)")]
|
||||
public float mass = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// Get the ProjectileBase component from the prefab
|
||||
/// </summary>
|
||||
public Projectiles.ProjectileBase GetProjectileComponent()
|
||||
{
|
||||
if (prefab == null) return null;
|
||||
return prefab.GetComponent<Projectiles.ProjectileBase>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get damage value from config
|
||||
/// </summary>
|
||||
public float GetDamage()
|
||||
{
|
||||
return damage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get mass value from config
|
||||
/// </summary>
|
||||
public float GetMass()
|
||||
{
|
||||
return mass;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Validate and auto-generate projectileId from type
|
||||
/// </summary>
|
||||
public void Validate()
|
||||
{
|
||||
if (string.IsNullOrEmpty(projectileId))
|
||||
{
|
||||
projectileId = GenerateIdFromType(projectileType);
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(displayName))
|
||||
{
|
||||
displayName = projectileType.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
private string GenerateIdFromType(ProjectileType type)
|
||||
{
|
||||
return type.ToString().ToLower();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user