using System; using System.Collections.Generic; using UnityEngine; namespace BuffaloSiege { public sealed class TowerDef { public string Id, Name, Description; public int Cost; public int[] Up; public float[] Damage, Interval, Range, Splash; public bool Air, Pierce; public float ProjectileSpeed; public TowerDef(string id,string name,int cost,int[] up,float[] damage,float[] interval,float[] range,string description,float speed=520,bool air=false,bool pierce=false,float[] splash=null) { Id=id;Name=name;Cost=cost;Up=up;Damage=damage;Interval=interval;Range=range;Description=description;ProjectileSpeed=speed;Air=air;Pierce=pierce;Splash=splash??new float[3]; } } public sealed class EnemyDef { public string Id,Name; public float Hp,Speed,Armor,Radius; public int Gold,Leak; public bool Air,Boss; public EnemyDef(string id,string name,float hp,float speed,float armor,int gold,int leak,float radius,bool air=false,bool boss=false) {Id=id;Name=name;Hp=hp;Speed=speed;Armor=armor;Gold=gold;Leak=leak;Radius=radius;Air=air;Boss=boss;} } public sealed class ItemDef { public string Id,Name,Description;public int Price; public ItemDef(string id,string name,int price,string desc){Id=id;Name=name;Price=price;Description=desc;} } public sealed class MapDef { public string Id,Name; public Vector2[] Path; public Vector2 Base; public List Slots=new List(); public float Length; public MapDef(string id,string name,float[] points,Vector2 basePosition,int[] rows,int[] cols) { Id=id;Name=name;Base=basePosition;Path=new Vector2[points.Length/2]; for(int i=0;i0)Length+=Vector2.Distance(Path[i-1],Path[i]);} foreach(int y in rows) foreach(int x in cols) {var p=new Vector2(x,y);if(x>=24&&x<=406&&y>=18&&y<=580&&DistanceToPath(p)>=53&&Vector2.Distance(p,Base)>=80)Slots.Add(p);} } // Painted-road centerlines and hand-placed clearings, authored in the 430 x 600 field. // Sample round bends so units follow the dirt trail instead of cutting across its banks. public MapDef(string id,string name,float[] points,Vector2 basePosition,float[] clearings) { Id=id;Name=name;Base=basePosition;var corners=new List(); for(int i=0;i{corners[0]}; for(int i=1;i=Length)return Path[Path.Length-1]; distance=Mathf.Clamp(distance,0,Length);for(int i=1;i4+level/2; public static int Reward(int level)=>250+level*135; public static int Round(float n)=>Mathf.FloorToInt(n+.5f); // The prototype's quadratic late-game curve could overwhelm a full arsenal in wave one. // Keep the onboarding stages; later stages grow gradually alongside larger starting defenses. public static float HpMultiplier(int level){float n=level-1;if(level<=6)return (1+.2f*n+.0125f*n*n)*(level<=4?.66f:.72f);return Mathf.Max(1.75f,1+.1f*n+.001f*n*n);} public static int StartingGold(int level)=>760+(level-1)*160+(level%5==0?level*40:0); public static int ArmoryCost(int type,int level)=>level>=5?0:Round(Towers[type].Cost*new[]{2f,3.5f,5.5f,8f}[level-1]/10)*10; public static readonly LeaderEntry[] Bots={new LeaderEntry("DustDevil",48200,34),new LeaderEntry("PrairieKing",41500,31),new LeaderEntry("MesaRanger",36900,28),new LeaderEntry("VultureEye",31400,26),new LeaderEntry("BisonBane",27800,24),new LeaderEntry("CactusJack",23100,21),new LeaderEntry("RedDune",18700,19),new LeaderEntry("SilverSpur",14200,16),new LeaderEntry("Tumbleweed",9800,13),new LeaderEntry("RookieRanger",5600,10)}; } [Serializable] public class LeaderEntry {public string name;public int score,wave;public bool player;public LeaderEntry(string n,int s,int w,bool p=false){name=n;score=s;wave=w;player=p;}} }