private void SwapFunctionality(BoardSpaceStruct space, ICard card) { //attempting to swap with empty space if (card == null) { return; } //check for same space swap if (SelectedSpace.x == space.x && SelectedSpace.y == space.y) { return; } else { //Checks for valid swap if (manager.gameModel.canSwap(SelectedSpace.x, SelectedSpace.y, space.x, space.y)) { manager.gameModel.SwapCards(0, SelectedSpace.x, SelectedSpace.y, space.x, space.y); manager.updateBoard(); SelectedSpace.setOutlineColor(0); movemade = new GameMove(SelectedSpace.x, SelectedSpace.y, space.x, space.y); SelectedSpace = null; FindObjectOfType <buttonManager>().Deselect(); swapflag = false; manager.switchState(); } } }
public void SelectSpaceFunctionality(BoardSpaceStruct space, ICard card) { bool deselected = false; if (SelectedSpace != null) { SelectedSpace.setOutlineColor(0); //Deselect selected space if (SelectedSpace.x == space.x && space.y == SelectedSpace.y) { SelectedSpace = null; deselected = true; onSpaceDeselect(space, manager.gameModel); } } if (!deselected) { SelectedSpace = space; space.setOutlineColor(1); if (SelectedCard != null) { SelectedCard.setOutlineColor(0); SelectedCard = null; } onSpaceSelect(SelectedSpace, manager.gameModel); } }
public void SelectHandFunctionality(HandCardStruct cardspace) { bool deselected = false; cardspace.setOutlineColor(1); if (SelectedCard != null) { SelectedCard.setOutlineColor(0); if (SelectedCard.pos == cardspace.pos) { SelectedCard = null; deselected = true; } } if (!deselected) { SelectedCard = cardspace; cardspace.setOutlineColor(1); if (SelectedSpace != null) { SelectedSpace.setOutlineColor(0); SelectedSpace = null; FindObjectOfType <buttonManager>().Deselect(); } } }
// Use this for initialization void Awake() { manager = FindObjectOfType <ModelManager>(); SelectedSpace = null; SelectedCard = null; movemade = null; swapflag = false; }
private IEnumerator displayOutline(BoardSpaceStruct s, float time) { s.setOutlineColor(2); yield return(new WaitForSeconds(time)); s.setOutlineColor(0); }
public void onSelect(BoardSpaceStruct space, IGame model) { peekButton.SetActive(false); swapButton.SetActive(true); if (model.canRemove(0, space.x, space.y)) { removeButton.SetActive(true); } if (!space.isFaceup()) { peekButton.SetActive(true); } }
public void CancelActions() { swapflag = false; if (SelectedSpace != null) { SelectedSpace.setOutlineColor(0); } if (SelectedCard != null) { SelectedCard.setOutlineColor(0); } SelectedSpace = null; SelectedCard = null; FindObjectOfType <buttonManager>().Deselect(); }
//Gets all the board spaces at this row public BoardSpaceStruct[] GetCardSet() { var ret = new BoardSpaceStruct[5]; switch (direction) { case Direction.Row: { ret = (from x in FindObjectsOfType <BoardSpaceStruct>() where x.y == this.depthnumber select x).ToArray(); break; } case Direction.Column: { ret = (from x in FindObjectsOfType <BoardSpaceStruct>() where x.x == this.depthnumber select x).ToArray(); break; } case Direction.Diagonal: { if (depthnumber == 0) { ret = (from x in FindObjectsOfType <BoardSpaceStruct>() where x.x == x.y select x).ToArray(); } else if (depthnumber == 1) { ret = (from x in FindObjectsOfType <BoardSpaceStruct>() where x.x + x.y == ret.Length - 1 select x).ToArray(); } else { throw new System.Exception("Yo dawg what are you doin"); } break; } } return(ret); }
public void onDeselect(BoardSpaceStruct space, IGame model) { Deselect(); }