GameTemplates.cs 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Drawing;
  6. using CommonAI.Zone;
  7. using CommonAI.RTS;
  8. using CommonAI.Zone.Instance;
  9. using CommonLang;
  10. using CommonAI.Zone.Instance.ZoneEditor;
  11. namespace CommonTest
  12. {
  13. public class GameBase
  14. {
  15. // TEST
  16. public static Font global_font = new Font("song", 12, FontStyle.Italic);
  17. public static Random random = new Random();
  18. static GameBase()
  19. {
  20. TemplateManager.getInstance().CFG.OBJECT_MOVE_TO_MIN_STEP = 1f;
  21. TemplateManager.getInstance().CFG.OBJECT_DAMAGE_FLY_SPEED = 10f;
  22. initSpells();
  23. initSkills();
  24. initBuffs();
  25. }
  26. private static void initSpells()
  27. {
  28. {
  29. SpellTemplate sp = new SpellTemplate(SKILL_STRAIGHT, 100);
  30. sp.motionType = SpellTemplate.MotionType.Straight;
  31. sp.motionSpeed = 10;
  32. sp.bodySize = 10;
  33. sp.HitOnExplosion = false;
  34. sp.HitIntervalFrame = 0;
  35. sp.HitKeyFrame = new SpellTemplate.KeyFrame(0);
  36. sp.HitKeyFrame.attack = new AttackProp();
  37. sp.HitKeyFrame.attack.attack = random.Next(10, 30);
  38. sp.HitKeyFrame.attack.freeze_time = 10;
  39. TemplateManager.getInstance().addSpell(sp);
  40. }
  41. {
  42. SpellTemplate sp = new SpellTemplate(SKILL_AOE, 30);
  43. sp.motionType = SpellTemplate.MotionType.AOE;
  44. sp.motionSpeed = 10f;
  45. sp.bodySize = 20;
  46. sp.HitOnExplosion = false;
  47. sp.HitIntervalFrame = 0;
  48. sp.HitKeyFrame = new SpellTemplate.KeyFrame(0);
  49. sp.HitKeyFrame.attack = new AttackProp();
  50. sp.HitKeyFrame.attack.attack = random.Next(20, 50);
  51. sp.HitKeyFrame.attack.freeze_time = 0;
  52. sp.HitKeyFrame.attack.buff = new LaunchBuff(BUFF_DOT);
  53. sp.HitKeyFrame.attack.mask = AttackProp.PROP_MASK_KNOCK_FLY;
  54. TemplateManager.getInstance().addSpell(sp);
  55. }
  56. {
  57. SpellTemplate sp = new SpellTemplate(SKILL_LASER, 10);
  58. sp.motionType = SpellTemplate.MotionType.Laser;
  59. sp.motionSpeed = 10;
  60. sp.bodySize = 6000;
  61. sp.HitOnExplosion = false;
  62. sp.HitIntervalFrame = 0;
  63. sp.HitKeyFrame = new SpellTemplate.KeyFrame(0);
  64. sp.HitKeyFrame.attack = new AttackProp();
  65. sp.HitKeyFrame.attack.attack = 200;
  66. sp.HitKeyFrame.attack.freeze_time = 0;
  67. sp.HitKeyFrame.attack.mask = AttackProp.PROP_MASK_KNOCK_FLY;
  68. TemplateManager.getInstance().addSpell(sp);
  69. }
  70. {
  71. SpellTemplate sp = new SpellTemplate(SKILL_TOWER_LASER_WALL, 1);
  72. sp.motionType = SpellTemplate.MotionType.Laser;
  73. sp.motionSpeed = 10;
  74. sp.bodySize = 6000;
  75. sp.HitOnExplosion = false;
  76. sp.HitIntervalFrame = 0;
  77. sp.HitKeyFrame = new SpellTemplate.KeyFrame(0);
  78. sp.HitKeyFrame.attack = new AttackProp();
  79. sp.HitKeyFrame.attack.attack = 200;
  80. sp.HitKeyFrame.attack.freeze_time = 0;
  81. sp.HitKeyFrame.attack.mask = AttackProp.PROP_MASK_KNOCK_FLY;
  82. TemplateManager.getInstance().addSpell(sp);
  83. }
  84. {
  85. SpellTemplate sp = new SpellTemplate(SKILL_BINDING, 300);
  86. sp.motionType = SpellTemplate.MotionType.Binding;
  87. sp.motionSpeed = 10;
  88. sp.bodySize = 300;
  89. sp.HitOnExplosion = false;
  90. sp.HitIntervalFrame = 10;
  91. sp.HitKeyFrame = new SpellTemplate.KeyFrame(0);
  92. sp.HitKeyFrame.attack = new AttackProp();
  93. sp.HitKeyFrame.attack.attack = random.Next(10, 20);
  94. sp.HitKeyFrame.attack.freeze_time = 0;
  95. //sp.HitKeyFrame.attack.mask = AttackProp.PROP_MASK_KNOCK_FLY;
  96. TemplateManager.getInstance().addSpell(sp);
  97. }
  98. {
  99. SpellTemplate sp = new SpellTemplate(SKILL_MISSILE, 100);
  100. sp.motionType = SpellTemplate.MotionType.Missile;
  101. sp.motionSpeed = 20;
  102. sp.bodySize = 5;
  103. sp.HitOnExplosion = true;
  104. sp.HitIntervalFrame = 0;
  105. sp.HitKeyFrame = new SpellTemplate.KeyFrame(0);
  106. sp.HitKeyFrame.attack = new AttackProp();
  107. sp.HitKeyFrame.attack.attack = random.Next(10, 20);
  108. sp.HitKeyFrame.attack.freeze_time = 0;
  109. TemplateManager.getInstance().addSpell(sp);
  110. }
  111. {
  112. SpellTemplate sp = new SpellTemplate(SKILL_STRAIGHT_CLUSTER, 1000);
  113. sp.motionType = SpellTemplate.MotionType.Straight;
  114. sp.motionSpeed = 10;
  115. sp.bodySize = 20;
  116. sp.HitOnExplosion = true;
  117. sp.HitIntervalFrame = 0;
  118. sp.HitKeyFrame = new SpellTemplate.KeyFrame(0);
  119. sp.HitKeyFrame.spell = new LaunchSpell(SKILL_STRAIGHT);
  120. sp.HitKeyFrame.spell.count = 32;
  121. sp.HitKeyFrame.spell.pos_type = LaunchSpell.PosType.POS_TYPE_CYCLE;
  122. sp.HitKeyFrame.attack = new AttackProp();
  123. sp.HitKeyFrame.attack.attack = 200;
  124. sp.HitKeyFrame.attack.freeze_time = 10;
  125. TemplateManager.getInstance().addSpell(sp);
  126. }
  127. {
  128. SpellTemplate sp = new SpellTemplate(SKILL_TOWER_SUB_JIANYU, 30);
  129. sp.motionType = SpellTemplate.MotionType.Immovability;
  130. sp.motionSpeed = 10;
  131. sp.bodySize = 10;
  132. sp.HitOnExplosion = false;
  133. sp.HitIntervalFrame = 0;
  134. sp.HitKeyFrame = new SpellTemplate.KeyFrame(0);
  135. sp.HitKeyFrame.attack = new AttackProp();
  136. sp.HitKeyFrame.attack.attack = random.Next(10, 30);
  137. sp.HitKeyFrame.attack.freeze_time = 0;
  138. TemplateManager.getInstance().addSpell(sp);
  139. }
  140. {
  141. SpellTemplate sp = new SpellTemplate(SKILL_TOWER_HELL_JIANYU, 200);
  142. sp.motionType = SpellTemplate.MotionType.Immovability;
  143. sp.motionSpeed = 10;
  144. sp.bodySize = 200;
  145. sp.HitOnExplosion = false;
  146. sp.HitIntervalFrame = 10;
  147. sp.HitKeyFrame = new SpellTemplate.KeyFrame(0);
  148. sp.HitKeyFrame.spell = new LaunchSpell(SKILL_TOWER_SUB_JIANYU);
  149. sp.HitKeyFrame.spell.pos_type = LaunchSpell.PosType.POS_TYPE_RANDOM_FOR_SPELL;
  150. sp.HitKeyFrame.spell.count = 5;
  151. TemplateManager.getInstance().addSpell(sp);
  152. }
  153. {
  154. SpellTemplate sp = new SpellTemplate(SKILL_ORBIT_CYCLE, 300);
  155. sp.motionType = SpellTemplate.MotionType.Binding;
  156. sp.motionSpeed = 0;
  157. sp.rotateSpeed = 0.1f;
  158. sp.bodySize = 10;
  159. sp.OrbitDistance = BodySize * 5;
  160. sp.IsBindingOrbit = true;
  161. sp.HitOnExplosion = false;
  162. sp.HitIntervalFrame = 10;
  163. sp.HitKeyFrame = new SpellTemplate.KeyFrame(0);
  164. sp.HitKeyFrame.attack = new AttackProp();
  165. sp.HitKeyFrame.attack.attack = random.Next(10, 30);
  166. sp.HitKeyFrame.attack.freeze_time = 0;
  167. //sp.HitKeyFrame.spell = new LaunchSpell(SKILL_STRAIGHT);
  168. SpellTemplate.KeyFrame kf = new SpellTemplate.KeyFrame(10);
  169. kf.summon = new SummonUnit(test_InitUnitInfo_RandomSkill(0, "Summon", 300));
  170. sp.AddKeyFrame(kf);
  171. TemplateManager.getInstance().addSpell(sp);
  172. }
  173. {
  174. SpellTemplate sp = new SpellTemplate(SKILL_TOWER_SUMMON, 10);
  175. sp.motionType = SpellTemplate.MotionType.Immovability;
  176. sp.motionSpeed = 10;
  177. sp.bodySize = 200;
  178. sp.HitOnExplosion = false;
  179. sp.HitIntervalFrame = 0;
  180. SpellTemplate.KeyFrame kf = new SpellTemplate.KeyFrame(0);
  181. kf.spell = new LaunchSpell(SKILL_TOWER_SUB_SUMMON);
  182. kf.spell.pos_type = LaunchSpell.PosType.POS_TYPE_RANDOM_FOR_SPELL;
  183. kf.spell.count = 3;
  184. sp.AddKeyFrame(kf);
  185. TemplateManager.getInstance().addSpell(sp);
  186. }
  187. {
  188. SpellTemplate sp = new SpellTemplate(SKILL_TOWER_SUB_SUMMON, 1);
  189. sp.motionType = SpellTemplate.MotionType.Immovability;
  190. sp.motionSpeed = 10;
  191. sp.bodySize = 10;
  192. sp.HitOnExplosion = false;
  193. sp.HitIntervalFrame = 0;
  194. SpellTemplate.KeyFrame kf = new SpellTemplate.KeyFrame(0);
  195. kf.summon = new SummonUnit(test_InitUnitInfo_RandomSkill(0, "Summon", 300));
  196. sp.AddKeyFrame(kf);
  197. TemplateManager.getInstance().addSpell(sp);
  198. }
  199. }
  200. private static void initSkills()
  201. {
  202. // init skill
  203. {
  204. {
  205. UnitActionData act = new UnitActionData(6);
  206. UnitActionData.KeyFrame kf = new UnitActionData.KeyFrame(3);
  207. kf.attack = new AttackProp();
  208. //kf.attack.mask = AttackProp.PROP_MASK_KNOCK_FLY;
  209. kf.attack.attack = random.Next(20, 30);
  210. act.AddKeyFrame(kf);
  211. SkillTemplate skill = new SkillTemplate(SKILL_NORMAL_ATTACK);
  212. skill.name = "SKILL_NORMAL_ATTACK";
  213. skill.cool_down = 30;
  214. skill.attackAngle = (float)(Math.PI / 2);
  215. skill.attackRange = AttackRangeMelee;
  216. skill.action_queue.Add(act);
  217. TemplateManager.getInstance().addSkill(skill);
  218. }
  219. {
  220. UnitActionData act = new UnitActionData(6);
  221. UnitActionData.KeyFrame kf = new UnitActionData.KeyFrame(0);
  222. kf.spell = new LaunchSpell(SKILL_STRAIGHT);
  223. act.AddKeyFrame(kf);
  224. SkillTemplate skill = new SkillTemplate(SKILL_STRAIGHT);
  225. skill.name = "SKILL_STRAIGHT";
  226. skill.cool_down = 130;
  227. skill.attackAngle = (float)(Math.PI / 2);
  228. skill.attackRange = AttackRangeRanged;
  229. skill.action_queue.Add(act);
  230. TemplateManager.getInstance().addSkill(skill);
  231. }
  232. {
  233. UnitActionData act = new UnitActionData(6);
  234. UnitActionData.KeyFrame kf = new UnitActionData.KeyFrame(0);
  235. kf.spell = new LaunchSpell(SKILL_AOE);
  236. act.AddKeyFrame(kf);
  237. SkillTemplate skill = new SkillTemplate(SKILL_AOE);
  238. skill.name = "SKILL_AOE";
  239. skill.cool_down = 130;
  240. skill.attackAngle = (float)(Math.PI / 2);
  241. skill.attackRange = AttackRangeMelee;
  242. skill.action_queue.Add(act);
  243. TemplateManager.getInstance().addSkill(skill);
  244. }
  245. {
  246. UnitActionData act = new UnitActionData(6);
  247. UnitActionData.KeyFrame kf = new UnitActionData.KeyFrame(0);
  248. kf.spell = new LaunchSpell(SKILL_LASER);
  249. act.AddKeyFrame(kf);
  250. SkillTemplate skill = new SkillTemplate(SKILL_LASER);
  251. skill.name = "SKILL_LASER";
  252. skill.cool_down = 60;
  253. skill.attackAngle = (float)(Math.PI / 2);
  254. skill.attackRange = AttackRangeRanged;
  255. skill.action_queue.Add(act);
  256. TemplateManager.getInstance().addSkill(skill);
  257. }
  258. {
  259. UnitActionData act = new UnitActionData(6);
  260. UnitActionData.KeyFrame kf = new UnitActionData.KeyFrame(0);
  261. kf.spell = new LaunchSpell(SKILL_TOWER_LASER_WALL);
  262. kf.spell.pos_type = LaunchSpell.PosType.POS_TYPE_FAN;
  263. kf.spell.angle = RTSMath.PI_DIV_2;
  264. kf.spell.count = 9;
  265. act.AddKeyFrame(kf);
  266. SkillTemplate skill = new SkillTemplate(SKILL_TOWER_LASER_WALL);
  267. skill.name = "SKILL_LASER_WALL";
  268. skill.cool_down = 1;
  269. skill.attackAngle = (float)(Math.PI / 2);
  270. skill.attackRange = AttackRangeRanged;
  271. skill.action_queue.Add(act);
  272. TemplateManager.getInstance().addSkill(skill);
  273. }
  274. {
  275. UnitActionData act = new UnitActionData(300);
  276. act.is_none_block = true;
  277. UnitActionData.KeyFrame kf = new UnitActionData.KeyFrame(0);
  278. kf.spell = new LaunchSpell(SKILL_BINDING);
  279. act.AddKeyFrame(kf);
  280. SkillTemplate skill = new SkillTemplate(SKILL_BINDING);
  281. skill.name = "SKILL_BINDING";
  282. skill.cool_down = 360;
  283. skill.attackAngle = (float)(Math.PI / 2);
  284. skill.attackRange = AttackRangeMelee;
  285. skill.action_queue.Add(act);
  286. skill.is_moveable = true;
  287. TemplateManager.getInstance().addSkill(skill);
  288. }
  289. {
  290. UnitActionData act = new UnitActionData(6);
  291. UnitActionData.KeyFrame kf = new UnitActionData.KeyFrame(0);
  292. kf.spell = new LaunchSpell(SKILL_MISSILE);
  293. act.AddKeyFrame(kf);
  294. SkillTemplate skill = new SkillTemplate(SKILL_MISSILE);
  295. skill.name = "SKILL_MISSILE";
  296. skill.cool_down = 10;
  297. skill.attackAngle = (float)(Math.PI / 2);
  298. skill.attackRange = AttackRangeRanged;
  299. skill.action_queue.Add(act);
  300. TemplateManager.getInstance().addSkill(skill);
  301. }
  302. {
  303. UnitActionData act = new UnitActionData(6);
  304. UnitActionData.KeyFrame kf = new UnitActionData.KeyFrame(0);
  305. kf.spell = new LaunchSpell(SKILL_STRAIGHT_CLUSTER);
  306. kf.spell.pos_type = LaunchSpell.PosType.POS_TYPE_FAN;
  307. //kf.spell.angle = RTSMath.PI_DIV_2;
  308. // kf.spell.count = 8;
  309. act.AddKeyFrame(kf);
  310. SkillTemplate skill = new SkillTemplate(SKILL_STRAIGHT_CLUSTER);
  311. skill.name = "SKILL_STRAIGHT_CLUSTER";
  312. skill.cool_down = 90;
  313. skill.attackAngle = (float)(Math.PI / 2);
  314. skill.attackRange = GuardRangeBuilding;
  315. skill.action_queue.Add(act);
  316. TemplateManager.getInstance().addSkill(skill);
  317. }
  318. // SKILL_MELEE_ATTACK_4
  319. {
  320. SkillTemplate skill = new SkillTemplate(SKILL_MELEE_ATTACK_4);
  321. skill.name = "SKILL_MELEE_ATTACK_4";
  322. skill.cool_down = 10;
  323. skill.attackAngle = (float)(Math.PI / 2);
  324. skill.attackRange = AttackRangeMelee;
  325. for (int i = 0; i < 4; i++)
  326. {
  327. UnitActionData act = new UnitActionData(10);
  328. UnitActionData.KeyFrame kf = new UnitActionData.KeyFrame(0);
  329. kf.attack = new AttackProp();
  330. kf.attack.mask = AttackProp.PROP_MASK_DAMAGE;
  331. kf.attack.attack = random.Next(20, 30);
  332. kf.attack.hit_move = new StartMove(-MoveSpeed, 0, 5);
  333. kf.start_move = new StartMove(MoveSpeed, 0, 5);
  334. act.AddKeyFrame(kf);
  335. skill.action_queue.Add(act);
  336. }
  337. TemplateManager.getInstance().addSkill(skill);
  338. }
  339. // SKILL_HELL_JIANYU
  340. {
  341. SkillTemplate skill = new SkillTemplate(SKILL_TOWER_HELL_JIANYU);
  342. skill.name = "SKILL_TOWER_HELL_JIANYU";
  343. skill.cool_down = 120;
  344. skill.attackAngle = (float)(Math.PI / 2);
  345. skill.attackRange = AttackRangeRanged;
  346. skill.is_launch_body = false;
  347. UnitActionData act = new UnitActionData(10);
  348. UnitActionData.KeyFrame kf = new UnitActionData.KeyFrame(0);
  349. kf.spell = new LaunchSpell(SKILL_TOWER_HELL_JIANYU);
  350. act.AddKeyFrame(kf);
  351. skill.action_queue.Add(act);
  352. TemplateManager.getInstance().addSkill(skill);
  353. }
  354. // SKILL_HELL_FIRE
  355. {
  356. SkillTemplate skill = new SkillTemplate(SKILL_TOWER_HELL_FIRE);
  357. skill.name = "SKILL_TOWER_HELL_FIRE";
  358. skill.cool_down = 120;
  359. skill.attackAngle = (float)(Math.PI / 2);
  360. skill.attackRange = AttackRangeRanged;
  361. skill.is_launch_body = false;
  362. UnitActionData act = new UnitActionData(10);
  363. UnitActionData.KeyFrame kf = new UnitActionData.KeyFrame(0);
  364. kf.attack = new AttackProp();
  365. kf.attack.attack = 100;
  366. act.AddKeyFrame(kf);
  367. skill.action_queue.Add(act);
  368. TemplateManager.getInstance().addSkill(skill);
  369. }
  370. // SKILL_SUMMON
  371. {
  372. SkillTemplate skill = new SkillTemplate(SKILL_TOWER_SUMMON);
  373. skill.name = "SKILL_TOWER_SUMMON";
  374. skill.cool_down = 120;
  375. skill.attackAngle = (float)(Math.PI / 2);
  376. skill.attackRange = AttackRangeRanged;
  377. skill.is_launch_body = false;
  378. UnitActionData act = new UnitActionData(10);
  379. UnitActionData.KeyFrame kf = new UnitActionData.KeyFrame(0);
  380. kf.spell = new LaunchSpell(SKILL_TOWER_SUMMON);
  381. act.AddKeyFrame(kf);
  382. skill.action_queue.Add(act);
  383. TemplateManager.getInstance().addSkill(skill);
  384. }
  385. // SKILL_ACTOR_SLIP
  386. {
  387. SkillTemplate skill = new SkillTemplate(SKILL_ACTOR_SLIP);
  388. skill.name = "SKILL_ACTOR_SLIP";
  389. skill.cool_down = 10;
  390. skill.attackAngle = (float)(Math.PI / 2);
  391. skill.attackRange = AttackRangeRanged;
  392. skill.is_launch_body = false;
  393. UnitActionData act = new UnitActionData(10);
  394. act.is_none_block = true;
  395. act.is_face_to_target = true;
  396. UnitActionData.KeyFrame kf = new UnitActionData.KeyFrame(0);
  397. kf.start_move = new StartMove(MoveSpeed * 3, 0, 10);
  398. act.AddKeyFrame(kf);
  399. skill.action_queue.Add(act);
  400. TemplateManager.getInstance().addSkill(skill);
  401. }
  402. // SKILL_ACTOR_SLIP
  403. {
  404. SkillTemplate skill = new SkillTemplate(SKILL_ORBIT_CYCLE);
  405. skill.name = "SKILL_ORBIT_CYCLE";
  406. skill.cool_down = 300;
  407. skill.attackAngle = (float)(Math.PI / 2);
  408. skill.attackRange = AttackRangeMelee;
  409. skill.is_launch_body = true;
  410. UnitActionData act = new UnitActionData(10);
  411. UnitActionData.KeyFrame kf = new UnitActionData.KeyFrame(0);
  412. kf.spell = new LaunchSpell(SKILL_ORBIT_CYCLE);
  413. kf.spell.count = 10;
  414. kf.spell.pos_type = LaunchSpell.PosType.POS_TYPE_CYCLE;
  415. act.AddKeyFrame(kf);
  416. skill.action_queue.Add(act);
  417. TemplateManager.getInstance().addSkill(skill);
  418. }
  419. }
  420. }
  421. private static void initBuffs()
  422. {
  423. // BUFF DOT
  424. {
  425. BuffTemplate buff = new BuffTemplate(BUFF_DOT, 300);
  426. buff.HitIntervalFrame = 10;
  427. buff.HitKeyFrame = new BuffTemplate.KeyFrame(0);
  428. buff.HitKeyFrame.attack = new AttackProp();
  429. buff.HitKeyFrame.attack.attack = 10;
  430. buff.HitKeyFrame.attack.freeze_time = 0;
  431. TemplateManager.getInstance().addBuff(buff);
  432. }
  433. }
  434. //------------------------------------------------------------------------
  435. public const int SKILL_NORMAL_ATTACK = 1;
  436. public const int SKILL_STRAIGHT = 2;
  437. public const int SKILL_AOE = 3;
  438. public const int SKILL_LASER = 4;
  439. public const int SKILL_BINDING = 5;
  440. public const int SKILL_MISSILE = 6;
  441. public const int SKILL_STRAIGHT_CLUSTER = 7;
  442. public const int SKILL_MELEE_ATTACK_4 = 8;
  443. public const int SKILL_ORBIT_CYCLE = 9;
  444. public const int SKILL_TOWER_HELL_JIANYU = 10;
  445. public const int SKILL_TOWER_SUB_JIANYU = 11;
  446. public const int SKILL_TOWER_SUMMON = 12;
  447. public const int SKILL_TOWER_SUB_SUMMON = 13;
  448. public const int SKILL_TOWER_LASER_WALL = 100;
  449. public const int SKILL_TOWER_HELL_FIRE = 101;
  450. public const int SKILL_ACTOR_SLIP = 1000;
  451. private static int[] RandomSkills = new int[]
  452. {
  453. SKILL_NORMAL_ATTACK,
  454. SKILL_STRAIGHT,
  455. SKILL_AOE,
  456. SKILL_BINDING,
  457. SKILL_MISSILE,
  458. SKILL_MELEE_ATTACK_4,
  459. };
  460. //------------------------------------------------------------------------
  461. public const int BUFF_DOT = 1;
  462. //------------------------------------------------------------------------
  463. public const int SpaceDIV = 800;
  464. public const float BodySize = 25;
  465. public const float GuardRange = 800;
  466. public const float GuardRangeBuilding = 800;
  467. public const float MoveSpeed = 15f;
  468. public const float AttackRangeMelee = 100;
  469. public const float AttackRangeRanged = 400;
  470. //------------------------------------------------------------------------
  471. public static UnitInfo test_InitUnitInfo(
  472. int force,
  473. string name,
  474. bool melee,
  475. bool elite)
  476. {
  477. UnitInfo info = new UnitInfo();
  478. info.type = UnitInfo.UnitType.TYPE_NPC;
  479. info.name = name;
  480. info.force = (byte)force;
  481. info.bodyHeight = 10;
  482. info.bodySize = BodySize;
  483. info.moveSpeed = MoveSpeed;
  484. info.guardRange = GuardRange;
  485. info.HealthPoint = 100;
  486. if (melee)
  487. {
  488. info.baseSkillID = SKILL_NORMAL_ATTACK;
  489. //info.skills.Add(SKILL_AOE);
  490. info.moveSpeed += 1;
  491. }
  492. else
  493. {
  494. info.baseSkillID = SKILL_MISSILE;
  495. //info.skills.Add(SKILL_STRAIGHT);
  496. }
  497. if (elite)
  498. {
  499. info.bodySize = BodySize * 2f;
  500. info.HealthPoint = 1000;
  501. info.baseSkillID = SKILL_NORMAL_ATTACK;
  502. //info.skills.Add(SKILL_NORMAL_ATTACK);
  503. //info.skills.Add(SKILL_STRAIGHT);
  504. info.skills.Add(SKILL_AOE);
  505. //info.skills.Add(SKILL_BINDING);
  506. //info.skills.Add(SKILL_LASER);
  507. //info.skills.Add(SKILL_BINDING);
  508. info.skills.Add(SKILL_MISSILE);
  509. }
  510. return info;
  511. }
  512. public static UnitInfo test_InitUnitInfo_RandomSkill(int force, string name, int lifeTime)
  513. {
  514. UnitInfo un = test_InitUnitInfo(force, name, true, false);
  515. un.type = UnitInfo.UnitType.TYPE_SUMMON;
  516. un.LifeTime = lifeTime;
  517. un.skills.Clear();
  518. un.baseSkillID = CUtils.getRandom(RandomSkills);
  519. return un;
  520. }
  521. public static UnitInfo test_InitBuildingInfo(int force, string name)
  522. {
  523. UnitInfo info = new UnitInfo();
  524. info.type = UnitInfo.UnitType.TYPE_BUILDING;
  525. info.name = name;
  526. info.force = (byte)force;
  527. info.bodyHeight = 100;
  528. info.bodySize = BodySize * 4f;
  529. info.moveSpeed = 0;
  530. info.guardRange = GuardRangeBuilding;
  531. info.HealthPoint = 10000;
  532. info.baseSkillID = SKILL_TOWER_LASER_WALL;
  533. info.skills.Add(SKILL_STRAIGHT_CLUSTER);
  534. return info;
  535. }
  536. public static UnitInfo test_InitTownerInfo(int force, string name)
  537. {
  538. UnitInfo info = new UnitInfo();
  539. info.type = UnitInfo.UnitType.TYPE_BUILDING;
  540. info.name = name;
  541. info.force = (byte)force;
  542. info.bodyHeight = 50;
  543. info.bodySize = BodySize * 2f;
  544. info.moveSpeed = 0;
  545. info.guardRange = GuardRangeBuilding;
  546. info.HealthPoint = 1000;
  547. info.baseSkillID = SKILL_LASER;
  548. info.skills.Add(SKILL_TOWER_SUMMON);
  549. info.skills.Add(SKILL_TOWER_HELL_FIRE);
  550. info.skills.Add(SKILL_TOWER_HELL_JIANYU);
  551. return info;
  552. }
  553. //------------------------------------------------------------------------------------------
  554. public class InitZoneInfo
  555. {
  556. readonly public ZoneInfo Info;
  557. public List<AddUnitAction> mapdata_add_buildings = new List<AddUnitAction>();
  558. public List<ZoneRegion> mapdata_add_barracks = new List<ZoneRegion>();
  559. public InitZoneInfo(ZoneInfo info)
  560. {
  561. this.Info = info;
  562. }
  563. public void initGame(InstanceZone zone)
  564. {
  565. foreach (AddUnitAction act in mapdata_add_buildings)
  566. {
  567. zone.pushAction(act);
  568. }
  569. foreach (ZoneRegion act in mapdata_add_barracks)
  570. {
  571. zone.addFlag(act);
  572. }
  573. }
  574. }
  575. public static InitZoneInfo test_InitZoneInfo(Bitmap mapdata)
  576. {
  577. if (mapdata != null)
  578. {
  579. int xc = mapdata.Width;
  580. int yc = mapdata.Height;
  581. int mGridXCount = xc;
  582. int mGridYCount = yc;
  583. int mCellW = 200;
  584. int mCellH = 200;
  585. ZoneInfo zinf = new ZoneInfo(xc, yc, mCellW, mCellH);
  586. // init astar map
  587. {
  588. for (int x = 0; x < xc; ++x)
  589. {
  590. for (int y = 0; y < yc; ++y)
  591. {
  592. Color c = mapdata.GetPixel(x, y);
  593. int rgb = (int)(c.ToArgb() & 0xFFFFFF);
  594. zinf.TerrainMatrix[x, y] = rgb;
  595. }
  596. }
  597. }
  598. return new InitZoneInfo(zinf);
  599. }
  600. else
  601. {
  602. int xc = 50;
  603. int yc = 50;
  604. ZoneInfo zinf = new ZoneInfo(xc, yc, 128, 128);
  605. for (int x = 0; x < xc; ++x)
  606. {
  607. for (int y = 0; y < yc; ++y)
  608. {
  609. if ((random.Next() % 10000) > 9500)
  610. {
  611. zinf.TerrainMatrix[x, y] = 1;
  612. }
  613. }
  614. }
  615. return new InitZoneInfo(zinf);
  616. }
  617. }
  618. public static void test_init3C(InitZoneInfo ini)
  619. {
  620. ZoneInfo mZoneInfo = ini.Info;
  621. List<AddUnitAction> mapdata_add_buildings = ini.mapdata_add_buildings;
  622. List<ZoneRegion> mapdata_add_barracks = ini.mapdata_add_barracks;
  623. int mGridXCount = RTSMath.roundMod(mZoneInfo.TotalWidth, mZoneInfo.GridCellW);
  624. int mGridYCount = RTSMath.roundMod(mZoneInfo.TotalHeight, mZoneInfo.GridCellH);
  625. int mWidth = mZoneInfo.TotalWidth;
  626. int mHeight = mZoneInfo.TotalHeight;
  627. int mCellW = mZoneInfo.GridCellW;
  628. int mCellH = mZoneInfo.GridCellH;
  629. int rc = 3;
  630. for (int i = 0; i < rc; i++)
  631. {
  632. float size = 256;
  633. float sx1 = size * 2;
  634. float sx2 = mZoneInfo.TotalWidth - size * 2;
  635. float sy = (mZoneInfo.TotalHeight / rc) * i + (mZoneInfo.TotalHeight / rc) / 2;
  636. UnitInfo info1m = test_InitUnitInfo(SceneLOL.UNIT_FORCE_A, "Spawned A", true, false);
  637. UnitInfo info2m = test_InitUnitInfo(SceneLOL.UNIT_FORCE_B, "Spawned B", true, false);
  638. UnitInfo info1r = test_InitUnitInfo(SceneLOL.UNIT_FORCE_A, "Spawned A", false, false);
  639. UnitInfo info2r = test_InitUnitInfo(SceneLOL.UNIT_FORCE_B, "Spawned B", false, false);
  640. UnitInfo info1e = test_InitUnitInfo(SceneLOL.UNIT_FORCE_A, "Spawned A", true, true);
  641. UnitInfo info2e = test_InitUnitInfo(SceneLOL.UNIT_FORCE_B, "Spawned B", true, true);
  642. ZoneRegion rg1m = new ZoneRegion("3C_Spawned_A_Melee_" + i, sx1, sy, size);
  643. ZoneRegion rg2m = new ZoneRegion("3C_Spawned_B_Melee_" + i, sx2, sy, size);
  644. ZoneRegion rg1r = new ZoneRegion("3C_Spawned_A_Range_" + i, sx1, sy, size);
  645. ZoneRegion rg2r = new ZoneRegion("3C_Spawned_B_Range_" + i, sx2, sy, size);
  646. ZoneRegion rg1e = new ZoneRegion("3C_Spawned_A_Elite_" + i, sx1, sy, size);
  647. ZoneRegion rg2e = new ZoneRegion("3C_Spawned_B_Elite_" + i, sx2, sy, size);
  648. SpawnUnitTrigger sam = new SpawnUnitTrigger(info1m, 100, 1, new Vector2(sx2, sy));
  649. SpawnUnitTrigger sbm = new SpawnUnitTrigger(info2m, 100, 1, new Vector2(sx1, sy));
  650. SpawnUnitTrigger sar = new SpawnUnitTrigger(info1r, 100, 1, new Vector2(sx2, sy));
  651. SpawnUnitTrigger sbr = new SpawnUnitTrigger(info2r, 100, 1, new Vector2(sx1, sy));
  652. SpawnUnitTrigger sae = new SpawnUnitTrigger(info1e, 1000, 1, new Vector2(sx2, sy));
  653. SpawnUnitTrigger sbe = new SpawnUnitTrigger(info2e, 1000, 1, new Vector2(sx1, sy));
  654. rg1m.OnZoneUpdate += sam.onUpdate;
  655. rg2m.OnZoneUpdate += sbm.onUpdate;
  656. rg1r.OnZoneUpdate += sar.onUpdate;
  657. rg2r.OnZoneUpdate += sbr.onUpdate;
  658. rg1e.OnZoneUpdate += sae.onUpdate;
  659. rg2e.OnZoneUpdate += sbe.onUpdate;
  660. mapdata_add_barracks.Add(rg1m);
  661. mapdata_add_barracks.Add(rg2m);
  662. mapdata_add_barracks.Add(rg1r);
  663. mapdata_add_barracks.Add(rg2r);
  664. mapdata_add_barracks.Add(rg1e);
  665. mapdata_add_barracks.Add(rg2e);
  666. UnitInfo b1 = test_InitBuildingInfo(SceneLOL.UNIT_FORCE_A, "Building A");
  667. UnitInfo b2 = test_InitBuildingInfo(SceneLOL.UNIT_FORCE_B, "Building B");
  668. mapdata_add_buildings.Add(new AddUnitAction(b1, sx1 - size, sy, 0));
  669. mapdata_add_buildings.Add(new AddUnitAction(b2, sx2 + size, sy, 0));
  670. }
  671. }
  672. public static void test_init4A(InitZoneInfo ini)
  673. {
  674. ZoneInfo mZoneInfo = ini.Info;
  675. List<AddUnitAction> mapdata_add_buildings = ini.mapdata_add_buildings;
  676. List<ZoneRegion> mapdata_add_barracks = ini.mapdata_add_barracks;
  677. int mGridXCount = RTSMath.roundMod(mZoneInfo.TotalWidth, mZoneInfo.GridCellW);
  678. int mGridYCount = RTSMath.roundMod(mZoneInfo.TotalHeight, mZoneInfo.GridCellH);
  679. int mWidth = mZoneInfo.TotalWidth;
  680. int mHeight = mZoneInfo.TotalHeight;
  681. int mCellW = mZoneInfo.GridCellW;
  682. int mCellH = mZoneInfo.GridCellH;
  683. // 四家互A
  684. float size = 256;
  685. Vector2 vc = new Vector2(mWidth / 2, mHeight / 2);
  686. Vector2 v1 = new Vector2(size * 2, size * 2);
  687. Vector2 v2 = new Vector2(mWidth - size * 2, size * 2);
  688. Vector2 v3 = new Vector2(mWidth - size * 2, mHeight - size * 2);
  689. Vector2 v4 = new Vector2(size * 2, mHeight - size * 2);
  690. UnitInfo info1r = test_InitUnitInfo(SceneLOL.UNIT_FORCE_A, "Spawned A", false, false);
  691. UnitInfo info2r = test_InitUnitInfo(SceneLOL.UNIT_FORCE_A, "Spawned B", false, false);
  692. UnitInfo info3r = test_InitUnitInfo(SceneLOL.UNIT_FORCE_B, "Spawned C", false, false);
  693. UnitInfo info4r = test_InitUnitInfo(SceneLOL.UNIT_FORCE_B, "Spawned D", false, false);
  694. UnitInfo info1m = test_InitUnitInfo(SceneLOL.UNIT_FORCE_A, "Spawned A", true, false);
  695. UnitInfo info2m = test_InitUnitInfo(SceneLOL.UNIT_FORCE_A, "Spawned B", true, false);
  696. UnitInfo info3m = test_InitUnitInfo(SceneLOL.UNIT_FORCE_B, "Spawned C", true, false);
  697. UnitInfo info4m = test_InitUnitInfo(SceneLOL.UNIT_FORCE_B, "Spawned D", true, false);
  698. UnitInfo info1e = test_InitUnitInfo(SceneLOL.UNIT_FORCE_A, "Spawned A", true, true);
  699. UnitInfo info2e = test_InitUnitInfo(SceneLOL.UNIT_FORCE_A, "Spawned B", true, true);
  700. UnitInfo info3e = test_InitUnitInfo(SceneLOL.UNIT_FORCE_B, "Spawned C", true, true);
  701. UnitInfo info4e = test_InitUnitInfo(SceneLOL.UNIT_FORCE_B, "Spawned D", true, true);
  702. ZoneRegion rg_info1r = new ZoneRegion("4A_rg_info1r_", v1.x, v1.y, size);
  703. ZoneRegion rg_info2r = new ZoneRegion("4A_rg_info2r_", v2.x, v2.y, size);
  704. ZoneRegion rg_info3r = new ZoneRegion("4A_rg_info3r_", v3.x, v3.y, size);
  705. ZoneRegion rg_info4r = new ZoneRegion("4A_rg_info4r_", v4.x, v4.y, size);
  706. ZoneRegion rg_info1m = new ZoneRegion("4A_rg_info1m_", v1.x, v1.y, size);
  707. ZoneRegion rg_info2m = new ZoneRegion("4A_rg_info2m_", v2.x, v2.y, size);
  708. ZoneRegion rg_info3m = new ZoneRegion("4A_rg_info3m_", v3.x, v3.y, size);
  709. ZoneRegion rg_info4m = new ZoneRegion("4A_rg_info4m_", v4.x, v4.y, size);
  710. ZoneRegion rg_info1e = new ZoneRegion("4A_rg_info1e_", v1.x, v1.y, size);
  711. ZoneRegion rg_info2e = new ZoneRegion("4A_rg_info2e_", v2.x, v2.y, size);
  712. ZoneRegion rg_info3e = new ZoneRegion("4A_rg_info3e_", v3.x, v3.y, size);
  713. ZoneRegion rg_info4e = new ZoneRegion("4A_rg_info4e_", v4.x, v4.y, size);
  714. SpawnUnitTrigger s1r = new SpawnUnitTrigger(info1r, 20, 1, vc);
  715. SpawnUnitTrigger s2r = new SpawnUnitTrigger(info2r, 20, 1, vc);
  716. SpawnUnitTrigger s3r = new SpawnUnitTrigger(info3r, 20, 1, vc);
  717. SpawnUnitTrigger s4r = new SpawnUnitTrigger(info4r, 20, 1, vc);
  718. SpawnUnitTrigger s1m = new SpawnUnitTrigger(info1m, 20, 1, vc);
  719. SpawnUnitTrigger s2m = new SpawnUnitTrigger(info2m, 20, 1, vc);
  720. SpawnUnitTrigger s3m = new SpawnUnitTrigger(info3m, 20, 1, vc);
  721. SpawnUnitTrigger s4m = new SpawnUnitTrigger(info4m, 20, 1, vc);
  722. SpawnUnitTrigger s1e = new SpawnUnitTrigger(info1e, 1000, 1, vc);
  723. SpawnUnitTrigger s2e = new SpawnUnitTrigger(info2e, 1000, 1, vc);
  724. SpawnUnitTrigger s3e = new SpawnUnitTrigger(info3e, 1000, 1, vc);
  725. SpawnUnitTrigger s4e = new SpawnUnitTrigger(info4e, 1000, 1, vc);
  726. rg_info1r.OnZoneUpdate += s1r.onUpdate;
  727. rg_info2r.OnZoneUpdate += s2r.onUpdate;
  728. rg_info3r.OnZoneUpdate += s3r.onUpdate;
  729. rg_info4r.OnZoneUpdate += s4r.onUpdate;
  730. rg_info1m.OnZoneUpdate += s1m.onUpdate;
  731. rg_info2m.OnZoneUpdate += s2m.onUpdate;
  732. rg_info3m.OnZoneUpdate += s3m.onUpdate;
  733. rg_info4m.OnZoneUpdate += s4m.onUpdate;
  734. rg_info1e.OnZoneUpdate += s1e.onUpdate;
  735. rg_info2e.OnZoneUpdate += s2e.onUpdate;
  736. rg_info3e.OnZoneUpdate += s3e.onUpdate;
  737. rg_info4e.OnZoneUpdate += s4e.onUpdate;
  738. mapdata_add_barracks.Add(rg_info1r);
  739. mapdata_add_barracks.Add(rg_info2r);
  740. mapdata_add_barracks.Add(rg_info3r);
  741. mapdata_add_barracks.Add(rg_info4r);
  742. mapdata_add_barracks.Add(rg_info1m);
  743. mapdata_add_barracks.Add(rg_info2m);
  744. mapdata_add_barracks.Add(rg_info3m);
  745. mapdata_add_barracks.Add(rg_info4m);
  746. mapdata_add_barracks.Add(rg_info1e);
  747. mapdata_add_barracks.Add(rg_info2e);
  748. mapdata_add_barracks.Add(rg_info3e);
  749. mapdata_add_barracks.Add(rg_info4e);
  750. MathVector.move(v1, -size, -size);
  751. MathVector.move(v2, size, -size);
  752. MathVector.move(v3, -size, -size);
  753. MathVector.move(v4, -size, size);
  754. UnitInfo b1 = test_InitBuildingInfo(SceneLOL.UNIT_FORCE_A, "Building A");
  755. UnitInfo b2 = test_InitBuildingInfo(SceneLOL.UNIT_FORCE_A, "Building B");
  756. UnitInfo b3 = test_InitBuildingInfo(SceneLOL.UNIT_FORCE_B, "Building C");
  757. UnitInfo b4 = test_InitBuildingInfo(SceneLOL.UNIT_FORCE_B, "Building D");
  758. mapdata_add_buildings.Add(new AddUnitAction(b1, v1.x, v1.y, 0));
  759. mapdata_add_buildings.Add(new AddUnitAction(b2, v2.x, v2.y, 0));
  760. mapdata_add_buildings.Add(new AddUnitAction(b3, v3.x, v3.y, 0));
  761. mapdata_add_buildings.Add(new AddUnitAction(b4, v4.x, v4.y, 0));
  762. }
  763. public static void test_initLOL(InitZoneInfo ini)
  764. {
  765. ZoneInfo mZoneInfo = ini.Info;
  766. List<AddUnitAction> mapdata_add_buildings = ini.mapdata_add_buildings;
  767. List<ZoneRegion> mapdata_add_barracks = ini.mapdata_add_barracks;
  768. ZoneInfo zinf = mZoneInfo;
  769. int mGridXCount = RTSMath.roundMod(mZoneInfo.TotalWidth, mZoneInfo.GridCellW);
  770. int mGridYCount = RTSMath.roundMod(mZoneInfo.TotalHeight, mZoneInfo.GridCellH);
  771. int mWidth = mZoneInfo.TotalWidth;
  772. int mHeight = mZoneInfo.TotalHeight;
  773. int mCellW = mZoneInfo.GridCellW;
  774. int mCellH = mZoneInfo.GridCellH;
  775. const int MAP_MASK_COLOR_BASE_FORCE_A = 0x00FF0000;
  776. const int MAP_MASK_COLOR_BASE_FORCE_B = 0x000000FF;
  777. const int MAP_MASK_COLOR_TOWER_FORCE_A = 0x00FFFF00;
  778. const int MAP_MASK_COLOR_TOWER_FORCE_B = 0x00FF00FF;
  779. const int MAP_MASK_COLOR_BARRACK_FORCE_A = 0x00FFFFFF;
  780. const int MAP_MASK_COLOR_BARRACK_FORCE_B = 0x00808080;
  781. const int MAP_MASK_COLOR_WP_L = 0x00800000;
  782. const int MAP_MASK_COLOR_WP_D = 0x00FF8080;
  783. Vector2[] force_a_L = new Vector2[] { new Vector2(), new Vector2(), };
  784. Vector2[] force_a_C = new Vector2[] { new Vector2(), };
  785. Vector2[] force_a_D = new Vector2[] { new Vector2(), new Vector2(), };
  786. Vector2[] force_b_L = new Vector2[] { new Vector2(), new Vector2(), };
  787. Vector2[] force_b_C = new Vector2[] { new Vector2(), };
  788. Vector2[] force_b_D = new Vector2[] { new Vector2(), new Vector2(), };
  789. Vector2[][] force_a_P = new Vector2[3][] { force_a_L, force_a_C, force_a_D };
  790. Vector2[][] force_b_P = new Vector2[3][] { force_b_L, force_b_C, force_b_D };
  791. for (int x = 0; x < mGridXCount; ++x)
  792. {
  793. for (int y = 0; y < mGridYCount; ++y)
  794. {
  795. float cx = x * mCellW + mCellW / 2;
  796. float cy = y * mCellH + mCellH / 2;
  797. int rgb = zinf.TerrainMatrix[x, y];
  798. if (rgb == MAP_MASK_COLOR_BASE_FORCE_A)
  799. {
  800. zinf.TerrainMatrix[x, y] = 0;
  801. UnitInfo b = test_InitBuildingInfo(SceneLOL.UNIT_FORCE_A, "Building A");
  802. mapdata_add_buildings.Add(new AddUnitAction(b, cx, cy, 0));
  803. force_b_L[1].x = cx;
  804. force_b_L[1].y = cy;
  805. force_b_C[0].x = cx;
  806. force_b_C[0].y = cy;
  807. force_b_D[1].x = cx;
  808. force_b_D[1].y = cy;
  809. }
  810. if (rgb == MAP_MASK_COLOR_BASE_FORCE_B)
  811. {
  812. zinf.TerrainMatrix[x, y] = 0;
  813. UnitInfo b = test_InitBuildingInfo(SceneLOL.UNIT_FORCE_B, "Building B");
  814. mapdata_add_buildings.Add(new AddUnitAction(b, cx, cy, 0));
  815. force_a_L[1].x = cx;
  816. force_a_L[1].y = cy;
  817. force_a_C[0].x = cx;
  818. force_a_C[0].y = cy;
  819. force_a_D[1].x = cx;
  820. force_a_D[1].y = cy;
  821. }
  822. if (rgb == MAP_MASK_COLOR_TOWER_FORCE_A)
  823. {
  824. UnitInfo b = test_InitTownerInfo(SceneLOL.UNIT_FORCE_A, "Tower A");
  825. mapdata_add_buildings.Add(new AddUnitAction(b, cx, cy, 0));
  826. }
  827. if (rgb == MAP_MASK_COLOR_TOWER_FORCE_B)
  828. {
  829. UnitInfo b = test_InitTownerInfo(SceneLOL.UNIT_FORCE_B, "Tower B");
  830. mapdata_add_buildings.Add(new AddUnitAction(b, cx, cy, 0));
  831. }
  832. }
  833. }
  834. for (int x = 0; x < mGridXCount; ++x)
  835. {
  836. for (int y = 0; y < mGridYCount; ++y)
  837. {
  838. float cx = x * mCellW + mCellW / 2;
  839. float cy = y * mCellH + mCellH / 2;
  840. int rgb = zinf.TerrainMatrix[x, y];
  841. if (rgb == MAP_MASK_COLOR_WP_L)
  842. {
  843. zinf.TerrainMatrix[x, y] = 0;
  844. force_a_L[0].x = cx;
  845. force_a_L[0].y = cy;
  846. force_b_L[0].x = cx;
  847. force_b_L[0].y = cy;
  848. }
  849. if (rgb == MAP_MASK_COLOR_WP_D)
  850. {
  851. zinf.TerrainMatrix[x, y] = 0;
  852. force_a_D[0].x = cx;
  853. force_a_D[0].y = cy;
  854. force_b_D[0].x = cx;
  855. force_b_D[0].y = cy;
  856. }
  857. }
  858. }
  859. float size = 256;
  860. int fa = 0;
  861. int fb = 0;
  862. for (int y = 0; y < mGridYCount; ++y)
  863. {
  864. for (int x = 0; x < mGridXCount; ++x)
  865. {
  866. float cx = x * mCellW + mCellW / 2;
  867. float cy = y * mCellH + mCellH / 2;
  868. int rgb = zinf.TerrainMatrix[x, y];
  869. if (rgb == MAP_MASK_COLOR_BARRACK_FORCE_A)
  870. {
  871. zinf.TerrainMatrix[x, y] = 0;
  872. ZoneRegion rgm = new ZoneRegion("rgA_" + cx + "_" + cy, cx, cy, size);
  873. UnitInfo ifm = test_InitUnitInfo(SceneLOL.UNIT_FORCE_A, "Spawned A", false, false);
  874. UnitInfo ifr = test_InitUnitInfo(SceneLOL.UNIT_FORCE_A, "Spawned A", true, false);
  875. UnitInfo ife = test_InitUnitInfo(SceneLOL.UNIT_FORCE_A, "Spawned A", true, true);
  876. SpawnUnitTrigger tgm = new SpawnUnitTrigger(ifm, 200, 1, force_a_P[fa]);
  877. SpawnUnitTrigger tgr = new SpawnUnitTrigger(ifr, 200, 1, force_a_P[fa]);
  878. SpawnUnitTrigger tge = new SpawnUnitTrigger(ife, 200, 1, force_a_P[fa]);
  879. rgm.OnZoneUpdate += tgm.onUpdate;
  880. rgm.OnZoneUpdate += tgr.onUpdate;
  881. rgm.OnZoneUpdate += tge.onUpdate;
  882. mapdata_add_barracks.Add(rgm);
  883. fa++;
  884. }
  885. if (rgb == MAP_MASK_COLOR_BARRACK_FORCE_B)
  886. {
  887. zinf.TerrainMatrix[x, y] = 0;
  888. ZoneRegion rgm = new ZoneRegion("rgB_" + cx + "_" + cy, cx, cy, size);
  889. UnitInfo ifm = test_InitUnitInfo(SceneLOL.UNIT_FORCE_B, "Spawned B", false, false);
  890. UnitInfo ifr = test_InitUnitInfo(SceneLOL.UNIT_FORCE_B, "Spawned B", true, false);
  891. UnitInfo ife = test_InitUnitInfo(SceneLOL.UNIT_FORCE_B, "Spawned B", true, true);
  892. SpawnUnitTrigger tgm = new SpawnUnitTrigger(ifm, 200, 1, force_b_P[fb]);
  893. SpawnUnitTrigger tgr = new SpawnUnitTrigger(ifr, 200, 1, force_b_P[fb]);
  894. SpawnUnitTrigger tge = new SpawnUnitTrigger(ife, 200, 1, force_b_P[fb]);
  895. rgm.OnZoneUpdate += tgm.onUpdate;
  896. rgm.OnZoneUpdate += tgr.onUpdate;
  897. rgm.OnZoneUpdate += tge.onUpdate;
  898. mapdata_add_barracks.Add(rgm);
  899. fb++;
  900. }
  901. }
  902. }
  903. }
  904. }
  905. }