public IActionResult AddPlease(Coast Coast) { db.Coast.Add(Coast); db.SaveChanges(); return(RedirectToAction("Add")); }
public void loadResources() { LeftCoast = new Coast(-1); RightCoast = new Coast(1); boat = new Boat(); water = new Water(); for (int i = 0; i < 3; i++) { Debug.Log("ok"); Character newCharacter = new Character(0); newCharacter.setName("priest" + i); newCharacter.setPosition(RightCoast.getEmptyPosition()); newCharacter.getOnCoast(RightCoast); RightCoast.getOnCoast(newCharacter); characters[i] = newCharacter; } for (int i = 0; i < 3; i++) { Character newCharacter = new Character(1); newCharacter.setName("devil" + i); newCharacter.setPosition(RightCoast.getEmptyPosition()); newCharacter.getOnCoast(RightCoast); RightCoast.getOnCoast(newCharacter); characters[i + 3] = newCharacter; } }
public IActionResult ChangeAdd(Coast Coast) { db.Coast.Add(Coast); db.SaveChanges(); return(RedirectToAction("Index")); }
public void reset() { Cmove.reset(); coast = (Director.getInstance().currentSceneController as main).RightCoast; getOnCoast(coast); setPosition(coast.getEmptyPosition()); coast.getOnCoast(this); }
/// <summary> /// Generated by visual studio /// </summary> /// <returns> /// Elements Hash Code /// </returns> public override int GetHashCode() { var hashCode = 632013715; hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Name); hashCode = hashCode * -1521134295 + Coast.GetHashCode(); hashCode = hashCode * -1521134295 + Id.GetHashCode(); return(hashCode); }
public void LoadResources() { GameObject water = Instantiate(Resources.Load("Prefabs/Water", typeof(GameObject)), water_pos, Quaternion.identity, null) as GameObject; water.name = "water"; boat = new Boat(); fromCoast = new Coast("start"); toCoast = new Coast("end"); loadCharacter(); }
public void LoadResources() { Debug.Log("load resources"); current_coast = 0; water_surface = Instantiate(Resources.Load("water_surface"), new Vector3(-100, 0, -100), Quaternion.identity) as GameObject; coasts = new Coast[2]; coasts [0] = new Coast(new Vector3(-6, 0, 0), 0); coasts [1] = new Coast(new Vector3(6, 0, 0), 1); boat = new Boat(); characters = new Character[6]; for (int i = 0; i < 6; i++) { characters [i] = new Character(i % 2, i); coasts [i % 2].getOnCoast(characters [i]); } }
public void ClickCharacter(Character input) { if (input.characterStatus == 1)//0在岸上,1在船上 { Coast coast; Debug.Log(boat.BoatPosStatus); if (boat.BoatPosStatus == -1) { coast = LeftCoast; } else { coast = RightCoast; } boat.GetOffBoat(input.getName()); Debug.Log(coast.getEmptyPosition()); input.moveToPosition(coast.getEmptyPosition()); input.getOnCoast(coast); coast.getOnCoast(input); } else { Coast coast = input.getCoast(); if (boat.getEmptyIndex() == -1) { return; } //Debug.Log(coast.TypeOfCoast); //Debug.Log(boat.BoatPosStatus); //Debug.Log(coast.TypeOfCoast); //Debug.Log(boat.BoatPosStatus); if (coast.TypeOfCoast != boat.BoatPosStatus) { return; } //Debug.Log("ClickCharacter"); coast.getOffCoast(input.getName()); //Debug.Log(boat.getEmptyPosition()); input.moveToPosition(boat.getEmptyPosition()); input.getOnBoat(boat); boat.GetOnBoat(input); } Debug.Log(gameStatus()); simplegui.status = gameStatus(); }
public void LoadResources() { //water = new Water(Instantiate(Resources.Load("Prefabs/Water")) as GameObject); //water.SetPosition(new Vector3(0, 0.2f, 0)); //water.SetScale(new Vector3(5.6f, 0.4f, 1)); //water.Init(); coastL = new Coast(Instantiate(Resources.Load("Prefabs/Coast")) as GameObject, "left"); coastL.SetPosition(new Vector3(-4.7f, 0.5f, 0)); coastL.SetScale(new Vector3(3.8f, 1, 1)); coastL.Init(false); coastR = new Coast(Instantiate(Resources.Load("Prefabs/Coast")) as GameObject, "right"); coastR.SetPosition(new Vector3(4.7f, 0.5f, 0)); coastR.SetScale(new Vector3(3.8f, 1, 1)); coastR.Init(false); boat = new Boat(Instantiate(Resources.Load("Prefabs/Boat")) as GameObject, "boat"); boat.gameObject.AddComponent(typeof(ClickGUI)); boat.SetPosition(new Vector3(2.1f, 0.55f, 0)); boat.SetScale(new Vector3(1.4f, 0.3f, 1)); boat.Init(); for (int i = 0; i < 3; ++i) { preists[i] = new Character(Instantiate(Resources.Load("Prefabs/Preist")) as GameObject, "preist"); ClickGUI clickGUI = preists[i].gameObject.AddComponent(typeof(ClickGUI)) as ClickGUI; clickGUI.character = preists[i]; preists[i].clickGUI = clickGUI; preists[i].clickGUI.character = preists[i]; preists[i].SetPosition(coastR.GetEmptyPosition()); preists[i].SetScale(new Vector3(0.4f, 0.4f, 0.4f)); } for (int i = 0; i < 3; ++i) { devils[i] = new Character(Instantiate(Resources.Load("Prefabs/Devil")) as GameObject, "devil"); ClickGUI clickGUI = devils[i].gameObject.AddComponent(typeof(ClickGUI)) as ClickGUI; clickGUI.character = preists[i]; devils[i].clickGUI = clickGUI; devils[i].clickGUI.character = devils[i]; devils[i].SetPosition(coastR.GetEmptyPosition()); devils[i].SetScale(new Vector3(0.4f, 0.4f, 0.4f)); } }
public void OnClickedCharacter(Character characterController) { if (ifGameover) { return; } if (characterController.isOnBoat()) { Coast whichCoast; if (boat.getToOrFrom() == -1) { whichCoast = toCoast; } else { whichCoast = fromCoast; } boat.GetOffBoat(characterController.getName()); actionManager.moveCharacter(characterController.getGameObject(), whichCoast.getEmptyPosition()); characterController.getOnCoast(whichCoast); whichCoast.getOnCoast(characterController); } else { Coast whichCoast = characterController.getCoastController(); if (boat.getEmptyIndex() == -1) { return; //boat is full; } if (whichCoast.getStartOrEnd() != boat.getToOrFrom()) { return; //不在同一侧 } whichCoast.getOffCoast(characterController.getName()); actionManager.moveCharacter(characterController.getGameObject(), boat.getEmptyPosition()); //characterController.moveToPosition(); characterController.getOnBoat(boat); boat.GetOnBoat(characterController); } userGUI.status = checkGameOver(); ifGameover = userGUI.status != 0 ? true : false; }
public static GameObject GenerateChunk(int chunkX, int chunkY, int chunkSize) { var map = new float[chunkSize, chunkSize]; // ContinentalShelf.GenerateShelf(ref map, chunkX, chunkY); Coast.GenerateCoast(ref map, chunkX, chunkY); Transformation2D.Translate(ref map, 1f); Transformation2D.Scale(ref map, 0.5f); var terrainData = new TerrainData(); terrainData.SetHeights(0, 0, map); terrainData.size = new Vector3(chunkSize, 300f, chunkSize); var chunk = Terrain.CreateTerrainGameObject(terrainData); chunk.transform.position = new Vector3(chunkX * (chunkSize - 1), 0, chunkY * (chunkSize - 1)); chunk.GetComponent <Terrain>().Flush(); return(chunk); }
public void reset() { EditorSceneManager.LoadScene(0); Coast.reset(); BoatController.reset(); }
public static Token ToOrderFormat(Coast coast) { switch( coast ) { case Coast.NoCoast: return null; case Coast.North: return Token.NCS; case Coast.Northeast: return Token.NEC; case Coast.East: return Token.ECS; case Coast.Southeast: return Token.SEC; case Coast.South: return Token.SCS; case Coast.Southwest: return Token.SWS; case Coast.West: return Token.WCS; case Coast.Northwest: return Token.NWC; default: Trace.WriteLineIf(mySwitch.Enabled, string.Format(CultureInfo.InvariantCulture, ErrorMessages.Util_UnknownCoast), traceCategory); Debug.Assert(false); return null; } }
public void getOnCoast(Coast input) { character.transform.parent = null; characterStatus = 0; coast = input; }
/// <summary>Gets the <see cref="Location"/> in the <see cref="Province"/>. /// </summary> /// <param name="unitType">Unit type.</param> /// <param name="coast">Coast.</param> /// <returns><c>null</c> if the <see cref="Location"/> doesn't exist.</returns> public Location GetLocation(UnitType unitType, Coast coast) { Location loc = new Location(this, unitType, coast); if (!locations.Contains(loc)) { return null; } else { return locations[locations.IndexOf(loc)]; } }
private void GenerateRectangleIsland(Rectangle island) { var random = new Random(); int distance = 1; var tiles = _world.GetTilesInRectangle(island); foreach (var tile in tiles) { // if (tile.Y > _world.Height - 5) { var winter = new Tundra(tile.X, tile.Y, tile.Cell); _world.SetTileProperty(winter, tile.X, tile.Y, true, true, false); } else if (tile.Y > _world.Height - 10) { var desert = new Dessert(tile.X, tile.Y, tile.Cell); _world.SetTileProperty(desert, tile.X, tile.Y, true, true, false); } else if (tile.Y < 5) { var winter = new Tundra(tile.X, tile.Y, tile.Cell); _world.SetTileProperty(winter, tile.X, tile.Y, true, true, false); } else if (tile.Y < 10) { var desert = new Dessert(tile.X, tile.Y, tile.Cell); _world.SetTileProperty(desert, tile.X, tile.Y, true, true, false); } else { var tileType = random.Next(0, 99); if (tileType < 30) { var plains = new Plains(tile.X, tile.Y, tile.Cell); _world.SetTileProperty(plains, tile.X, tile.Y, true, true, false); } else if (tileType < 50) { var Forest = new Plains(tile.X, tile.Y, tile.Cell); _world.SetTileProperty(Forest, tile.X, tile.Y, true, true, false); } else if (tileType < 65) { var hill = new Hills(tile.X, tile.Y, tile.Cell); _world.SetTileProperty(hill, tile.X, tile.Y, true, true, false); } else if (tileType < 75) { var mountain = new Mountain(tile.X, tile.Y, tile.Cell); _world.SetTileProperty(mountain, tile.X, tile.Y, true, true, false); } else if (tileType < 90) { var marsh = new Marsh(tile.X, tile.Y, tile.Cell); _world.SetTileProperty(marsh, tile.X, tile.Y, true, true, false); } else { var plain = new Plains(tile.X, tile.Y, tile.Cell); _world.SetTileProperty(plain, tile.X, tile.Y, true, true, false); } } } var beachTiles = _world.GetTilesAlongLine(island.Left - distance, island.Top - distance, island.Right, island.Top - distance).ToList(); beachTiles. AddRange(_world.GetTilesAlongLine(island.Left - distance, island.Bottom, island.Right, island.Bottom)); beachTiles. AddRange(_world.GetTilesAlongLine(island.Left - distance, island.Top - distance, island.Left - distance, island.Bottom)); beachTiles. AddRange(_world.GetTilesAlongLine(island.Right, island.Top - distance, island.Right, island.Bottom)); foreach (var t in beachTiles) { var coast = new Coast(t.X, t.Y, t.Cell); _world.SetTileProperty(coast, t.X, t.Y, true, true, false); } }
/// <summary>Creates a new <see cref="Location"/> instance. /// </summary> /// <param name="province">Province.</param> /// <param name="unitType">Unit type.</param> public Location(Province province, UnitType unitType) { Robustness.ValidateArgumentNotNull("province", province); //Make sure that a bicoastal province has a coast for a fleet Debug.Assert(!(province.IsBicoastal && unitType == UnitType.Fleet)); this.province = province; this.unitType = unitType; this.coast = Coast.NoCoast; this.adjacentLocations = new LocationCollection(); }
/// <summary>Creates a new <see cref="Location"/> instance. /// </summary> /// <param name="province">Province.</param> /// <param name="unitType">Unit type.</param> /// <param name="coast">Coast.</param> public Location(Province province, UnitType unitType, Coast coast) { Robustness.ValidateArgumentNotNull("province", province); //Make sure that we do not enter a coast for an Army Debug.Assert(unitType == UnitType.Army ? coast == Coast.NoCoast : true); //Make sure that the province is a coastal province if there is a coast specified Debug.Assert(coast != Coast.NoCoast ? province.IsCoastal : true); this.province = province; this.unitType = unitType; this.coast = coast; this.adjacentLocations = new LocationCollection(); }