// Use this for initialization void Start() { //start declarations for class unit.toonName = "Lizard"; unit.description = "He eats birds."; unit.elementType = "Water"; unit.attack = 2; unit.health = 10; unit.movement = 2; unit.pageCost = 1; unit.Print(); //fill in location info at start characterLocationUpdate(); //just looking at dict in debug log. GameObject board = GameObject.Find("map"); Map_v10 map = board.GetComponent <Map_v10>(); foreach (var group in map.tileLocPairs) { Debug.Log("Key:" + group.Key + " Value:" + group.Value); } foreach (var group in map.tileLocPairsInverse) { Debug.Log("Key:" + group.Key + " Value:" + group.Value); } }
// Use this for initialization, starting bird values void Start() { //str values unit.toonName = "Bird"; unit.description = "Bird is light as a feather"; unit.elementType = "Pastoral"; //int values unit.attack = 4; unit.health = 4; unit.movement = 2; unit.pageCost = 1; //print his opening line. Optional unit.Print(); //can delete everything below this i believe, keeping just in case //fill in location info at start //this might not need to exist anymore PLEASE CHECK //characterLocationUpdateB(); //Debug.Log(tileStr); //just looking at dict in debug log. //GameObject board = GameObject.Find("map"); //Map_v12 map = board.GetComponent<Map_v12>(); //foreach (var group in map.tileLocPairs) // Debug.Log("Key:" + group.Key + " Value:" + group.Value); //foreach (var group in map.tileLocPairsInverse) // Debug.Log("Key:" + group.Key + " Value:" + group.Value); }
// Use this for initialization void Start() { unit.toonName = "Bird"; unit.description = "Bird is light as a feather"; unit.elementType = "Pastoral"; unit.attack = 4; unit.health = 4; unit.movement = 2; unit.pageCost = 1; unit.Print(); //fill in location info at start characterLocationUpdateB(); //just looking at dict in debug log. GameObject board = GameObject.Find("map"); Map_v10 map = board.GetComponent <Map_v10>(); foreach (var group in map.tileLocPairs) { Debug.Log("Key:" + group.Key + " Value:" + group.Value); } foreach (var group in map.tileLocPairsInverse) { Debug.Log("Key:" + group.Key + " Value:" + group.Value); } }
// Use this for initialization void Start() { //start declarations for class unit.toonName = "Lizard"; unit.description = "He eats birds."; unit.elementType = "Water"; unit.attack = 2; unit.health = 100; unit.movement = 2; unit.pageCost = 1; unit.Print(); //fill in location info at start characterLocationUpdate(); //grabbing info from the map in an inefficient way. DEBUGS are if you want to look at either coordinate dictionary GameObject board = GameObject.Find("map"); Map_v12 map = board.GetComponent <Map_v12>(); //foreach (var group in map.tileLocPairs) // Debug.Log("Key:" + group.Key + " Value:" + group.Value); //foreach (var group in map.tileLocPairsInverse) //Debug.Log("Key:" + group.Key + " Value:" + group.Value); //move hexes, getting our location in unity coordinates by looking up the dictionary that stores all the pairs unityStr = map.tileLocPairs[tileStr]; //everything below is to spawn the highlights that show player their possible moves. //temporary strings we will be saving to and combining for dictionary and list reasons. string unityXStr; string unityYStr; string neighUnityStr; //down 1 tile GameObject moveTiles = (GameObject)Instantiate(mouseHexPrefab, new Vector3(xLoc, 0, (yLoc - .89f)), Quaternion.Euler(90, 90, 0)); moveTiles.gameObject.tag = "moveHex"; //we take our unity location, turn it into a string, then add this neighbor to list if it is "in bounds" of map unityXStr = xLoc.ToString(); unityYStr = (yLoc - .89f).ToString(); neighUnityStr = '(' + unityXStr + ", " + unityYStr + ')'; actualNeighbors.Add(map.tileLocPairsInverse[neighUnityStr]); //to the left 1 and up 1 if ((xLoc - .76f) > 0 && yLoc + (.445f) < 5.8) { moveTiles = (GameObject)Instantiate(mouseHexPrefab, new Vector3(xLoc - .76f, 0, yLoc + (.445f)), Quaternion.Euler(90, 90, 0)); moveTiles.gameObject.tag = "moveHex"; //we take our unity location, turn it into a string, then add this neighbor to list if it is "in bounds" of map unityXStr = (xLoc - .76f).ToString(); unityYStr = (yLoc + (.445f)).ToString(); neighUnityStr = '(' + unityXStr + ", " + unityYStr + ')'; actualNeighbors.Add(map.tileLocPairsInverse[neighUnityStr]); } //left 1, down 1 if (((xLoc - .76f) > 0) && (yLoc - (.445f) > 0)) { moveTiles = (GameObject)Instantiate(mouseHexPrefab, new Vector3(xLoc - (.76f), 0, yLoc - (.445f)), Quaternion.Euler(90, 90, 0)); moveTiles.gameObject.tag = "moveHex"; //we take our unity location, turn it into a string, then add this neighbor to list if it is "in bounds" of map unityXStr = (xLoc - .76f).ToString(); unityYStr = (yLoc - (.445f)).ToString(); neighUnityStr = '(' + unityXStr + ", " + unityYStr + ')'; actualNeighbors.Add(map.tileLocPairsInverse[neighUnityStr]); } //to the left 2 if (xLoc - (.76f * 2) > 0) { moveTiles = (GameObject)Instantiate(mouseHexPrefab, new Vector3(xLoc - (.76f * 2), 0, yLoc), Quaternion.Euler(90, 90, 0)); moveTiles.gameObject.tag = "moveHex"; //we take our unity location, turn it into a string, then add this neighbor to list if it is "in bounds" of map unityXStr = (xLoc - (.76f * 2)).ToString(); unityYStr = (yLoc).ToString(); neighUnityStr = '(' + unityXStr + ", " + unityYStr + ')'; actualNeighbors.Add(map.tileLocPairsInverse[neighUnityStr]); } //to the left 2, up 2 if ((xLoc - (.76f * 2) > 0) && ((yLoc + .89f) < 5.8)) { moveTiles = (GameObject)Instantiate(mouseHexPrefab, new Vector3(xLoc - (.76f * 2), 0, yLoc + .89f), Quaternion.Euler(90, 90, 0)); moveTiles.gameObject.tag = "moveHex"; //we take our unity location, turn it into a string, then add this neighbor to list if it is "in bounds" of map unityXStr = (xLoc - (.76f * 2)).ToString(); unityYStr = (yLoc + .89f).ToString(); neighUnityStr = '(' + unityXStr + ", " + unityYStr + ')'; actualNeighbors.Add(map.tileLocPairsInverse[neighUnityStr]); } //to the left 2, down 2 if ((xLoc - (.76f * 2) > 0) && ((yLoc - .89f) > 0)) { moveTiles = (GameObject)Instantiate(mouseHexPrefab, new Vector3(xLoc - (.76f * 2), 0, yLoc - .89f), Quaternion.Euler(90, 90, 0)); moveTiles.gameObject.tag = "moveHex"; //we take our unity location, turn it into a string, then add this neighbor to list if it is "in bounds" of map unityXStr = (xLoc - (.76f * 2)).ToString(); unityYStr = (yLoc - .89f).ToString(); neighUnityStr = '(' + unityXStr + ", " + unityYStr + ')'; actualNeighbors.Add(map.tileLocPairsInverse[neighUnityStr]); } //to the right one and up if (((xLoc + (.76f)) < 4.56) && (yLoc + ((.445f)) < 5.8)) { moveTiles = (GameObject)Instantiate(mouseHexPrefab, new Vector3(xLoc + (.76f), 0, yLoc + (.445f)), Quaternion.Euler(90, 90, 0)); moveTiles.gameObject.tag = "moveHex"; //we take our unity location, turn it into a string, then add this neighbor to list if it is "in bounds" of map unityXStr = (xLoc + .76f).ToString(); unityYStr = (yLoc + (.445f)).ToString(); neighUnityStr = '(' + unityXStr + ", " + unityYStr + ')'; actualNeighbors.Add(map.tileLocPairsInverse[neighUnityStr]); } //to the right one and down if (((xLoc + (.76f)) < 4.56) && (yLoc - (.445f) >= 0)) { moveTiles = (GameObject)Instantiate(mouseHexPrefab, new Vector3(xLoc + (.76f), 0, yLoc - (.445f)), Quaternion.Euler(90, 90, 0)); moveTiles.gameObject.tag = "moveHex"; //we take our unity location, turn it into a string, then add this neighbor to list if it is "in bounds" of map unityXStr = (xLoc + .76f).ToString(); unityYStr = Math.Round((yLoc - .445f), 4).ToString(); neighUnityStr = '(' + unityXStr + ", " + unityYStr + ')'; actualNeighbors.Add(map.tileLocPairsInverse[neighUnityStr]); } //to the right 2 if ((xLoc + (.76f * 2)) < 4.56) { moveTiles = (GameObject)Instantiate(mouseHexPrefab, new Vector3(xLoc + (.76f * 2), 0, yLoc), Quaternion.Euler(90, 90, 0)); moveTiles.gameObject.tag = "moveHex"; //we take our unity location, turn it into a string, then add this neighbor to list if it is "in bounds" of map unityXStr = (xLoc + (.76f * 2)).ToString(); unityYStr = (yLoc).ToString(); neighUnityStr = '(' + unityXStr + ", " + unityYStr + ')'; actualNeighbors.Add(map.tileLocPairsInverse[neighUnityStr]); } //right 2, up 2 if (((xLoc + (.76f * 2)) < 4.56) && (yLoc + .89f < 5.8)) { moveTiles = (GameObject)Instantiate(mouseHexPrefab, new Vector3(xLoc + (.76f * 2), 0, yLoc + .89f), Quaternion.Euler(90, 90, 0)); moveTiles.gameObject.tag = "moveHex"; //we take our unity location, turn it into a string, then add this neighbor to list if it is "in bounds" of map unityXStr = (xLoc + (.76f * 2)).ToString(); unityYStr = (yLoc + .89f).ToString(); neighUnityStr = '(' + unityXStr + ", " + unityYStr + ')'; actualNeighbors.Add(map.tileLocPairsInverse[neighUnityStr]); } //right 2, up 2 if (((xLoc + (.76f * 2)) < 4.56) && (yLoc - .89f > 0)) { moveTiles = (GameObject)Instantiate(mouseHexPrefab, new Vector3(xLoc + (.76f * 2), 0, yLoc - .89f), Quaternion.Euler(90, 90, 0)); moveTiles.gameObject.tag = "moveHex"; //we take our unity location, turn it into a string, then add this neighbor to list if it is "in bounds" of map unityXStr = (xLoc + (.76f * 2)).ToString(); unityYStr = (yLoc - .89f).ToString(); neighUnityStr = '(' + unityXStr + ", " + unityYStr + ')'; actualNeighbors.Add(map.tileLocPairsInverse[neighUnityStr]); } //one up if ((yLoc + .89f) < 5.8) { moveTiles = (GameObject)Instantiate(mouseHexPrefab, new Vector3(xLoc, 0, yLoc + .89f), Quaternion.Euler(90, 90, 0)); moveTiles.gameObject.tag = "moveHex"; //we take our unity location, turn it into a string, then add this neighbor to list if it is "in bounds" of map unityXStr = (xLoc).ToString(); unityYStr = (yLoc + .89f).ToString(); neighUnityStr = '(' + unityXStr + ", " + unityYStr + ')'; actualNeighbors.Add(map.tileLocPairsInverse[neighUnityStr]); } }