- Timestamp:
- 2013-07-25 14:58:28 (10 years ago)
- Location:
- 2013/30/DenisZ/CastleMaster/CastleMaster
- Files:
-
- 6 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
2013/30/DenisZ/CastleMaster/CastleMaster/CastleMaster/CastleMaster.csproj
r4646 r4671 74 74 </ItemGroup> 75 75 <ItemGroup> 76 <Compile Include="Ai\AIStates\AgressiveState.cs" /> 77 <Compile Include="Ai\AIStates\AIState.cs" /> 78 <Compile Include="Ai\AIStates\CollectiveState.cs" /> 79 <Compile Include="Ai\AIStates\DefensiveState.cs" /> 76 80 <Compile Include="Ai\AStar.cs" /> 77 81 <Compile Include="Ai\Node.cs" /> … … 83 87 <Compile Include="Entities\TileEntities\TileEntityBlock.cs" /> 84 88 <Compile Include="Entities\TileEntities\TileEntityTree.cs" /> 85 <Compile Include="Graphics\ AnimationHelper.cs" />89 <Compile Include="Graphics\TimerHelper.cs" /> 86 90 <Compile Include="Graphics\Camera.cs" /> 87 91 <Compile Include="Graphics\RenderHelper.cs" /> -
2013/30/DenisZ/CastleMaster/CastleMaster/CastleMaster/Entities/Entity.cs
r4646 r4671 163 163 } 164 164 165 public float DistanceTo(float x, float z) 166 { 167 float xd = X - x; 168 float zd = Z - z; 169 170 return (float)(Math.Sqrt(xd * xd + zd * zd)); 171 } 172 173 public float DistanceToSqr(float x, float z) 174 { 175 float xd = X - x; 176 float zd = Z - z; 177 178 return xd * xd + zd * zd; 179 } 180 165 181 public virtual void Update() { } 166 182 -
2013/30/DenisZ/CastleMaster/CastleMaster/CastleMaster/Game.cs
r4646 r4671 64 64 graphics.PreferredBackBufferWidth = WIDTH; 65 65 graphics.PreferredBackBufferHeight = HEIGHT; 66 graphics.SynchronizeWithVerticalRetrace = false;66 graphics.SynchronizeWithVerticalRetrace = true; 67 67 graphics.ApplyChanges(); 68 68 Window.Title = TITLE; … … 128 128 camera = new Camera(level); 129 129 AddPlayer(new PlayerReal(TEAM1, level, camera)); 130 AddPlayer(new PlayerAI(TEAM2, level, camera ));130 AddPlayer(new PlayerAI(TEAM2, level, camera, PlayerAI.DIFFICULTY_HARD, players[0])); 131 131 level.InitLevel(); 132 foreach (Player p in players) 133 if (p != null) p.OnLevelLoaded(); 132 134 camera.CenterOn(level.Width / 2 * Viewport.TILESIZE, level.Height / 2 * Viewport.TILESIZE); 133 135 } -
2013/30/DenisZ/CastleMaster/CastleMaster/CastleMaster/Players/Player.cs
r4592 r4671 6 6 using CastleMaster.Graphics; 7 7 using CastleMaster.Units; 8 using Microsoft.Xna.Framework; 8 9 9 10 namespace CastleMaster.Players … … 11 12 public abstract class Player 12 13 { 14 public const int LUMBER_WORTH = 2; 15 public const int START_MONEY = 20; 16 public const int START_LUMBER = 10; 17 13 18 protected Team team; 14 19 protected Level level; 15 20 protected Camera camera; 21 protected UnitKing king; 22 protected UnitStore store; 16 23 17 24 public Player(Team team, Level level, Camera camera) … … 20 27 this.level = level; 21 28 this.camera = camera; 29 LumberAmount = START_LUMBER; 30 CoinsAmount = 20; 31 32 king = new UnitKing(level, this); 33 store = new UnitStore(level, this); 22 34 } 35 36 public Point HomePoint { get; set; } 37 38 public Point WoodcutterSpawnPoint { get; set; } 39 40 public Point WarriorSpawnPoint { get; set; } 41 42 public Point RangerSpawnPoint { get; set; } 43 44 public UnitKing King { get { return king; } } 45 46 public UnitStore Store { get { return store; } } 47 48 public List<Unit> AvailableUnits { get { return level.Units[Team.ID]; } } 49 50 public int CoinsAmount { get; set; } 51 52 public int LumberAmount { get; set; } 23 53 24 54 public Level Level { get { return level; } } … … 27 57 28 58 public Team Team { get { return team; } } 59 60 public virtual void OnLevelLoaded() { } 61 62 public List<T> GetUnitsByType<T>() where T : Unit 63 { 64 List<T> result = new List<T>(); 65 66 foreach (Unit u in AvailableUnits) 67 if (typeof(T).IsAssignableFrom(u.GetType())) 68 result.Add((T)u); 69 70 return result; 71 } 29 72 30 73 public virtual void Update() -
2013/30/DenisZ/CastleMaster/CastleMaster/CastleMaster/Players/PlayerAI.cs
r4592 r4671 5 5 using System.Linq; 6 6 using System.Text; 7 using CastleMaster.Units; 8 using CastleMaster.Ai.AIStates; 9 using Microsoft.Xna.Framework; 10 using CastleMaster.Units.Mobs; 7 11 8 12 namespace CastleMaster.Players … … 10 14 public class PlayerAI : Player 11 15 { 16 public const int DIFFICULTY_EASY = 60 * 10; 17 public const int DIFFICULTY_NORMAL = 60 * 8; 18 public const int DIFFICULTY_HARD = 60 * 3; 12 19 13 public PlayerAI(Team team, Level level, Camera camera) 20 private List<AIState> availableStates; 21 private TimerHelper brainTimer; 22 private AIState currentBrain; 23 private Player enemy; 24 private List<Type> unitTypes; 25 26 public PlayerAI(Team team, Level level, Camera camera, int difficuly, Player enemyPlayer) 14 27 : base(team, level, camera) 15 28 { 29 enemy = enemyPlayer; 30 availableStates = new List<AIState>(); 31 availableStates.Add(new IdleState(this)); 32 availableStates.Add(new AgressiveState(this)); 33 availableStates.Add(new DefensiveState(this)); 34 availableStates.Add(new CollectiveState(this)); 35 36 unitTypes = new List<Type>(); 37 unitTypes.Add(typeof(MobRanger)); 38 unitTypes.Add(typeof(MobWarrior)); 39 40 currentBrain = availableStates[0]; 41 brainTimer = new TimerHelper(difficuly, 1).Start(); 42 brainTimer.RoundEnded += ReThinkBestState; 16 43 } 17 44 18 public override Units.Unit SelectUnit(Team team) 45 public Point DefencePoint { get; set; } 46 47 public List<Type> AttackerTypes { get { return unitTypes; } } 48 49 public Player Enemy { get { return enemy;} } 50 51 public Point ForestPoint { get; set; } 52 53 public override void OnLevelLoaded() 19 54 { 55 ReThinkBestState(); 56 } 57 58 private void ReThinkBestState() 59 { 60 61 62 AIState newState = null; 63 int importance = -1; 64 foreach (AIState aiState in availableStates) 65 { 66 int stateImportance = aiState.Importance; 67 if (importance == -1 || stateImportance > importance) 68 { 69 importance = stateImportance; 70 newState = aiState; 71 } 72 } 73 if (newState != currentBrain) 74 { 75 if (currentBrain != null) currentBrain.OnStateChange(); 76 currentBrain = newState; 77 currentBrain.OnStateChosen(); 78 Console.WriteLine("New state:" + currentBrain); 79 } 80 } 81 82 public override void Update() 83 { 84 brainTimer.UpdateStep(); 85 if (currentBrain != null) currentBrain.ApplyState(); 86 } 87 88 public override Unit SelectUnit(Team team) 89 { 90 if (currentBrain != null) 91 return currentBrain.SelectUnit(team); 20 92 return null; 21 93 } -
2013/30/DenisZ/CastleMaster/CastleMaster/CastleMaster/Units/Mobs/Mob.cs
r4646 r4671 21 21 protected AStar pathFinder; 22 22 protected int dirID; 23 protected AnimationHelper walkingAnimation;23 protected TimerHelper walkingAnimation; 24 24 protected float pushResistance; 25 25 protected bool canBePushed; … … 32 32 currentOrder = new Order(); 33 33 pathFinder = new AStar(level, this); 34 walkingAnimation = new AnimationHelper(10, 2).Start();34 walkingAnimation = new TimerHelper(10, 2).Start(); 35 35 immunityTime = 20; 36 36 canBePushed = true; 37 37 pushResistance = 0.0F; 38 38 } 39 40 public bool HasActiveOrders { get { return currentOrder != null && !(currentOrder is OrderIdle) && !currentOrder.Finished; } } 39 41 40 42 public Level Level { get { return level; } } … … 71 73 } 72 74 73 public void OnGroupOrder (List<Mob> mobs, float x, float z)75 public void OnGroupOrder<T>(List<T> mobs, float x, float z) where T : Mob 74 76 { 75 77 foreach (var mobGroup in mobs.GroupBy(m => m.TypeID)) 76 78 { 77 List< Mob> ms = mobGroup.ToList();79 List<T> ms = mobGroup.ToList(); 78 80 ms[0].OnSameTypeGroupOrder(ms, x, z); 79 81 } 80 82 } 81 83 82 protected virtual void OnSameTypeGroupOrder (List<Mob> mobs, float x, float z)84 protected virtual void OnSameTypeGroupOrder<T>(List<T> mobs, float x, float z) where T : Mob 83 85 { 84 86 OnFunctionClick(x, z, mobs.Count, false); -
2013/30/DenisZ/CastleMaster/CastleMaster/CastleMaster/Units/Mobs/MobRanger.cs
r4646 r4671 23 23 private bool isAttacking = false; 24 24 private int maxDamage = 4; 25 private AnimationHelper hitAnimation;25 private TimerHelper hitAnimation; 26 26 private int spriteX; 27 27 private float pushPower = 2.0F; … … 45 45 isSolid = true; 46 46 moveSpeed = 1.6F; 47 hitAnimation = new AnimationHelper(5, 5, false, 3);47 hitAnimation = new TimerHelper(5, 5, false, 3); 48 48 hitAnimation.RoundEnded += delegate() 49 49 { … … 78 78 } 79 79 80 p rivatevoid CreateAttackOrder(Unit u, int orderAmount, bool wasCalledBefore)80 public void CreateAttackOrder(Unit u, int orderAmount, bool wasCalledBefore) 81 81 { 82 82 currentOrderType = OrderType.ATTACK; -
2013/30/DenisZ/CastleMaster/CastleMaster/CastleMaster/Units/Mobs/MobWarrior.cs
r4646 r4671 22 22 private OrderType currentOrderType = OrderType.NONE; 23 23 private bool isAttacking = false; 24 private int maxDamage = 7;25 private AnimationHelper hitAnimation;24 private int maxDamage = 6; 25 private TimerHelper hitAnimation; 26 26 private int spriteX; 27 27 private float pushPower = 5.0F; … … 45 45 isSolid = true; 46 46 moveSpeed = 1.25F; 47 hitAnimation = new AnimationHelper(8, 5, false, 3);47 hitAnimation = new TimerHelper(8, 5, false, 3); 48 48 hitAnimation.RoundEnded += delegate 49 49 { … … 79 79 } 80 80 81 p rivatevoid CreateAttackOrder(Unit u, int orderAmount, bool wasCalledBefore)81 public void CreateAttackOrder(Unit u, int orderAmount, bool wasCalledBefore) 82 82 { 83 83 currentOrderType = OrderType.ATTACK; -
2013/30/DenisZ/CastleMaster/CastleMaster/CastleMaster/Units/Mobs/MobWoodcutter.cs
r4646 r4671 10 10 using CastleMaster.Entities.TileEntities; 11 11 using CastleMaster.Ai.Orders; 12 using System.Diagnostics; 12 13 13 14 namespace CastleMaster.Units.Mobs … … 19 20 private TileEntityTree currentTarget; 20 21 private bool isChopping = false; 21 private AnimationHelper choppingAnimation;22 private TimerHelper choppingAnimation; 22 23 private int currentSpriteX; 23 24 private OrderType currentOrderType = OrderType.NONE; 24 25 private int lastSameOrderAmount = 0; 25 private bool engangeChopping = false;26 26 27 27 public MobWoodcutter(Level level, Player owner) … … 42 42 43 43 moveSpeed = 2.0F; 44 choppingAnimation = new AnimationHelper(10, 5, false, 3);44 choppingAnimation = new TimerHelper(10, 5, false, 3); 45 45 choppingAnimation.RoundEnded += delegate() 46 46 { 47 owner.LumberAmount++; 47 48 currentTarget.AvaliableLogs--; 48 49 if (currentTarget.AvaliableLogs <= 0) 49 50 { 50 StopChopping();51 51 currentTarget.Remove(); 52 52 currentTarget = null; 53 OrderChop(level.GetNearestEntity<TileEntityTree>(this, 5), 1, false); 53 54 } 54 55 }; … … 58 59 { 59 60 get { return 0; } 61 } 62 63 public void OrderChop(TileEntityTree te, int sameAmount, bool wasCalledBefore) 64 { 65 if (te == null) 66 return; 67 isChopping = true; 68 currentOrderType = OrderType.CHOP; 69 currentTarget = te; 70 SetOrder(new OrderMove(currentTarget.X, currentTarget.Z, 20.0F, sameAmount * 4.0F, true, !wasCalledBefore)); 60 71 } 61 72 … … 80 91 { 81 92 if (currentTarget != null) StopChopping(); 82 currentOrderType = OrderType.CHOP; 83 currentTarget = (TileEntityTree)te; 84 SetOrder(new OrderMove(currentTarget.X, currentTarget.Z, 20.0F, sameOrderAmount * 4.0F, true, !wasCalledBefore)); 93 OrderChop((TileEntityTree)te, sameOrderAmount, wasCalledBefore); 85 94 } 86 95 else … … 91 100 currentTarget = null; 92 101 } 93 SetOrder(new OrderMove(x, z, createNewPathFinder: !wasCalledBefore, stopOnMoveFail: true));102 SetOrder(new OrderMove(x, z, 2.0F, sameOrderAmount * 4.0F, createNewPathFinder: !wasCalledBefore, stopOnMoveFail: true)); 94 103 } 95 104 lastSameOrderAmount = sameOrderAmount; -
2013/30/DenisZ/CastleMaster/CastleMaster/CastleMaster/Units/Unit.cs
r4646 r4671 41 41 immunityTime = 0; 42 42 } 43 44 public int MaxHealth { get { return maxHealth; } } 43 45 44 46 public int Health { get; protected set; } … … 121 123 } 122 124 123 public float DistanceTo(float x, float z)124 {125 float xd = X - x;126 float zd = Z - z;127 128 return (float)(Math.Sqrt(xd * xd + zd * zd));129 }130 131 public float DistanceToSqr(float x, float z)132 {133 float xd = X - x;134 float zd = Z - z;135 136 return xd * xd + zd * zd;137 }138 139 125 public float DistanceFromScreenSpaceSqr(float x, float y) 140 126 { -
2013/30/DenisZ/CastleMaster/CastleMaster/CastleMaster/Units/UnitKing.cs
r4646 r4671 11 11 public class UnitKing : Unit 12 12 { 13 private bool isDestroyed = false; 14 private int timesHit = 0; 15 13 16 public UnitKing(Level level, Player owner) 14 17 : base(level, owner) … … 17 20 depth = 5 * Viewport.TILESIZE; 18 21 HasHealth = true; 19 maxHealth = 150;22 maxHealth = 500; 20 23 21 24 isSolid = true; … … 32 35 rectOffset.Update(-2 * Viewport.TILESIZE, -2 * Viewport.TILESIZE, 2 * Viewport.TILESIZE, 2 * Viewport.TILESIZE); 33 36 immunityTime = 20; 37 } 38 39 public int TimesHit { get { return timesHit; } } 40 41 public bool IsDestroyed { get { return isDestroyed; } } 42 43 public override void Damage(Unit attacker, int damage, float dir, float pushPower) 44 { 45 base.Damage(attacker, damage, dir, pushPower); 46 timesHit++; 34 47 } 35 48 -
2013/30/DenisZ/CastleMaster/CastleMaster/CastleMaster/Units/UnitStore.cs
r4635 r4671 6 6 using CastleMaster.World; 7 7 using CastleMaster.Graphics; 8 using CastleMaster.Units.Mobs; 8 9 9 10 namespace CastleMaster.Units … … 11 12 public class UnitStore : Unit 12 13 { 14 public const int PRICE_WOODCUTTER = 10; 15 public const int PRICE_WARRIOR = 20; 16 public const int PRICE_RANGER = 10; 17 private Dictionary<Type, int> prices; 18 private bool isDestroyed = false; 19 13 20 public UnitStore(Level level, Player owner) 14 21 : base(level, owner) … … 17 24 depth = 8 * Viewport.TILESIZE; 18 25 HasHealth = true; 19 maxHealth = 100;26 maxHealth = 200; 20 27 immunityTime = 20; 21 28 … … 32 39 33 40 rectOffset.Update(-4 * Viewport.TILESIZE, -4 * Viewport.TILESIZE, 4 * Viewport.TILESIZE, 4 * Viewport.TILESIZE); 41 42 prices = new Dictionary<Type, int>(); 43 prices.Add(typeof(MobWoodcutter), PRICE_WOODCUTTER); 44 prices.Add(typeof(MobWarrior), PRICE_WARRIOR); 45 prices.Add(typeof(MobRanger), PRICE_RANGER); 34 46 } 47 48 public T BuyUnit<T>(Type toBuy = null) where T : Mob 49 { 50 Type unitType = toBuy == null ? typeof(T) : toBuy; 51 int cost = prices[unitType]; 52 if (Owner.CoinsAmount - cost < 0) return null; 53 T m = (T)Activator.CreateInstance(unitType, level, Owner); 54 Owner.CoinsAmount -= cost; 55 return m; 56 } 57 58 public bool IsDestroyed { get { return isDestroyed; } } 35 59 36 60 public override void OnRemoved() -
2013/30/DenisZ/CastleMaster/CastleMaster/CastleMaster/World/Level.cs
r4646 r4671 62 62 protected Texture2D tileMap; 63 63 private EntityComprarer comparer = new EntityComprarer(); 64 private AnimationHelper waterAnimation = new AnimationHelper(10, 2).Start();64 private TimerHelper waterAnimation = new TimerHelper(10, 2).Start(); 65 65 private Player[] players; 66 66 … … 88 88 } 89 89 90 public List<Unit>[] Units { get { return units; } } 91 90 92 public Player[] Players { get { return players; } } 93 94 public int[] Tiles { get { return tiles; } } 91 95 92 96 public int Width { get { return width; } } … … 470 474 } 471 475 472 473 //for (int z = zTile - 1; z <= zTile + 1; z++)474 //{475 // if (z < 0 || z >= height) continue;476 // for (int x = xTile - 1; x <= xTile + 1; x++)477 // {478 // if (x < 0 || x >= width) continue;479 // if (x == xTile && z == zTile) continue;480 481 // tp = x + z * width;482 // Tile t = registeredTiles[tiles[tp]];483 // if (t.ID == TILE_VOID || t.IsSolidTo(ent)) blocks |= true;484 485 // List<Entity> ents = entitiesInTiles[tp];486 487 // foreach (Entity e in ents)488 // {489 // if (e != ent)490 // blocks |= e.Blocks(ent);491 // }492 // if (!blocks) return tp;493 // }494 //}495 496 476 return -1; 477 } 478 479 public T GetNearestEntity<T>(Entity caller, int radius) where T : Entity 480 { 481 T nearest = null; 482 float nearestDist = 0.0F, currentDist = 0.0F; 483 484 int xTile = (int)(caller.X / Viewport.TILESIZE); 485 int zTile = (int)(caller.Z / Viewport.TILESIZE); 486 487 List<T> inRadius = new List<T>(); 488 for (int z = zTile - radius; z <= zTile + radius; z++) 489 { 490 if (z < 0 || z >= height) continue; 491 for (int x = xTile - radius; x <= xTile + radius; x++) 492 { 493 if (x < 0 || x >= width) continue; 494 if (x == xTile && z == zTile) continue; 495 496 entitiesInTiles[x + z * width].ForEach(delegate(Entity ent) 497 { 498 if (typeof(T).IsAssignableFrom(ent.GetType())) inRadius.Add((T)ent); 499 }); 500 } 501 } 502 503 foreach (T ent in inRadius) 504 { 505 currentDist = ent.DistanceToSqr(caller.X, caller.Z); 506 if (nearest == null || currentDist < nearestDist) 507 { 508 nearest = ent; 509 nearestDist = currentDist; 510 } 511 } 512 513 return nearest; 514 } 515 516 public bool SolidTo(Entity ent, int xTile, int zTile) 517 { 518 if (registeredTiles[tiles[xTile + zTile * width]].IsSolidTo(ent)) 519 return true; 520 521 foreach (Entity e in entitiesInTiles[xTile + zTile * width]) 522 if (e.Blocks(ent)) return true; 523 524 return false; 497 525 } 498 526 -
2013/30/DenisZ/CastleMaster/CastleMaster/CastleMaster/World/LevelForest.cs
r4635 r4671 6 6 using CastleMaster.Units.Mobs; 7 7 using Viewport = CastleMaster.Graphics.Viewport; 8 using Microsoft.Xna.Framework; 9 using CastleMaster.Players; 8 10 9 11 namespace CastleMaster.World … … 12 14 { 13 15 private int TILE_FLOOR, TILE_WATER, TILE_FLOOR_SOLID, TILE_KING1_HINT, TILE_KING1_HINT2, TILE_STORE1_HINT, TILE_KING2_HINT, TILE_KING2_HINT2, TILE_STORE2_HINT; 14 private UnitKing king1, king2; 15 private UnitStore store1, store2; 16 16 17 17 public LevelForest(Texture2D tileMap) 18 18 : base(tileMap) … … 22 22 protected override void InitTiles() 23 23 { 24 king1 = new UnitKing(this, Players[0]);25 store1 = new UnitStore(this, Players[0]);26 27 king2 = new UnitKing(this, Players[1]);28 store2 = new UnitStore(this, Players[1]);29 30 24 TILE_FLOOR = new TileFloor(this).ID; 31 25 TILE_WATER = new TileWater(this).ID; 32 26 TILE_FLOOR_SOLID = new TileFloor(this, true).ID; 33 TILE_KING1_HINT = new TileRenderHint(this, king1, true, false).ID;34 TILE_KING1_HINT2 = new TileRenderHint(this, king1, false, false).ID;35 TILE_STORE1_HINT = new TileRenderHint(this, store1, true, true).ID;36 TILE_KING2_HINT = new TileRenderHint(this, king2, true, false).ID;37 TILE_STORE2_HINT = new TileRenderHint(this, store2, true, true).ID;38 TILE_KING2_HINT2 = new TileRenderHint(this, king2, false, false).ID;27 TILE_KING1_HINT = new TileRenderHint(this, Players[0].King, true, false).ID; 28 TILE_KING1_HINT2 = new TileRenderHint(this, Players[0].King, false, false).ID; 29 TILE_STORE1_HINT = new TileRenderHint(this, Players[0].Store, true, true).ID; 30 TILE_KING2_HINT = new TileRenderHint(this, Players[1].King, true, false).ID; 31 TILE_STORE2_HINT = new TileRenderHint(this, Players[1].Store, true, true).ID; 32 TILE_KING2_HINT2 = new TileRenderHint(this, Players[1].King, false, false).ID; 39 33 } 40 34 … … 58 52 lb.AddTile(0xFF303030, TILE_FLOOR, 2); 59 53 54 lb.AddTile(0xFF00FF00, TILE_FLOOR); 55 lb.AddTile(0xFF00FF01, TILE_FLOOR); 56 lb.AddTile(0xFF00FF10, TILE_FLOOR); 57 lb.AddTile(0xFF00FF20, TILE_FLOOR); 58 lb.AddTile(0xFF00FF30, TILE_FLOOR); 59 lb.AddTile(0xFF00FF40, TILE_FLOOR); 60 lb.AddTile(0xFF00FF11, TILE_FLOOR); 61 lb.AddTile(0xFF00FF21, TILE_FLOOR); 62 lb.AddTile(0xFF00FF31, TILE_FLOOR); 63 lb.AddTile(0xFF00FF50, TILE_FLOOR); 64 65 lb.AddTile(0xFF00FFFF, TILE_FLOOR); 60 66 lb.AddTile(0xFF0000FF, TILE_FLOOR); 61 67 lb.AddTile(0xFFFFD800, TILE_FLOOR); … … 66 72 lb.AddEntity(0xFF00CC00, typeof(TileEntityBlock), 8.0F, 8.0F, this, 1, 2); 67 73 lb.AddEntity(0xFF00E500, typeof(TileEntityBlock), 8.0F, 8.0F, this, 0, 2); 68 lb.AddEntity(0xFF00FF00, typeof(TileEntityBlock), 8.0F, 8.0F, this, 6, 0);69 74 lb.AddEntity(0xFF0000FF, typeof(MobWarrior), 8.0F, 8.0F, this, Players[0]); 70 75 lb.AddEntity(0xFFFF0000, typeof(MobWoodcutter), 8.0F, 8.0F, this, Players[0]); … … 73 78 lb.AddEntity(0xFF00FFFF, typeof(MobWoodcutter), 8.0F, 8.0F, this, Players[1]); 74 79 80 lb.AddCustom(0xFF00FF00, delegate(Level level, int xTile, int zTile) 81 { 82 Players[1].HomePoint = new Point(xTile, zTile); 83 }); 84 85 lb.AddCustom(0xFF00FF20, delegate(Level level, int xTile, int zTile) 86 { 87 Players[1].WoodcutterSpawnPoint = new Point(xTile, zTile); 88 }); 89 90 lb.AddCustom(0xFF00FF30, delegate(Level level, int xTile, int zTile) 91 { 92 Players[1].WarriorSpawnPoint = new Point(xTile, zTile); 93 }); 94 95 lb.AddCustom(0xFF00FF40, delegate(Level level, int xTile, int zTile) 96 { 97 Players[1].RangerSpawnPoint = new Point(xTile, zTile); 98 }); 99 100 lb.AddCustom(0xFF00FF10, delegate(Level level, int xTile, int zTile) 101 { 102 ((PlayerAI)Players[1]).ForestPoint = new Point(xTile, zTile); 103 }); 104 105 lb.AddCustom(0xFF00FF50, delegate(Level level, int xTile, int zTile) 106 { 107 ((PlayerAI)Players[1]).DefencePoint = new Point(xTile, zTile); 108 }); 109 110 lb.AddCustom(0xFF00FF01, delegate(Level level, int xTile, int zTile) 111 { 112 Players[0].HomePoint = new Point(xTile, zTile); 113 }); 114 115 lb.AddCustom(0xFF00FF11, delegate(Level level, int xTile, int zTile) 116 { 117 Players[0].WoodcutterSpawnPoint = new Point(xTile, zTile); 118 }); 119 120 lb.AddCustom(0xFF00FF21, delegate(Level level, int xTile, int zTile) 121 { 122 Players[0].WarriorSpawnPoint = new Point(xTile, zTile); 123 }); 124 125 lb.AddCustom(0xFF00FF31, delegate(Level level, int xTile, int zTile) 126 { 127 Players[0].RangerSpawnPoint = new Point(xTile, zTile); 128 }); 129 75 130 lb.AddCustom(0xFFFF6A03, delegate(Level level, int xTile, int zTile) 76 131 { 77 level.AddEntity( king2, xTile * Viewport.TILESIZE + 8.0F, zTile * Viewport.TILESIZE + 8.0F);132 level.AddEntity(Players[1].King, xTile * Viewport.TILESIZE + 8.0F, zTile * Viewport.TILESIZE + 8.0F); 78 133 }); 79 134 lb.AddCustom(0xFFFF6A02, delegate(Level level, int xTile, int zTile) 80 135 { 81 level.AddEntity( store2, xTile * Viewport.TILESIZE + 8.0F, zTile * Viewport.TILESIZE + 8.0F);136 level.AddEntity(Players[1].Store, xTile * Viewport.TILESIZE + 8.0F, zTile * Viewport.TILESIZE + 8.0F); 82 137 }); 83 138 84 139 lb.AddCustom(0xFFFF6A00, delegate(Level level, int xTile, int zTile) 85 140 { 86 level.AddEntity( king1, xTile * Viewport.TILESIZE + 8.0F, zTile * Viewport.TILESIZE + 8.0F);141 level.AddEntity(Players[0].King, xTile * Viewport.TILESIZE + 8.0F, zTile * Viewport.TILESIZE + 8.0F); 87 142 }); 88 143 lb.AddCustom(0xFFFF6A01, delegate(Level level, int xTile, int zTile) 89 144 { 90 level.AddEntity( store1, xTile * Viewport.TILESIZE + 8.0F, zTile * Viewport.TILESIZE + 8.0F);145 level.AddEntity(Players[0].Store, xTile * Viewport.TILESIZE + 8.0F, zTile * Viewport.TILESIZE + 8.0F); 91 146 }); 92 147
Note: See TracChangeset
for help on using the changeset viewer.