public BaseTest(int Tiles, int Chaining) { tiles = Tiles; chaining = Chaining; model = new Models.TilesModel(connection, tiles); map = new Map.Map(model, tiles, chaining); }
public BaseControler(HttpListenerContext Context, Map.Map World) { context = Context; world = World; Models.UserModel usersModel = new Models.UserModel(Server.Server.connection); user = new Controlers.UserControler(context, usersModel, world); }
public Colony(Map.Map map, RenderWindow window) { colonists_ = new List<Men>(); constructs_ = new List<Construct>(); JobQueue = new FastPriorityQueue<Job>(5_000); map_ = map; window_ = window; }
public DebugDrawingSurfaceWindow(DrawingSurface ds, TileLayer tiles, Theater t, Map.Map map) : this() { _drawingSurface = ds; _tiles = tiles; _theater = t; _map = map; ds.Unlock(); pictureBox1.Image = ds.Bitmap; }
static void Main(string[] args) { Map.Map map = null; //map = new Map.Map(75, 75); map = new Map.Map(235, 57); Display.File.WriteFile.write_human(map, "output.txt"); Process.Start(@"output.txt"); }
public override void Run() { base.Run(); Trees.QuadTree.QuadTree<Map.Block> tree; Map.Rectangle rectangle; while (tiles <= maxTiles && chaining <= maxChaining) { model.RemoveAllTiles(); map = new Map.Map(model, tiles, chaining); Console.WriteLine("Tiles = {0}, Chaining = {1}", tiles, chaining); Trees.QuadTree.QuadTree<Map.Block>.freeAllTree(); rectangle = new Map.Rectangle(0, 0, 1); StartTimer(); tree = map.getIntersectTree(rectangle); StopTimer(String.Format("Read Part + DB + storing")); StartTimer(); tree = map.getIntersectTree(rectangle); StopTimer(String.Format("Read Part + DB")); StartTimer(); tree = map.getIntersectTree(rectangle); StopTimer(String.Format("Read Part")); Trees.QuadTree.QuadTree<Map.Block>.freeAllTree(); rectangle = new Map.Rectangle(0, 0, 15); List<Map.Block> parts = null; StartTimer(); parts = map.getIntersect(rectangle); StopTimer(String.Format("Read Space + DB")); StartTimer(); parts = map.getIntersect(rectangle); StopTimer(String.Format("Read Space")); tiles *= 2; if (tiles > maxTiles) { tiles = minTiles; chaining++; } } Console.WriteLine("Test finished!"); }
public DebugDrawingSurfaceWindow(DrawingSurface ds, TileLayer tiles, Theater t, Map.Map map) : this() { _drawingSurface = ds; _tiles = tiles; _theater = t; _map = map; _cells = (_map.FullSize.Width * 2 - 1) * _map.FullSize.Height; ds.Unlock(); pictureBox1.Image = ds.Bitmap; }
private void Mine_OnAdditionEnd(Actor actor, Buff skill, bool cancel) { Map.Map map = Map.MapManager.Instance.GetMap(actor.MapInstanceID); ((ActorExt)actor).Tasks.TryRemove("Mine", out Task removed); UpdateEvent evt = new UpdateEvent() { Actor = actor, Target = actor, SkillSession = 128, AdditionID = 15208019, AdditionSession = 1, ExtraActivateMode = UpdateEvent.ExtraUpdateModes.Cancel }; evt.SkillSession = arg.SkillSession; evt.UpdateType = UpdateTypes.Actor; evt.UserData = new byte[] { 9, 3, 0 }; map.SendEventToAllActorsWhoCanSeeActor(MapEvents.EVENT_BROADCAST, evt, actor, true); evt = new UpdateEvent() { Actor = actor, Target = actor, AdditionSession = 1, AdditionID = 15208019, ExtraActivateMode = UpdateEvent.ExtraUpdateModes.Cancel, SkillSession = 128, UpdateType = UpdateTypes.ActorExtension }; map.SendEventToAllActorsWhoCanSeeActor(MapEvents.EVENT_BROADCAST, evt, actor, true); SkillManager.Instance.BroadcastSkillCast(arg, SkillMode.Abort); SkillManager.Instance.DoAttack(arg); foreach (SkillAffectedActor i in arg.AffectedActors) { SkillAttackResult res = i.Result; if (res != SkillAttackResult.Avoid && res != SkillAttackResult.Miss && res != SkillAttackResult.Parry && res != SkillAttackResult.TotalParry) { if (i.Target.Tasks.ContainsKey("ActorDown")) { Buff buff = i.Target.Tasks["ActorDown"] as Buff; buff.Deactivate(); } i.NoDamageBroadcast = true; Common.Additions.ActorDown add = new Common.Additions.ActorDown(arg, i.Target, 15208018, i.Damage); i.Target.Tasks["ActorDown"] = add; add.Activate(); } } SkillManager.Instance.BroadcastSkillCast(arg, SkillMode.End); }
public void ApplyStrech(int x, int y, sbyte z) { Map.Map map = World.Map; if (IsStretched || UOFileManager.Textmaps.GetTexture(TileData.TexID) == null || !TestStretched(x, y, z, true)) { IsStretched = false; MinZ = z; } else { IsStretched = true; UpdateZ( map.GetTileZ(x, y + 1), map.GetTileZ(x + 1, y + 1), map.GetTileZ(x + 1, y), z); Vector3[,,] vec = new Vector3[3, 3, 4]; int i; int j; if (Normals == null || Normals.Length != 4) { Normals = new Vector3[4]; } for (i = -1; i < 2; i++) { int curX = x + i; int curI = i + 1; for (j = -1; j < 2; j++) { int curY = y + j; int curJ = j + 1; sbyte currentZ = map.GetTileZ(curX, curY); sbyte leftZ = map.GetTileZ(curX, curY + 1); sbyte rightZ = map.GetTileZ(curX + 1, curY); sbyte bottomZ = map.GetTileZ(curX + 1, curY + 1); if (currentZ == leftZ && currentZ == rightZ && currentZ == bottomZ) { for (int k = 0; k < 4; k++) { ref var v = ref vec[curI, curJ, k]; v.X = 0; v.Y = 0; v.Z = 1; } }
/// <summary> /// aktualizacja stanu Vandala /// </summary> /// <param name="gametime">czas gry</param> /// <param name="map">mapa obiektow</param> public override void Update(GameTime gametime, Map.Map map) { if (!is_immortal) { //sprawdzenie czy styka sie z wrogiem if (!map.GetVandal().is_immortal&& map.getObject(x, y).GetType() == typeof(Characters.Enemy) || map.getObject(x, y) is Skazony) { is_alive = false; return; } } LoadCurrentTexture(map); if (gametime.TotalGameTime.Milliseconds % 20 == 0) { switch (current_direction) { case Game.direction.down: MoveInDirection(0, 1, map); current_direction = Game.direction.none; break; case Game.direction.left: if (rectangle.X > 0) { MoveInDirection(-1, 0, map); } current_direction = Game.direction.none; break; case Game.direction.right: MoveInDirection(1, 0, map); current_direction = Game.direction.none; break; case Game.direction.up: if (rectangle.Y > 0) { MoveInDirection(0, -1, map); } current_direction = Game.direction.none; break; default: MoveInDirection(0, 0, map); current_direction = Game.direction.none; break; } } }
/// <summary> /// Poruszanie w określonym kierunku /// </summary> /// <param name="add_x">Zmiana indeksu x na tablicy obiektów</param> /// <param name="add_y">Zmiana indeksu y na tablicy obiektów </param> /// <param name="map">Mapa obiektów</param> public void MoveInDirection(int add_x, int add_y, Map.Map map) { int new_x = x + add_x; int new_y = y + add_y; collision_obj = map.getObject(new_x, new_y); if (collision_obj.GetType() == typeof(NonDestroyableObjects.Puste) || collision_obj.GetType() == typeof(DestroyableObjects.Ziemia)) { map.setObject(new_x, new_y, this); map.setObject(x, y, new NonDestroyableObjects.Puste(content, new Rectangle(x * this.rectangle.Width, y * this.rectangle.Height, this.rectangle.Width, this.rectangle.Height), x, y)); x = new_x; y = new_y; } }
public void ApplyStrech(int x, int y, sbyte z) { Map.Map map = World.Map; if (IsStretched || TexmapsLoader.Instance.GetTexture(TileData.TexID) == null || !TestStretched(x, y, z, true)) { IsStretched = false; MinZ = z; } else { IsStretched = true; UpdateZ ( map.GetTileZ(x, y + 1), map.GetTileZ(x + 1, y + 1), map.GetTileZ(x + 1, y), z ); //Vector3[,,] vec = new Vector3[3, 3, 4]; int i; int j; for (i = -1; i < 2; i++) { int curX = x + i; int curI = i + 1; for (j = -1; j < 2; j++) { int curY = y + j; int curJ = j + 1; sbyte currentZ = map.GetTileZ(curX, curY); sbyte leftZ = map.GetTileZ(curX, curY + 1); sbyte rightZ = map.GetTileZ(curX + 1, curY); sbyte bottomZ = map.GetTileZ(curX + 1, curY + 1); if (currentZ == leftZ && currentZ == rightZ && currentZ == bottomZ) { for (int k = 0; k < 4; k++) { ref Vector3 v = ref _vectCache[curI, curJ, k]; v.X = 0; v.Y = 0; v.Z = 1; } }
private void Fire_OnAdditionStart(Actor actor, Buff skill) { Map.Map map = Map.MapManager.Instance.GetMap(actor.MapInstanceID); UpdateEvent evt = UpdateEvent.NewActorAdditionEvent(arg.Caster, (ActorExt)actor, arg.SkillSession, 4105, 12000035, UpdateEvent.ExtraUpdateModes.Activate); //evt.AddActorPara(SagaBNS.Common.Packets.GameServer.PacketParameter.Unk7A, 4); //evt.AddActorPara(SagaBNS.Common.Packets.GameServer.PacketParameter.UnkF7, 1); map.SendEventToAllActorsWhoCanSeeActor(MapEvents.EVENT_BROADCAST, evt, actor, true); evt = UpdateEvent.NewActorAdditionExtEvent((ActorExt)actor, arg.SkillSession, 4105, 12000035, 10000, UpdateEvent.ExtraUpdateModes.Activate); evt.AdditionCount = AccumulateCount; map.SendEventToAllActorsWhoCanSeeActor(MapEvents.EVENT_BROADCAST, evt, actor, true); }
/// <summary> /// Wybierz kierunek ruchu /// </summary> /// <param name="map"></param> /// <returns></returns> public Game.direction Move(Map.Map map) { current_direction = Game.direction.none; // map.setObject(x, y, new NonDestroyableObjects.Puste(content, this.Rectangle)); for (int i = 0; i < 4; i++) { if (isPointAccesible(map, ((int)current_direction + 1) % 4)) { current_direction = (Game.direction)(((int)current_direction + i) % 4); break; } } return(current_direction); }
private void Fire_OnAdditionEnd(Actor actor, Buff skill, bool cancel) { Map.Map map = Map.MapManager.Instance.GetMap(actor.MapInstanceID); ((ActorExt)actor).Tasks.TryRemove("Fire", out Task removed); UpdateEvent evt = UpdateEvent.NewActorAdditionEvent(arg.Caster, (ActorExt)actor, arg.SkillSession, 4105, 12000035, UpdateEvent.ExtraUpdateModes.Cancel); //evt.AddActorPara(SagaBNS.Common.Packets.GameServer.PacketParameter.Unk7A, 0); //evt.AddActorPara(SagaBNS.Common.Packets.GameServer.PacketParameter.UnkF7, 0); evt.UserData = new byte[] { 9, 4, 0 }; map.SendEventToAllActorsWhoCanSeeActor(MapEvents.EVENT_BROADCAST, evt, actor, true); evt = UpdateEvent.NewActorAdditionExtEvent((ActorExt)actor, arg.SkillSession, 4105, 12000035, 10000, UpdateEvent.ExtraUpdateModes.Cancel); map.SendEventToAllActorsWhoCanSeeActor(MapEvents.EVENT_BROADCAST, evt, actor, true); }
public Move(AI ai, ActorNPC self, short x, short y, short z) { this.ai = ai; this.self = self; this.x = x; this.y = y; this.z = z; map = Map.MapManager.Instance.GetMap(self.MapInstanceID); ai.Period = (int)(2000 / ((float)self.Speed / 200)); if (self.BaseData.NoMove) { status = CommandStatus.Finished; } }
private void CounterEnemy_OnAdditionEnd(Actor actor, Buff skill, bool cancel) { ((ActorExt)actor).Status.Counter = false; Map.Map map = MapManager.Instance.GetMap(actor.MapInstanceID); ((ActorExt)actor).Tasks.TryRemove("CounterSelf", out Task removed); arg.Caster.Status.StanceFlag1.SetValue(StanceU1.Unknown40000, false); UpdateEvent evt = UpdateEvent.NewActorAdditionEvent(arg.Caster, arg.Caster, arg.SkillSession, 4098, 11000018, UpdateEvent.ExtraUpdateModes.Cancel); //evt.AddActorPara(SagaBNS.Common.Packets.GameServer.PacketParameter.Unk7A, arg.Caster.Status.StanceFlag1.Value); map.SendEventToAllActorsWhoCanSeeActor(MapEvents.EVENT_BROADCAST, evt, arg.Caster, true); evt = UpdateEvent.NewActorAdditionExtEvent(arg.Caster, arg.SkillSession, 4098, 11000018, TotalLifeTime, UpdateEvent.ExtraUpdateModes.Cancel); map.SendEventToAllActorsWhoCanSeeActor(MapEvents.EVENT_BROADCAST, evt, arg.Caster, true); }
//TODO: Put into their own functions private void CustomMessage(NetIncomingMessage message) { MessageTemplate template; string ms = message.ReadString(); if (ms != null) { template = Newtonsoft.Json.JsonConvert.DeserializeObject <MessageTemplate>(ms); switch (template.MessageType) { //TODO: Put These into functions case MessageType.LoginSuccess: Debug.WriteLine("Login and recieved sucessfully!"); MainScene mainScene = new MainScene(); CharacterPlayer player = Newtonsoft.Json.JsonConvert.DeserializeObject <CharacterPlayer>(template.JsonMessage); MessageManager.GetLoginManagerClient().SetCharacter(player); mainScene.player = PlayerManager.CreatePlayer(player, mainScene); FollowCamera fCamera = new FollowCamera(mainScene.player, FollowCamera.CameraStyle.CameraWindow) { FollowLerp = 0.3f }; mainScene.player.AddComponent(fCamera); Core.StartSceneTransition(new FadeTransition(() => mainScene)); break; case MessageType.LoginFailure: Debug.WriteLine("Failed to login! Try again"); break; case MessageType.Movement: Vector2 vector2 = Newtonsoft.Json.JsonConvert.DeserializeObject <Vector2>(template.JsonMessage); LoginManagerClient.GetCharacter().MoveToPos(vector2); break; case MessageType.GameUpdate: GameUpdateState(template.JsonMessage); break; case MessageType.MapChange: TileSceneComponent tsc = Scene.GetSceneComponent <TileSceneComponent>(); Map.Map map = tsc.MapList.FirstOrDefault(m => m.MapName.Equals(template.JsonMessage)); tsc.ChangeMap(map); break; } } }
private void ActorItemPickDropTask_OnAdditionEnd(SmartEngine.Network.Map.Actor actor, Buff skill, bool cancel) { Map.Map map = MapManager.Instance.GetMap(pc.MapInstanceID); pc.Tasks.TryRemove("ActorItemPickDropTask", out Task removed); switch (action) { case ActionTypes.Pick: { UpdateEvent evt = new UpdateEvent() { UpdateType = UpdateTypes.ItemPick, Actor = pc, Target = item, UserData = (byte)1 }; map.SendEventToAllActorsWhoCanSeeActor(MapEvents.EVENT_BROADCAST, evt, pc, true); } break; case ActionTypes.PickCorpse: { UpdateEvent evt = new UpdateEvent() { UpdateType = UpdateTypes.ItemPickCorpse, Actor = pc, Target = item, UserData = (byte)1 }; map.SendEventToAllActorsWhoCanSeeActor(MapEvents.EVENT_BROADCAST, evt, pc, true); } break; case ActionTypes.Drop: { UpdateEvent evt = new UpdateEvent() { UpdateType = UpdateTypes.ItemDrop, Actor = pc, Target = item, X = (short)item.X, Y = (short)item.Y, Z = (short)item.Z, UserData = (byte)1 }; map.SendEventToAllActorsWhoCanSeeActor(MapEvents.EVENT_BROADCAST, evt, pc, true); } break; } }
/// <summary> /// Przesuwanie /// </summary> /// <param name="map"> Aktualna mapa obiektów</param> /// <param name="x_vel">Predkość w poziomie</param> /// <returns>czy moze byc przesuniety</returns> public bool Przesun(Map.Map map, int x_vel) { if (map.getObject(x + x_vel, y).GetType() == typeof(NonDestroyableObjects.Puste)) { map.setObject(x + x_vel, y, this); this.x = x + x_vel; this.y = y; return(true); } else { return(false); } }
/// <summary> /// Reakcja na wejście Vandala /// </summary> /// <param name="map"></param> public void OnDestroy(Map.Map map) { map.AddPlayersPoints(points); if (!deactivated) { deactivated = true; asset_name = "Textures\\deactivated_goal"; texture = content.Load <Texture2D>(asset_name); } else { map.vandal.level_up = true; } }
public static bool[,] GetSearchBoolMap(Map.Map aMap) { int width = aMap.Width; int height = aMap.Height; Tile[] tempTiles = aMap.TheTileArray; bool[,] tempMap = new bool[width, height]; int index = 0; unsafe { // for each row for (int y = 0; y < height; y++) { // for each pixel // for (int x = 0; x < width; x++, src += 4) for (int x = 0; x < width; x++, index++) { switch (tempTiles[index].TheTileId) { case Tile.TileIds.Desert: tempMap[x, y] = true; break; case Tile.TileIds.Grass: tempMap[x, y] = true; break; case Tile.TileIds.Road: tempMap[x, y] = true; break; case Tile.TileIds.Water: tempMap[x, y] = false; break; case Tile.TileIds.Wall: tempMap[x, y] = false; break; default: throw new ArgumentOutOfRangeException(); } } } } return(tempMap); }
public override void OnActorEnterPortal(Actor aActor) { if (aActor.ActorType == ActorType.PC) { bool warped = false; ActorPC pc = (ActorPC)aActor; foreach (PortalTrigger i in portal.PortalTriggers) { if (i.Quest > 0) { if (pc.Quests.ContainsKey(i.Quest)) { if (i.Step == pc.Quests[i.Quest].NextStep - 1 || i.Step == -1 || (i.Step == 0 && i.Step == pc.Quests[i.Quest].Step)) { int abs = Math.Abs(i.Dir - pc.Dir); if (abs <= 90 || abs > 270) { Map.Map map = Map.MapManager.Instance.GetMap(i.MapTarget, pc.CharID, pc.PartyID); if (map != null) { warped = true; pc.Client().Map.SendActorToMap(pc, map, pc.X, pc.Y, pc.Z); } else { Logger.Log.Warn(string.Format("MapID:{0} isn't defined!", i.MapTarget)); } break; } } } } else { Map.Map map = Map.MapManager.Instance.GetMap(i.MapTarget, pc.CharID, pc.PartyID); if (map != null) { warped = true; pc.Client().Map.SendActorToMap(pc, map, pc.X, pc.Y, pc.Z); } } } if (!warped) { pc.Client().SendPortalNotWarp(); } } }
private void ActorCatch_OnAdditionEnd(Actor actor, Buff skill, bool cancel) { target.Status.Catch = false; Map.Map map = MapManager.Instance.GetMap(actor.MapInstanceID); target.Status.StanceFlag1.SetValue(StanceU1.Unknown400000000000, false); target.Status.StanceFlag1.SetValue(StanceU1.Unknown200000000000, false); target.Status.StanceFlag1.SetValue(StanceU1.NoMove, false); target.Status.StanceFlag1.SetValue(StanceU1.Unknown4, false); target.Status.InteractWith = 0; arg.Caster.Status.InteractWith = 0; target.Tasks.TryRemove("ActorCatch", out Task removed); UpdateEvent evt = UpdateEvent.NewActorAdditionEvent(arg.Caster, target, arg.SkillSession, 4098, additionID, UpdateEvent.ExtraUpdateModes.Cancel); evt.UpdateType = UpdateTypes.Actor; //evt.AddActorPara(SagaBNS.Common.Packets.GameServer.PacketParameter.Unk7A, target.Status.StanceFlag1.Value); map.SendEventToAllActorsWhoCanSeeActor(MapEvents.EVENT_BROADCAST, evt, target, true); evt = UpdateEvent.NewActorAdditionEvent(arg.Caster, arg.Caster, 0, 0, 65000, UpdateEvent.ExtraUpdateModes.Cancel); //evt.AddActorPara(SagaBNS.Common.Packets.GameServer.PacketParameter.InteractWith, 0); //evt.AddActorPara(SagaBNS.Common.Packets.GameServer.PacketParameter.InteractionType, 0); //evt.AddActorPara(SagaBNS.Common.Packets.GameServer.PacketParameter.InteractionRelation, 0); //evt.AddActorPara(SagaBNS.Common.Packets.GameServer.PacketParameter.Unk74, 0); //evt.AddActorPara(SagaBNS.Common.Packets.GameServer.PacketParameter.UnkD7, 0); map.SendEventToAllActorsWhoCanSeeActor(MapEvents.EVENT_BROADCAST, evt, actor, true); target.Status.StanceFlag1.SetValue(StanceU1.Unknown4, true); target.X = arg.Caster.X + diffX; target.Y = arg.Caster.Y + diffY; target.Z = arg.Caster.Z; evt = UpdateEvent.NewActorAdditionEvent(arg.Caster, target, arg.SkillSession, 4099, 12300011, UpdateEvent.ExtraUpdateModes.Cancel); evt.AddActorPara(SagaBNS.Common.Packets.GameServer.PacketParameter.X, arg.Caster.X); evt.AddActorPara(SagaBNS.Common.Packets.GameServer.PacketParameter.Y, arg.Caster.Y); evt.AddActorPara(SagaBNS.Common.Packets.GameServer.PacketParameter.Z, arg.Caster.Z); //evt.AddActorPara(SagaBNS.Common.Packets.GameServer.PacketParameter.Unk7A, target.Status.StanceFlag1.Value); //evt.AddActorPara(SagaBNS.Common.Packets.GameServer.PacketParameter.InteractWith, 0); //evt.AddActorPara(SagaBNS.Common.Packets.GameServer.PacketParameter.InteractionType, 0); //evt.AddActorPara(SagaBNS.Common.Packets.GameServer.PacketParameter.InteractionRelation, 0); //evt.AddActorPara(SagaBNS.Common.Packets.GameServer.PacketParameter.Unk74, 0); //evt.AddActorPara(SagaBNS.Common.Packets.GameServer.PacketParameter.UnkD7, 0); evt.UserData = new byte[] { 9, 1, 0 }; map.SendEventToAllActorsWhoCanSeeActor(MapEvents.EVENT_BROADCAST, evt, target, true); evt = UpdateEvent.NewActorAdditionExtEvent(arg.Caster, arg.SkillSession, 4099, 12300011, 5000, UpdateEvent.ExtraUpdateModes.Cancel); map.SendEventToAllActorsWhoCanSeeActor(MapEvents.EVENT_BROADCAST, evt, arg.Caster, true); SkillManager.Instance.BroadcastSkillCast(arg, SkillMode.End); }
public void Save(Map.Map map) { /* * using (var writer = new BinaryWriter(File.Open(map.Filename + ".col", FileMode.Create))) * { * writer.Write("GTA2.NETv0.1"); * var mapFile = Path.GetFileName(map.Filename); * if (mapFile == null) * throw new NotSupportedException(); * writer.Write(mapFile); * var mapChecksum = GetMapCheckSum(map); * writer.Write(mapChecksum.Length); * writer.Write(mapChecksum); * writer.Write(Count); * foreach (var obstacle in this) * { * writer.Write((byte) obstacle.Type); * writer.Write(obstacle.IsSlope); * writer.Write(obstacle.Z); * if (obstacle is RectangleObstacle) * { * var rectangleObstacle = (RectangleObstacle) obstacle; * writer.Write(rectangleObstacle.X); * writer.Write(rectangleObstacle.Y); * writer.Write(rectangleObstacle.Width); * writer.Write(rectangleObstacle.Length); * } * else if (obstacle is LineObstacle) * { * var lineObstacle = (LineObstacle)obstacle; * writer.Write(lineObstacle.Start.X); * writer.Write(lineObstacle.Start.Y); * writer.Write(lineObstacle.End.X); * writer.Write(lineObstacle.End.Y); * } * else if (obstacle is PolygonObstacle) * { * var polygonObstacle = (PolygonObstacle) obstacle; * writer.Write(polygonObstacle.Vertices.Count); * foreach (var point in polygonObstacle.Vertices) * { * writer.Write(point.X); * writer.Write(point.Y); * } * } * } * } */ }
public StructurePlacer(EStructureType platformType, EPlacementType placementType, EScreen screen, Camera camera, ref Director director, ref Map.Map map, float x = 0, float y = 0, ResourceMap resourceMap = null) { mUnregister = false; mCamera = camera; Screen = screen; mDirector = director; mPlatformType = platformType; // need the structure map to make sure platforms arent placed on collidable objects mMap = map; mDirector.GetInputManager.FlagForAddition(this, EClickType.Both, EClickType.Both); mDirector.GetInputManager.AddMousePositionListener(this); mCurrentState = new State3(); director.GetUserInterfaceController.BuildingProcessStarted(platformType); // for further information as to why which states refer to the documentation for mCurrentState switch (placementType) { case EPlacementType.RoadMouseFollowAndRoad: mIsRoadPlacement = true; break; case EPlacementType.PlatformMouseFollowAndRoad: break; } if (mIsRoadPlacement) { return; } mPlatform = PlatformFactory.Get(platformType, ref director, x, y, resourceMap); mPlatform.SetLayer(LayerConstants.PlatformAboveFowLayer); UpdateBounds(); // makes a sound once when platform is placed mPlatformCreateSoundId = mDirector.GetSoundManager.CreateSoundInstance("PlatformCreate", mPlatform.Center.X, mPlatform.Center.Y, .24f, .01f, true, false, SoundClass.Effect); }
public DebugDrawingSurfaceWindow(DrawingSurface ds, TileLayer tiles, Theater t, Map.Map map) : this() { _drawingSurface = ds; _tiles = tiles; _theater = t; _map = map; _cells = (_map.FullSize.Width * 2 - 1) * _map.FullSize.Height; ds.Unlock(); // map is pre-rendered bitmap, shadow/heightmap are rendered on demand canvasMap.Image = ds.Bitmap; }
private void CounterEnemy_OnAdditionEnd(Actor actor, Buff skill, bool cancel) { ((ActorExt)actor).Status.Counter = false; Map.Map map = MapManager.Instance.GetMap(actor.MapInstanceID); ((ActorExt)actor).Tasks.TryRemove("CounterEnemy", out Task removed); UpdateEvent evt = UpdateEvent.NewActorAdditionEvent((ActorExt)actor, (ActorExt)actor, arg.SkillSession, 1, 11103010, UpdateEvent.ExtraUpdateModes.Cancel); evt.UserData = new byte[] { 9, 1, 0 }; //evt.AddActorPara(SagaBNS.Common.Packets.GameServer.PacketParameter.BlockingStance, 0); map.SendEventToAllActorsWhoCanSeeActor(MapEvents.EVENT_BROADCAST, evt, actor, true); evt = UpdateEvent.NewActorAdditionExtEvent((ActorExt)actor, arg.SkillSession, 1, 11103010, 0, UpdateEvent.ExtraUpdateModes.Cancel); map.SendEventToAllActorsWhoCanSeeActor(MapEvents.EVENT_BROADCAST, evt, actor, true); SkillManager.Instance.BroadcastSkillCast(arg, SkillMode.End); }
public void SpawnAll(uint mapID, Map.Map map) { /*if (items.ContainsKey(mapID)) * { * foreach (ActorPortal i in items[mapID]) * { * if (map != null) * { * i.EventHandler = new ActorEventHandlers.PortalEventHandler(i); * map.RegisterActor(i); * map.SendVisibleActorsToActor(i); * } * } * }*/ }
public static Vector3[] PathToVector3Array(Map.Map aMap, List <Point> aPath, float aHeith) { int offestX = aMap.TheBoundingBox.Location.X; int offestY = aMap.TheBoundingBox.Location.Y; Vector3[] temVector3s = new Vector3[aPath.Count]; for (int index = 0; index < aPath.Count; index++) { Point aPoint = aPath[index]; temVector3s[index] = new Vector3(aPoint.X + offestX, aHeith, aPoint.Y + offestY); } return(temVector3s); }
private void StartLevel() { _map = _levelSetup.Map; _map.Reset(); _aiBot = new AiBot(_map); _exitGhostHouse = _levelSetup.ExitGhostHouse; ResetGhostsAndPacMan(); _gameDraw.DrawMap(_map, false); _pillCount = 0; _powerPillAnimation.Reset(); _scoreAnimation.Reset(); _bonusFruit.SetLevel(_level); _ghostHouse.SetLevel(_level, Ghosts); _random = new Random(); }
public void SaveCharacterEndFightProgress(Map.Map map, Character character, List <uint> loots, double experienceEarned, int kamasEarned) { var client = map.GetClientFromCharacter(character); var inventory = character.Inventory; character.Experience += experienceEarned; character.Kamas += kamasEarned; foreach (var loot in loots) { var item = InventoryRepository.Instance.GenerateItemFromId((int)loot); if (item == null) { continue; } inventory.ObjectItems.Add(InventoryRepository.Instance.GenerateItemFromId((int)loot)); if (client == null) { continue; } client.SendPacket(new ObjectAddedMessage(item, 0)); client.SendPacket(new InventoryWeightMessage(0, 0, 1000)); } CharacterRepository.Instance.Update(character); InventoryRepository.Instance.Update(inventory); if (LevelManager.Instance.CheckLevelUpFromExperience <Character>(character)) //gerer l'exp TODO { //levelup character.OnLevelUp(); if (client != null) { client.SendPacket(new CharacterLevelUpMessage((uint)character.Level)); } } //exit de la map le joueur pour le faire actualiser la carte TODO if (client != null) { client.ActiveCharacter = character; } }
/// <summary> /// Sprawdzenie czy punkt jest dostepny ze wzgledu na poruszanie w danym kierunku /// </summary> /// <param name="map">Mapa obiektów</param> /// <param name="dir">Kierunek ruchu</param> /// <returns>Czy jest możliwość ruchu w danym kierunku</returns> private bool isPointAccesible(Map.Map map, int dir) { switch ((Game.direction)dir) { case Game.direction.down: if (y + 1 < map.getHeight() - 1) { if (map.getObject(x, y + 1).GetType() == typeof(NonDestroyableObjects.Puste)) { return(true); } } break; case Game.direction.left: if (x > 0) { if (map.getObject(x - 1, y).GetType() == typeof(NonDestroyableObjects.Puste)) { return(true); } } break; case Game.direction.right: if (x + 1 < map.getWidth() - 1) { if (map.getObject(x + 1, y).GetType() == typeof(NonDestroyableObjects.Puste)) { return(true); } } break; case Game.direction.up: if (y > 0) { if (map.getObject(x, y - 1).GetType() == typeof(NonDestroyableObjects.Puste)) { return(true); } } break; } return(false); }
private static bool CheckBlocksAbove(Block block, Map.Map map, int layer, Dictionary <int, List <IObstacle> > layerObstacles, Dictionary <Block, List <Vector2> > blockPointsDictionary) { List <Vector2> blockPoints; if (!blockPointsDictionary.TryGetValue(block, out blockPoints)) { blockPoints = GetBlockPoints(block, layer); blockPointsDictionary.Add(block, blockPoints); } for (var z = (int)block.Position.Z + 1; z < 8; z++) { if (map.GetBlock(new Vector3(block.Position.X, block.Position.Y, z)).Lid) { return(true); } var blockFilled = false; foreach (var layerObstacle in layerObstacles[z]) { var containAll = false; var polygonObstacle = layerObstacle as PolygonObstacle; if (polygonObstacle != null) { containAll = blockPoints.All(polygonObstacle.Contains); } var rectangleObstacle = layerObstacle as RectangleObstacle; if (rectangleObstacle != null) { containAll = blockPoints.All(rectangleObstacle.Contains); } if (!containAll) { continue; } //all points are within the polygon, block is ok blockFilled = true; break; } if (blockFilled) { return(true); } } return(false); }
protected void SendNPCCommand(string command) { Map.Map map = Map.MapManager.Instance.GetMap(NPC.MapInstanceID); foreach (Actor i in map.Actors.Values.ToList()) { if (i == NPC) { continue; } if (i.EventHandler.GetType().IsSubclassOf(typeof(NPCScriptHandler))) { ((NPCScriptHandler)i.EventHandler).OnReceiveNPCCommand(NPC, command); } } }
private void Frost_OnAdditionStart(Actor actor, Buff skill) { target.Status.Invincible = true; Map.Map map = Map.MapManager.Instance.GetMap(actor.MapInstanceID); target.Status.StanceFlag1.SetValue(StanceU1.Unknown10000000, true); target.Status.StanceFlag1.SetValue(StanceU1.NoMove, true); target.Status.StanceFlag1.SetValue(StanceU1.Unknown200, true); UpdateEvent evt = UpdateEvent.NewActorAdditionEvent(arg.Caster, (ActorExt)actor, arg.SkillSession, 4104, 12237012, UpdateEvent.ExtraUpdateModes.Activate); //evt.AddActorPara(SagaBNS.Common.Packets.GameServer.PacketParameter.Unk7A, target.Status.StanceFlag1.Value); //evt.AddActorPara(SagaBNS.Common.Packets.GameServer.PacketParameter.UnkE9, 1); map.SendEventToAllActorsWhoCanSeeActor(MapEvents.EVENT_BROADCAST, evt, actor, true); }
private static void DebugObstacles() { try { var map = new Map.Map(Globals.MapsSubDir + "\\MP1-comp.gmp", "bil"); //var map = new Map.Map(Globals.MapsSubDir + "\\bil.gmp"); var collision = new CollisionMap(map); var obstacles = collision.GetObstacles(); //obstacles.Save(map); //var newObstacles = ObstacleCollection.Load(map); DisplayCollision(obstacles); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.StackTrace); } }
public UserControler(HttpListenerContext Context, Models.UserModel Model, Map.Map World) { context = Context; model = Model; world = World; Cookie sessid = context.Request.Cookies["sessid"]; string sid = (sessid != null && !sessid.Expired) ? sessid.Value.ToString() : ""; //Console.WriteLine("Try to connect with {0} session.", sid); if (sid.Length == 0 || sid.Equals("0")) { sid = Guid.NewGuid().ToString(); } session = new Session(sid); if (!session.isEmpty() && !session.isValid()) { bool found = false; session.unset(); while (!found) { sid = Guid.NewGuid().ToString(); if (!File.Exists(Session.SAVE_PATH + sid + ".session")) { found = true; } } session = new Session(sid); } if (session.isEmpty()) { session.set("user", "Anonymous"); } //Console.WriteLine("Creating session {0}", sid); Cookie cookie = new Cookie("sessid", sid); cookie.Expires = session.getExpiration(); context.Response.Cookies.Add(cookie); }
public Server() { int width = 16; Server.connection = new MySqlConnection("Database=cubeworld;DataSource=localhost;UserId=root;Password=root"); world = new Map.Map(new Models.TilesModel(Server.connection, width), width, 4); Console.WriteLine("> Prepering map of total width = {0} tiles ...", world.getMapWidth()); listener.Prefixes.Add("http://*:40000/"); listener.Start(); Console.WriteLine("> Starting server ..."); while (true) { maxClientsAtOnce.WaitOne(); Accept(); } }
public override void Update(Microsoft.Xna.Framework.GameTime gameTime) { float dt = (float)gameTime.ElapsedGameTime.TotalMilliseconds / 10.0f; map.update(dt); if (player.Health <= 0) { Done = true; Screens.GameOver gameOverScreen = new Screens.GameOver(); screenManager.addScreen(gameOverScreen); } if (map.GoToNextFloor) { floor++; map = new Map.Map(screenManager, player, floor); map.loadContent(content); player.Position = map.CurrentRoom.PlayerPos; player.ParentRoom = map.CurrentRoom; } }
public override void LoadContent() { if (isInitialized) return; if (content == null) content = new ContentManager(screenManager.Game.Services, "Content"); player = new Player(screenManager); map = new Map.Map(screenManager, player, floor); map.loadContent(content); player.loadContent(content); player.Position = map.CurrentRoom.PlayerPos; player.ParentRoom = map.CurrentRoom; isInitialized = true; }
/// <summary> /// Load the selected map /// </summary> /// <param name="index">ID of selected map</param> public void loadMap(string name) { this.map = new Map.Map(mapFolder + name + "\\" + name + mapExtension); }
public CollisionMap(Map.Map map) { _map = map; }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LayoutForm)); this._toolStripContainer1 = new System.Windows.Forms.ToolStripContainer(); this._splitContainer1 = new System.Windows.Forms.SplitContainer(); this._layoutControl1 = new MapWindow.Layout.LayoutControl(); this._layoutDocToolStrip1 = new MapWindow.Layout.LayoutDocToolStrip(); this._layoutInsertToolStrip1 = new MapWindow.Layout.LayoutInsertToolStrip(); this._layoutListBox1 = new MapWindow.Layout.LayoutListBox(); this._layoutMapToolStrip1 = new MapWindow.Layout.LayoutMapToolStrip(); this._layoutMenuStrip1 = new MapWindow.Layout.LayoutMenuStrip(); this._layoutPropertyGrid1 = new MapWindow.Layout.LayoutPropertyGrid(); this._layoutZoomToolStrip1 = new MapWindow.Layout.LayoutZoomToolStrip(); this._splitContainer2 = new System.Windows.Forms.SplitContainer(); this._toolStripContainer1.ContentPanel.SuspendLayout(); this._toolStripContainer1.TopToolStripPanel.SuspendLayout(); this._toolStripContainer1.SuspendLayout(); this._splitContainer1.Panel1.SuspendLayout(); this._splitContainer1.Panel2.SuspendLayout(); this._splitContainer1.SuspendLayout(); this._splitContainer2.Panel1.SuspendLayout(); this._splitContainer2.Panel2.SuspendLayout(); this._splitContainer2.SuspendLayout(); this.SuspendLayout(); // // _toolStripContainer1 // this._toolStripContainer1.AccessibleDescription = null; this._toolStripContainer1.AccessibleName = null; resources.ApplyResources(this._toolStripContainer1, "_toolStripContainer1"); // // _toolStripContainer1.BottomToolStripPanel // this._toolStripContainer1.BottomToolStripPanel.AccessibleDescription = null; this._toolStripContainer1.BottomToolStripPanel.AccessibleName = null; this._toolStripContainer1.BottomToolStripPanel.BackgroundImage = null; resources.ApplyResources(this._toolStripContainer1.BottomToolStripPanel, "_toolStripContainer1.BottomToolStripPanel"); this._toolStripContainer1.BottomToolStripPanel.Font = null; // // _toolStripContainer1.ContentPanel // this._toolStripContainer1.ContentPanel.AccessibleDescription = null; this._toolStripContainer1.ContentPanel.AccessibleName = null; resources.ApplyResources(this._toolStripContainer1.ContentPanel, "_toolStripContainer1.ContentPanel"); this._toolStripContainer1.ContentPanel.BackgroundImage = null; this._toolStripContainer1.ContentPanel.Controls.Add(this._splitContainer1); this._toolStripContainer1.ContentPanel.Font = null; this._toolStripContainer1.Font = null; // // _toolStripContainer1.LeftToolStripPanel // this._toolStripContainer1.LeftToolStripPanel.AccessibleDescription = null; this._toolStripContainer1.LeftToolStripPanel.AccessibleName = null; this._toolStripContainer1.LeftToolStripPanel.BackgroundImage = null; resources.ApplyResources(this._toolStripContainer1.LeftToolStripPanel, "_toolStripContainer1.LeftToolStripPanel"); this._toolStripContainer1.LeftToolStripPanel.Font = null; this._toolStripContainer1.Name = "_toolStripContainer1"; // // _toolStripContainer1.RightToolStripPanel // this._toolStripContainer1.RightToolStripPanel.AccessibleDescription = null; this._toolStripContainer1.RightToolStripPanel.AccessibleName = null; this._toolStripContainer1.RightToolStripPanel.BackgroundImage = null; resources.ApplyResources(this._toolStripContainer1.RightToolStripPanel, "_toolStripContainer1.RightToolStripPanel"); this._toolStripContainer1.RightToolStripPanel.Font = null; // // _toolStripContainer1.TopToolStripPanel // this._toolStripContainer1.TopToolStripPanel.AccessibleDescription = null; this._toolStripContainer1.TopToolStripPanel.AccessibleName = null; this._toolStripContainer1.TopToolStripPanel.BackgroundImage = null; resources.ApplyResources(this._toolStripContainer1.TopToolStripPanel, "_toolStripContainer1.TopToolStripPanel"); this._toolStripContainer1.TopToolStripPanel.Controls.Add(this._layoutDocToolStrip1); this._toolStripContainer1.TopToolStripPanel.Controls.Add(this._layoutInsertToolStrip1); this._toolStripContainer1.TopToolStripPanel.Controls.Add(this._layoutZoomToolStrip1); this._toolStripContainer1.TopToolStripPanel.Controls.Add(this._layoutMapToolStrip1); this._toolStripContainer1.TopToolStripPanel.Font = null; // // _splitContainer1 // this._splitContainer1.AccessibleDescription = null; this._splitContainer1.AccessibleName = null; resources.ApplyResources(this._splitContainer1, "_splitContainer1"); this._splitContainer1.BackgroundImage = null; this._splitContainer1.Font = null; this._splitContainer1.Name = "_splitContainer1"; // // _splitContainer1.Panel1 // this._splitContainer1.Panel1.AccessibleDescription = null; this._splitContainer1.Panel1.AccessibleName = null; resources.ApplyResources(this._splitContainer1.Panel1, "_splitContainer1.Panel1"); this._splitContainer1.Panel1.BackgroundImage = null; this._splitContainer1.Panel1.Controls.Add(this._layoutControl1); this._splitContainer1.Panel1.Font = null; // // _splitContainer1.Panel2 // this._splitContainer1.Panel2.AccessibleDescription = null; this._splitContainer1.Panel2.AccessibleName = null; resources.ApplyResources(this._splitContainer1.Panel2, "_splitContainer1.Panel2"); this._splitContainer1.Panel2.BackgroundImage = null; this._splitContainer1.Panel2.Controls.Add(this._splitContainer2); this._splitContainer1.Panel2.Font = null; // // _layoutControl1 // this._layoutControl1.AccessibleDescription = null; this._layoutControl1.AccessibleName = null; resources.ApplyResources(this._layoutControl1, "_layoutControl1"); this._layoutControl1.BackgroundImage = null; this._layoutControl1.Cursor = System.Windows.Forms.Cursors.Default; this._layoutControl1.DrawingQuality = System.Drawing.Drawing2D.SmoothingMode.HighQuality; this._layoutControl1.Filename = ""; this._layoutControl1.Font = null; this._layoutControl1.LayoutDocToolStrip = this._layoutDocToolStrip1; this._layoutControl1.LayoutInsertToolStrip = this._layoutInsertToolStrip1; this._layoutControl1.LayoutListBox = this._layoutListBox1; this._layoutControl1.LayoutMapToolStrip = this._layoutMapToolStrip1; this._layoutControl1.LayoutMenuStrip = this._layoutMenuStrip1; this._layoutControl1.LayoutPropertyGrip = this._layoutPropertyGrid1; this._layoutControl1.LayoutZoomToolStrip = this._layoutZoomToolStrip1; this._layoutControl1.MapControl = null; this._layoutControl1.MapPanMode = false; this._layoutControl1.Name = "_layoutControl1"; this._layoutControl1.PrinterSettings = ((System.Drawing.Printing.PrinterSettings)(resources.GetObject("_layoutControl1.PrinterSettings"))); this._layoutControl1.ShowMargin = false; this._layoutControl1.Zoom = 0.3541667F; this._layoutControl1.FilenameChanged += new System.EventHandler(this.layoutControl1_FilenameChanged); // // _layoutDocToolStrip1 // this._layoutDocToolStrip1.AccessibleDescription = null; this._layoutDocToolStrip1.AccessibleName = null; resources.ApplyResources(this._layoutDocToolStrip1, "_layoutDocToolStrip1"); this._layoutDocToolStrip1.BackgroundImage = null; this._layoutDocToolStrip1.Font = null; this._layoutDocToolStrip1.LayoutControl = this._layoutControl1; this._layoutDocToolStrip1.Name = "_layoutDocToolStrip1"; // // _layoutInsertToolStrip1 // this._layoutInsertToolStrip1.AccessibleDescription = null; this._layoutInsertToolStrip1.AccessibleName = null; resources.ApplyResources(this._layoutInsertToolStrip1, "_layoutInsertToolStrip1"); this._layoutInsertToolStrip1.BackgroundImage = null; this._layoutInsertToolStrip1.Font = null; this._layoutInsertToolStrip1.LayoutControl = this._layoutControl1; this._layoutInsertToolStrip1.Name = "_layoutInsertToolStrip1"; // // _layoutListBox1 // this._layoutListBox1.AccessibleDescription = null; this._layoutListBox1.AccessibleName = null; resources.ApplyResources(this._layoutListBox1, "_layoutListBox1"); this._layoutListBox1.BackgroundImage = null; this._layoutListBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this._layoutListBox1.Font = null; this._layoutListBox1.LayoutControl = this._layoutControl1; this._layoutListBox1.Name = "_layoutListBox1"; // // _layoutMapToolStrip1 // this._layoutMapToolStrip1.AccessibleDescription = null; this._layoutMapToolStrip1.AccessibleName = null; resources.ApplyResources(this._layoutMapToolStrip1, "_layoutMapToolStrip1"); this._layoutMapToolStrip1.BackgroundImage = null; this._layoutMapToolStrip1.Font = null; this._layoutMapToolStrip1.LayoutControl = this._layoutControl1; this._layoutMapToolStrip1.Name = "_layoutMapToolStrip1"; // // _layoutMenuStrip1 // this._layoutMenuStrip1.AccessibleDescription = null; this._layoutMenuStrip1.AccessibleName = null; resources.ApplyResources(this._layoutMenuStrip1, "_layoutMenuStrip1"); this._layoutMenuStrip1.BackgroundImage = null; this._layoutMenuStrip1.Font = null; this._layoutMenuStrip1.LayoutControl = this._layoutControl1; this._layoutMenuStrip1.Name = "_layoutMenuStrip1"; this._layoutMenuStrip1.CloseClicked += new System.EventHandler(this.layoutMenuStrip1_CloseClicked); // // _layoutPropertyGrid1 // this._layoutPropertyGrid1.AccessibleDescription = null; this._layoutPropertyGrid1.AccessibleName = null; resources.ApplyResources(this._layoutPropertyGrid1, "_layoutPropertyGrid1"); this._layoutPropertyGrid1.BackgroundImage = null; this._layoutPropertyGrid1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this._layoutPropertyGrid1.Font = null; this._layoutPropertyGrid1.LayoutControl = this._layoutControl1; this._layoutPropertyGrid1.Name = "_layoutPropertyGrid1"; // // _layoutZoomToolStrip1 // this._layoutZoomToolStrip1.AccessibleDescription = null; this._layoutZoomToolStrip1.AccessibleName = null; resources.ApplyResources(this._layoutZoomToolStrip1, "_layoutZoomToolStrip1"); this._layoutZoomToolStrip1.BackgroundImage = null; this._layoutZoomToolStrip1.Font = null; this._layoutZoomToolStrip1.LayoutControl = this._layoutControl1; this._layoutZoomToolStrip1.Name = "_layoutZoomToolStrip1"; // // _splitContainer2 // this._splitContainer2.AccessibleDescription = null; this._splitContainer2.AccessibleName = null; resources.ApplyResources(this._splitContainer2, "_splitContainer2"); this._splitContainer2.BackgroundImage = null; this._splitContainer2.Font = null; this._splitContainer2.Name = "_splitContainer2"; // // _splitContainer2.Panel1 // this._splitContainer2.Panel1.AccessibleDescription = null; this._splitContainer2.Panel1.AccessibleName = null; resources.ApplyResources(this._splitContainer2.Panel1, "_splitContainer2.Panel1"); this._splitContainer2.Panel1.BackgroundImage = null; this._splitContainer2.Panel1.Controls.Add(this._layoutListBox1); this._splitContainer2.Panel1.Font = null; // // _splitContainer2.Panel2 // this._splitContainer2.Panel2.AccessibleDescription = null; this._splitContainer2.Panel2.AccessibleName = null; resources.ApplyResources(this._splitContainer2.Panel2, "_splitContainer2.Panel2"); this._splitContainer2.Panel2.BackgroundImage = null; this._splitContainer2.Panel2.Controls.Add(this._layoutPropertyGrid1); this._splitContainer2.Panel2.Font = null; // // LayoutForm // this.AccessibleDescription = null; this.AccessibleName = null; resources.ApplyResources(this, "$this"); this.BackgroundImage = null; this.Controls.Add(this._toolStripContainer1); this.Controls.Add(this._layoutMenuStrip1); this.Font = null; this.ForeColor = System.Drawing.Color.Coral; this.Name = "LayoutForm"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.LayoutForm_FormClosing); this._toolStripContainer1.ContentPanel.ResumeLayout(false); this._toolStripContainer1.TopToolStripPanel.ResumeLayout(false); this._toolStripContainer1.TopToolStripPanel.PerformLayout(); this._toolStripContainer1.ResumeLayout(false); this._toolStripContainer1.PerformLayout(); this._splitContainer1.Panel1.ResumeLayout(false); this._splitContainer1.Panel2.ResumeLayout(false); this._splitContainer1.ResumeLayout(false); this._splitContainer2.Panel1.ResumeLayout(false); this._splitContainer2.Panel2.ResumeLayout(false); this._splitContainer2.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); }
public static void Main(string[] args) { //Inicjalizacja okna window = new RenderWindow(new VideoMode(1280, 720, 32), "Praca inzynierska", Styles.Close); window.Closed += (o, e) => window.Close(); window.KeyPressed += (o, e) => { if ( e.Code == Keyboard.Key.Escape ) { window.Close(); } }; origWindowSize = window.Size; DisplayTitle(); WriteLine("Title displayed!"); //inicjalizacja mapy WriteLine("Start map creating!"); const int mapSize = 50; map = new Map.Map(mapSize, new MapSeed((int)(mapSize / 5.0), (int)(mapSize / 10.0), (int)(mapSize / 15.0))); window.MouseMoved += map.Map_MouseMoved; window.MouseWheelScrolled += map.Map_MouseWheelScrolled; WriteLine("Map created!"); WriteLine("Start creating GUI!"); //Tworzenie GUI gui = new GUI() { new Button { Name = "Close Button", IsActive = true, ButtonTexture = new Sprite(NormalButtonTexture), ButtonText = new Text("Zamknij!", font) { CharacterSize = 20, Color = Color.Black }, Position = new Vector2f(20, window.Size.Y - 60), MouseButtonPressedHandler = (s, e) => { if ( Mouse.IsButtonPressed(Mouse.Button.Left) ) window.Close(); } }, new BuildButton() { Name = "Build Button", IsActive = true, ButtonTexture = new Sprite(NormalButtonTexture), ButtonText = new Text("Buduj", font) { CharacterSize = 20, Color = Color.Black }, Position = new Vector2f(20, window.Size.Y - 120) } }; window.KeyPressed += gui.Window_KeyPressed; window.KeyReleased += gui.Window_KeyReleased; window.MouseButtonPressed += gui.Window_MouseButtonPressed; window.MouseButtonReleased += gui.Window_MouseButtonReleased; window.MouseMoved += gui.Window_MouseMoved; window.MouseWheelScrolled += gui.Window_MouseWheelScrolled; WriteLine("GUI created!"); WriteLine("Start creating colony!"); Colony colony = new Colony(map, window); map.UpdateTime += colony.UpdateTime; colony.AddColonist(new Men() { Name = "Adam", MoveSpeed = 5, Location = map[10, 20], TextureSelected = new Sprite(MenTextureSelected), TextureNotSelected = new Sprite(MenTexture), IsSelected = false, HP = new FuzzyHP(50f) { MaxHP = 50f }, Strength = 5f, Mining = 3f, Constructing = 4f, Accuracy = 4.5f, }); colony.AddConstruct(new Construct(2, 3, map[3, 3], Color.Magenta) { MaxConstructPoints = 200 }); WriteLine("Colony created!"); /*WriteLine("Start creating path!"); WriteLine("Searching for start and end point!"); //tymczasowe sprawdzenie wyznaczanie sciezki IList<MapField> path; MapField start = null, stop = null; //Wyszukanie pierwszego dostepnego pola foreach ( MapField field in map.Where(field => field.IsAvaliable) ) { start = field; break; } //wyszukanie ostatniego dostepnego pola foreach ( MapField field in map.Reverse().Where(field => field.IsAvaliable) ) { stop = field; break; } WriteLine("Sstart and end point found!"); try { //próba wyznaczenia sciezki miedzy wyznaczonymi polami path = PathFinding.AStar(start, stop, PathFinding.Metric.EuclideanDistance); } catch ( FieldNotAvaliableException ) { WriteLine($"Texture [{start.MapPosition.X}, {start.MapPosition.Y}] is avaliable = {start.IsAvaliable}"); WriteLine($"Texture [{stop.MapPosition.X}, {stop.MapPosition.Y}] is avaliable = {stop.IsAvaliable}"); WriteLine("But path between this field dose not exists!"); path = null; } WriteLine("Path created!");*/ WriteLine("Start creating herd!"); MapField mapField; int center = map.Size / 2; do { int x = rand.Next(center - center / 2, center + center / 2); int y = rand.Next(center - center / 2, center + center / 2); mapField = map[x, y]; } while ( !mapField.IsAvaliable ); WriteLine($"Start from - {mapField}"); Herd herd = new Herd(mapField, 5); map.UpdateTime += herd.UpdateTime; foreach ( Animal animal in herd ) { map.UpdateTime += animal.UpdateTime; } WriteLine("Herd created!"); time.Start(); //Główna petla gry while ( window.IsOpen ) { window.DispatchEvents(); window.Clear(); time.Stop(); map.Update(time.Elapsed); time.Restart(); window.Draw(map); /*if ( path != null ) { foreach ( Sprite val in path.Select(field => new Sprite(SelectedTexture) { Position = field.ScreenPosition }) ) { window.Draw(val); } }*/ window.Draw(colony); window.Draw(herd); //window.Draw(an); window.Draw(gui); window.Display(); } }
/// <summary> /// Constructor /// </summary> public LayoutMap(Map.Map mapControl) { Name = "Map"; _mapControl = mapControl; _envelope = _mapControl.Extents; ResizeStyle = ResizeStyle.NoScaling; }
public Path(Map.Map _map) { map = _map; nodes = new PathNode[map.Width * map.Height]; }
///<summary> ///constructor with map file parameter ///</summary> ///<param name="filename"></param> public GameManager(string filename) { Assert.Fatal(null == _instance, "Singleton already created."); _instance = this; _selectedBot = null; MyGame.Instance.GamePaused = false; RemoveABot = false; _map = null; _pathManager = null; _botList = new List<BotEntity>(); _projectiles = new List<Projectile>(); _graveMarkerList = new List<GraveMarker>(); _minimapComponentList = new List<MinimapComponent>(); ////4 upper right minimaps // _minimapComponentList.Add(CreateMinimapComponent( // new Vector2(0, 0), // new Vector2(32.0f, 32.0f), // new Vector2(64.0f, 0.0f), // new Vector2(128.0f, 128.0f), // true)); // _minimapComponentList.Add(CreateMinimapComponent( // new Vector2(0, 0), // new Vector2(64.0f, 64.0f), // new Vector2(768.0f, 0.0f), // new Vector2(256.0f, 256.0f), // true // )); //_minimapComponentList.Add(CreateMinimapComponent( // new Vector2(0, 0), // new Vector2(64.0f, 64.0f), // new Vector2(512.0f, 256.0f), // new Vector2(256.0f, 256.0f), // true // )); //_minimapComponentList.Add(CreateMinimapComponent( // new Vector2(0, 0), // new Vector2(64.0f, 64.0f), // new Vector2(768.0f, 256.0f), // new Vector2(256.0f, 256.0f), // true // )); ////4 lower left minimaps //_minimapComponentList.Add(CreateMinimapComponent( // new Vector2(0, 0), // new Vector2(64.0f, 64.0f), // new Vector2(0.0f, 512.0f), // new Vector2(256.0f, 256.0f), // true)); //_minimapComponentList.Add(CreateMinimapComponent( // new Vector2(0, 0), // new Vector2(64.0f, 64.0f), // new Vector2(256.0f, 512.0f), // new Vector2(256.0f, 256.0f), // true // )); //_minimapComponentList.Add(CreateMinimapComponent( // new Vector2(0, 0), // new Vector2(64.0f, 64.0f), // new Vector2(0.0f, 768.0f), // new Vector2(256.0f, 256.0f), // true // )); //_minimapComponentList.Add(CreateMinimapComponent( // new Vector2(0, 0), // new Vector2(64.0f, 64.0f), // new Vector2(256.0f, 768.0f), // new Vector2(256.0f, 256.0f), // true // )); try { Options = MyGame.Instance.Content.Load<OptionsData>(@"data\maps\Options"); } catch (Exception e) { Assert.Fatal(false, "GameManager.GameManager: Bad options filename -> " + e.Message); MyGame.Instance.Exit(); } try { Parameters = MyGame.Instance.Content.Load<ParameterData>(@"data\maps\Parameters"); } catch (Exception e) { Assert.Fatal(false, "GameManager.GameManager: Bad parameters filename -> " + e.Message); MyGame.Instance.Exit(); } //load in the map LoadMap(filename); int keyboardId = InputManager.Instance.FindDevice("keyboard"); int gamepad = InputManager.Instance.FindDevice("gamepad0"); InputMap map = PlayerManager.Instance.GetPlayer(0).InputMap; if (keyboardId > 0) { map.BindAction( keyboardId, (int) Keys.Space, selectNextBot); map.BindAction( keyboardId, (int) Keys.X, killBot); } if (gamepad > 0) { map.BindAction( gamepad, (int) XGamePadDevice.GamePadObjects.X, selectNextBot); map.BindAction( gamepad, (int)XGamePadDevice.GamePadObjects.Y, killBot); } if (Parameters.PlayCaptureTheFlag) _map.AddFlagsToMap(); }
///<summary> ///sets up the game environment from map file ///</summary> ///<param name="filename"></param> ///<returns></returns> public bool LoadMap(string filename) { //clear any current bots and projectiles Clear(); _map = new Map.Map(); //make sure the entity manager is reset EntityManager.Instance.Reset(); //load the new map data if (_map.LoadMap(filename, out _mapData)) { _pathManager = new PathManager( Parameters.MaxSearchCyclesPerUpdateStep); AddBots(Parameters.NumBots); return true; } return false; }
public void SetMap(Map.Map Map) { this._map = Map; }