protected override void SelectElement(GameObject newElement) { if (newElement == null) { return; } selectedGO.GetComponent <GridElement>().ChangeColor(prevColor); selectedGO = newElement; prevColor = selectedGO.GetComponent <Image>().color; GridElement selectedGE = selectedGO.GetComponent <GridElement>(); if (activeGO != null) { if (selectedGO == activeGO) { selectedGE.ChangeColor(activeColor); } else { selectedGE.ChangeColor(selectedColor); } } else { selectedGO.GetComponent <GridElement>().ChangeColor(selectedColor); } UpdateDescription(); }
private void DisplayPusherInfluenceWest(bool shouldHighlight, bool immediateNeighbor) { if (!westWall && westNeighbor && westNeighbor.GetComponent <GridElement>().piece&& (westNeighbor.GetComponent <GridElement>().piece.GetComponent <GamePiece>() is Unit || westNeighbor.GetComponent <GridElement>().piece.GetComponent <GamePiece>() is Trap)) { GridElement west = westNeighbor.GetComponent <GridElement>(); west.isHighlighted = shouldHighlight; if (shouldHighlight) { west.ChangeColor(GridMenu.pushColor); if (!immediateNeighbor) { west.ChangeColor(GridMenu.pushColor + new Color(0.4F, 0.4F, 0.4F)); } } else { west.ChangeColor(Menu.defaultColor); } west.DisplayPusherInfluenceWest(shouldHighlight, false); } }
private void DisplayPusherInfluenceSouth(bool shouldHighlight, bool immediateNeighbor) { if (!southWall && southNeighbor && southNeighbor.GetComponent <GridElement>().piece&& (southNeighbor.GetComponent <GridElement>().piece.GetComponent <GamePiece>() is Unit || southNeighbor.GetComponent <GridElement>().piece.GetComponent <GamePiece>() is Trap)) { GridElement south = southNeighbor.GetComponent <GridElement>(); south.isHighlighted = shouldHighlight; if (shouldHighlight) { south.ChangeColor(GridMenu.pushColor); if (!immediateNeighbor) { south.ChangeColor(GridMenu.pushColor + new Color(0.4F, 0.4F, 0.4F)); } } else { south.ChangeColor(Menu.defaultColor); } south.DisplayPusherInfluenceSouth(shouldHighlight, false); } }
private void DisplayPullerInfluenceWest(int distance, bool shouldHighlight) { if (!westWall && westNeighbor && distance > 0) { GridElement west = westNeighbor.GetComponent <GridElement>(); if (shouldHighlight) { west.ChangeColor(GridMenu.pullColor); if (west.piece && (west.piece.GetComponent <GamePiece>() is Unit || west.piece.GetComponent <GamePiece>() is Trap)) { west.isHighlighted = shouldHighlight; } else { west.GetComponent <Image>().color += new Color(0.2F, 0.2F, 0.2F); } } else { west.ChangeColor(Menu.defaultColor); } west.DisplayPullerInfluenceWest(distance - 1, shouldHighlight); } }
private void DisplayPullerInfluenceSouth(int distance, bool shouldHighlight) { if (!southWall && southNeighbor && distance > 0) { GridElement south = southNeighbor.GetComponent <GridElement>(); if (shouldHighlight) { south.ChangeColor(GridMenu.pullColor); if (south.piece && (south.piece.GetComponent <GamePiece>() is Unit || south.piece.GetComponent <GamePiece>() is Trap)) { south.isHighlighted = shouldHighlight; } else { south.GetComponent <Image>().color += new Color(0.2F, 0.2F, 0.2F); } } else { south.ChangeColor(Menu.defaultColor); } south.DisplayPullerInfluenceSouth(distance - 1, shouldHighlight); } }
public void PlacePortal(GridElement newPortalLoc) { if (portalElement) { portalElement.portal = false; portalElement.portalOwner = PlayerEnum.none; portalElement.ChangeColor(Menu.defaultColor); } portalElement = newPortalLoc; // Check to make sure enemy portal isn't there if (portalElement.portal && portalElement.owner != owner.GetComponent <Player>().identity) { // if there is one, destory it portalElement.portal = false; portalElement.portalOwner = PlayerEnum.none; return; } portalElement.portal = true; portalElement.portalOwner = owner.GetComponent <Player>().identity; }