public IActionResult Index() { Map <Hex> map = _mapFactory.CreateMap(MapShape.Circle, 5); HomeModel model = new HomeModel() { Hexes = map.Hexes }; return(View(model)); }
protected PacketHandlingTests() { var clientMock = new Mock <Client>(); Moonlight = new MoonlightAPI(new AppConfig { Database = "../../database.db" }); SkillFactory = Moonlight.Services.GetService <ISkillFactory>(); EntityFactory = Moonlight.Services.GetService <IEntityFactory>(); MapFactory = Moonlight.Services.GetService <IMapFactory>(); IPacketHandlerManager _packetHandlerManager = Moonlight.Services.GetService <IPacketHandlerManager>(); clientMock.Setup(x => x.SendPacket(It.IsAny <string>())).Callback <string>(x => _packetHandlerManager.Handle(clientMock.Object, x)); clientMock.Setup(x => x.ReceivePacket(It.IsAny <string>())).Callback <string>(x => _packetHandlerManager.Handle(clientMock.Object, x)); Client = clientMock.Object; Client.Character = Character = new Character(new SerilogLogger(), 999, "Moonlight", Client); Map map = MapFactory.CreateMap(1); map.AddEntity(Client.Character); }
private void Update() { if (Input.GetMouseButtonDown(0)) { MapProperties mapProperties = mapPropertiesFactory.CreateMapProperties(width, height, seed, useRandomSeed, randomFillPercent, smoothingIterationCount, squareSize); map = mapFactory.CreateMap(mapProperties); ProcessMap(map, wallThreshold, roomThreshold); // todo move to map factory int[,] borderedMap = new int[width + borderSize * 2, height + borderSize * 2]; for (int i = 0; i < borderedMap.GetLength(0); i++) { for (int j = 0; j < borderedMap.GetLength(1); j++) { if (i >= borderSize && i < width + borderSize && j >= borderSize && j < height + borderSize) { borderedMap[i, j] = map[i - borderSize, j - borderSize]; } else { borderedMap[i, j] = 1; } } } MeshGenerator meshGenerator = GetComponent <MeshGenerator>(); meshGenerator.GenerateMesh(borderedMap, squareSize); } }
public UnitsManagerTests() { um = new GameUnitsManager(); mf = new MapFactory <Hex>(); map = mf.CreateMap(MapShape.Circle, 3); pm = new GamePlayersManager(new GameTeamsFactory()); p = new Player(playerId); pm.AddTeam(p); }
public void GetMinYSuccess(int radius, int minY) { //Arrange MapFactory <Hex> mf = new MapFactory <Hex>(); //Act Map <Hex> map = mf.CreateMap(MapShape.Circle, radius); //Assert Assert.Equal(minY, map.GetMaxY()); }
public void CreateMapSuccess(int radius, int hexesCount) { //Arrange MapFactory <Hex> mf = new MapFactory <Hex>(); //Act Map <Hex> map = mf.CreateMap(MapShape.Circle, radius); //Assert Assert.Equal(hexesCount, map.GetHexesCount()); }
public void GetMapCenterOffsetSuccess(int radius, int X, int Y) { //Arrange MapFactory <Hex> mf = new MapFactory <Hex>(); //Act Map <Hex> map = mf.CreateMap(MapShape.Circle, radius); Coords res = map.GetMapCenterOffset(); //Assert Assert.Equal(X, res.X); Assert.Equal(Y, res.Y); }
public void ToJsonSuccess() { //Arrange GameUnitsManager um = new GameUnitsManager(); MapFactory <Hex> mf = new MapFactory <Hex>(); Map <Hex> map = mf.CreateMap(MapShape.Circle, 3); //Act JObject obj = map.ToJson(um); string str = obj.ToString(); Assert.Equal(1, 1); }
protected override async void OnClick() { CreateMapDialog mapDialog = new CreateMapDialog(); if (mapDialog.ShowDialog() ?? false) { var mapName = mapDialog.MapName; var map = await QueuedTask.Run(() => MapFactory.CreateMap(mapName, ArcGIS.Core.CIM.MapType.Map, ArcGIS.Core.CIM.MapViewingMode.Map, Basemap.Topographic)); Task t = ProApp.Panes.CreateMapPaneAsync(map); } }
public Character(string id, string name) { this.Name = name; this.Map = MapFactory.CreateMap(); this.Gold = 5; this.Level = 1; this.UserId = id; this.XCoord = 10; this.YCoord = 16; this.CurrentHp = 12; this.MaxHp = 12; this.Strength = 3; this.Speed = 1; this.Inventory = new List <Item>(); this.Inventory.Add(new HealingPotion()); }
public bool InitializeMap() { try { var northtownStops = new List <ITransitStop> { new TransitStop(-93.264399, 45.126965) }; ITransitHub northtown = new TransitCenter(-93.264399, 45.126965, northtownStops); Map = mapFactory.CreateMap(northtown); return(true); } catch { return(false); } }
protected override void Process(GameSession session, At packet) { Character character = session.Character; Map source = character.Map; Map destination = mapFactory.CreateMap(packet.MapId); character.Map = destination; character.Map.Players[character.Id] = character; // character.Position = packet.Position; eventPipeline.Process(session, new MapChangeEvent { Source = source, Destination = destination }); Log.Information($"Successfully joined map with ID {destination.Id}"); }
public World() { _creatures = new List <ICreature>(); _containers = new List <IContainer>(); _doors = new List <Door>(); _quests = new List <IQuest>(); _fire = new List <Fire>(); _remains = new List <IRemains>(); _specialEffects = new List <ISpecialEffect>(); _level = 1; MapFactory.CreateMap(this); Player = new PlayerCharacter(new Vector2(47, 25), this); CenterCameraOnPlayer(); DiscoverTerrainAroundPlayer(); TEST_addStuffToWorld(); }
private void Start() { MapStateMachine.CreateInstance(); MapFactory.CreateMap(6, 6); PlayerMapController.CreateInstance(); GameObject playerPrefab = Resources.Load <GameObject>("Prefabs/Player"); PlayerPawn player = Instantiate <GameObject>(playerPrefab).GetComponent <PlayerPawn>(); player.SetPosition(new Position(1, 1)); player.Initialize(); GameObject enemyPrefab = Resources.Load <GameObject>("Prefabs/Enemy"); EnemyPawn enemy = Instantiate <GameObject>(enemyPrefab).GetComponent <EnemyPawn>(); enemy.SetPosition(new Position(3, 4)); enemy.Initialize(); Destroy(gameObject); }
private void GenerateMap() { var mapGenerator = new ParticleDeposition { DropPoints = DropPoints, MaxParticles = MaxParticles, MinParticles = MinParticles, ParticleStabilityRadius = ParticleStabilityRadius, PassesCount = PassesCount }; var mapFactory = new MapFactory(mapGenerator) { DesertBelt = DesertBelt, FilterCount = FilterCount, MinHillsValue = MinHillsValue, MinMountainsValue = MinMountainsValue, PoleBelt = PoleBelt }; _terrainMap = mapFactory.CreateMap(_hexGrid.Width, _hexGrid.Height); CreateMap(); }