public bool isGuided() { List <HexaPos> guidedPoses = getGuidedPos(); bool isGuided = false; foreach (var guidePos in guidedPoses) { innerTile guidedTile = SceneHandler.smallMap[guidePos.x, guidePos.y].GetComponent <innerTile>(); if (guidedTile.meep != null && (guidedTile.meep.GetType().IsSubclassOf(typeof(Companion)))) { isGuided = true; } } return(isGuided); }
public void activateCompanion(bool _respectWalkRange = true) { SceneHandler.activeCompanion = this; Debug.Log("actION" + hasActionOutstanding); if (hasActionOutstanding) { if (_respectWalkRange) { List <HexaPos> walkableTilesPos = new List <HexaPos>(); walkableTilesPos = Map.tilesInRange(Pos, walkRange); Map.highlightAllInnerTiles(false); foreach (HexaPos tilePos in walkableTilesPos) { try { SceneHandler.smallMap[tilePos.x, tilePos.y].GetComponent <innerTile>().setHighlighted(true); } catch (Exception) {} } List <Opponent> opps = SceneHandler.getAllMeeplesFromType <Opponent>(); foreach (Opponent opp in opps) { SceneHandler.smallMap[opp.Pos.x, opp.Pos.y].GetComponent <innerTile>().setHighlighted(true); } } else { Map.highlightAllInnerTiles(true); List <Companion> comps = SceneHandler.getAllMeeplesFromType <Companion>(); List <HexaPos> negatiabletiles = new List <HexaPos>(); foreach (Companion comp in comps) { if (comp != SceneHandler.activeCompanion) { if (comp.GetType() == typeof(Prince)) { if (SceneHandler.activeCompanion.GetType() == typeof(Hunter)) { negatiabletiles.AddRange(Map.tilesInRange(new HexaPos(comp.Pos.x, comp.Pos.y), 2)); } else if (SceneHandler.activeCompanion.GetType() == typeof(PackAnimal)) { negatiabletiles.AddRange(Map.tilesInRange(new HexaPos(comp.Pos.x, comp.Pos.y), 2)); } else if (SceneHandler.activeCompanion.GetType() == typeof(Healer)) { negatiabletiles.AddRange(Map.tilesInRange(new HexaPos(comp.Pos.x, comp.Pos.y), 1)); } else if (SceneHandler.activeCompanion.GetType() == typeof(Mercenary)) { negatiabletiles.AddRange(Map.tilesInRange(new HexaPos(comp.Pos.x, comp.Pos.y), 1)); } else if (SceneHandler.activeCompanion.GetType() == typeof(Scout)) { negatiabletiles.AddRange(Map.tilesInRange(new HexaPos(comp.Pos.x, comp.Pos.y), 1)); } } else if (comp.GetType() == typeof(Hunter)) { if (SceneHandler.activeCompanion.GetType() == typeof(Prince)) { negatiabletiles.AddRange(Map.tilesInRange(new HexaPos(comp.Pos.x, comp.Pos.y), 2)); } } else if (comp.GetType() == typeof(PackAnimal)) { if (SceneHandler.activeCompanion.GetType() == typeof(Prince)) { negatiabletiles.AddRange(Map.tilesInRange(new HexaPos(comp.Pos.x, comp.Pos.y), 2)); } } else if (comp.GetType() == typeof(Mercenary)) { if (SceneHandler.activeCompanion.GetType() == typeof(Prince)) { negatiabletiles.AddRange(Map.tilesInRange(new HexaPos(comp.Pos.x, comp.Pos.y), 1)); } } else if (comp.GetType() == typeof(Healer)) { if (SceneHandler.activeCompanion.GetType() == typeof(Prince)) { negatiabletiles.AddRange(Map.tilesInRange(new HexaPos(comp.Pos.x, comp.Pos.y), 1)); } } else if (comp.GetType() == typeof(Scout)) { if (SceneHandler.activeCompanion.GetType() == typeof(Prince)) { negatiabletiles.AddRange(Map.tilesInRange(new HexaPos(comp.Pos.x, comp.Pos.y), 1)); } } } } foreach (HexaPos negPos in negatiabletiles) { try { innerTile negTile = SceneHandler.smallMap[negPos.x, negPos.y].GetComponent <innerTile>(); negTile.setHighlighted(false); }catch (Exception e) {} } } MeshRenderer innerTMesh = SceneHandler.smallMap[Pos.x, Pos.y].GetComponent <MeshRenderer>(); innerTMesh.material = Initialisation.lookOutMate; SceneHandler.highlightUnguidedPackAnimals(); GameObject tileHolder = GameObject.Find("tileHolder"); SoundHelper sh = tileHolder.GetComponent <SoundHelper>(); sh.Play("selected"); } }
public static GameObject[,] createSmallHexa() { //15x15 Feld gebraucht GameObject[,] result = new GameObject[15, 15]; GameObject godfather = GameObject.Find("innerTileHolder"); GameObject father = new GameObject("Playfield"); GameObject tiles = new GameObject("inTiles"); GameObject meepleCollections = new GameObject("MeepleCollection"); tiles.transform.parent = father.transform; meepleCollections.transform.parent = father.transform; bool scndRow = false; for (int y = 0; y < 15; y++) { for (int x = 0; x < 15; x++) { result[x, y] = (GameObject)Instantiate(Initialisation.innerTile); result[x, y].AddComponent <MeshCollider>(); result[x, y].transform.name = "innerTile: " + x.ToString() + " " + y.ToString(); result[x, y].transform.parent = tiles.transform; Vector3 position = new Vector3(); if (scndRow) { position = new Vector3(0.866f + x * 1.732f, 0, y * 1.5f); } else { position = new Vector3(x * 1.732f, 0, y * 1.5f); } innerTile it = result[x, y].AddComponent <innerTile>(); it.posX = x; it.posY = y; result[x, y].transform.position = position; if (y == 0 || y == 14) { result[x, y].SetActive(false); } if (y % 2 != 0 && x == 13) { result[x, y].SetActive(false); } if (x < 4 || x > 13) { result[x, y].SetActive(false); } if ((y == 1 || y == 13) && (x < 8 || x > 8)) { result[x, y].SetActive(false); } if ((y == 2 || y == 12) && (x < 7 || x > 10)) { result[x, y].SetActive(false); } if ((y == 3 || y == 11) && (x < 5 || x > 11)) { result[x, y].SetActive(false); } } if (scndRow) { scndRow = false; } else { scndRow = true; } } father.transform.position = new Vector3(-0.976f, 0.014f, -0.697f); father.transform.localScale = new Vector3(0.0666f, 0.0666f, 0.0666f); father.transform.parent = godfather.transform; return(result); }