public Tile GetTile(PositionContainer container) { if (container != null) { return(GetTile(container.x, container.z)); } else { Debug.Log("container is null!"); return(null); } }
private void AddUndo(Vector3 delta) { var blocks = SelectionManager.Instance.blocks; var posContainerList = new PositionContainerList(); foreach (var block in blocks) { var posContainer = new PositionContainer(); posContainer.transform = block.transform; posContainer.lastPosition = block.transform.position - delta; posContainer.newPosition = block.transform.position; posContainerList.list.Add(posContainer); } undoList.Add(posContainerList); }
void CheckDownRightMove() { foreach (int exclusionNumber in downRightMoveExclusions) { if (exclusionNumber == checkerPosition) { return; } } if ((checkerPosition >= 9 && checkerPosition < 13) || (checkerPosition >= 17 && checkerPosition < 21) || (checkerPosition >= 25 && checkerPosition < 29)) { potentialMoveLabel = positionLabels[(checkerPosition - 1) - 4].GetComponent <PositionContainer>(); if (checkerPosition % 8 != 0 && potentialMoveLabel.OccupationValue == 0 && !potentialMoveLabel.MoveIndicatorEnabled) { if (!checkerPrecheck) { potentialMoveLabel.EnableMoveIndicator(); } if (movePrecheck) { opponentAI.aiMovePositions.Add(potentialMoveLabel); } } } else if ((checkerPosition >= 5 && checkerPosition < 9) || (checkerPosition >= 13 && checkerPosition < 17) || (checkerPosition >= 21 && checkerPosition < 25) || checkerPosition >= 29) { potentialMoveLabel = positionLabels[(checkerPosition - 1) - 3].GetComponent <PositionContainer>(); if (potentialMoveLabel.OccupationValue == 0 && !potentialMoveLabel.MoveIndicatorEnabled) { if (!checkerPrecheck) { potentialMoveLabel.EnableMoveIndicator(); } if (movePrecheck) { opponentAI.aiMovePositions.Add(potentialMoveLabel); } } } }
void CheckDownRightCapture() { foreach (int exclusionNumber in downRightCaptureExclusions) { if (exclusionNumber == checkerPosition) { return; } } if ((checkerPosition >= 9 && checkerPosition < 13) || (checkerPosition >= 17 && checkerPosition < 21) || (checkerPosition >= 25 && checkerPosition < 29)) { potentialMoveLabel = positionLabels[(checkerPosition - 1) - 4].GetComponent <PositionContainer>(); if (potentialMoveLabel.OccupationValue != 0 && potentialMoveLabel.OccupationValue != checkerContainerScript.PieceColor) { var potentialObject = potentialMoveLabel.OccupyingChecker.gameObject; var potentialThreatened = potentialMoveLabel; potentialMoveLabel = positionLabels[(checkerPosition - 1) - 7].GetComponent <PositionContainer>(); if (potentialMoveLabel.OccupationValue == 0 && !potentialMoveLabel.CaptureIndicatorEnabled) { canCaptureDR = true; potentialMoveLabel.MoveDirection = "DR"; CaptureObjectDR = potentialObject; if (!threatCheck) { CaptureRequired = true; } if (!checkerPrecheck) { potentialMoveLabel.EnableCaptureIndicator(); } if (recaptureCheck) { canRecapture = true; } if (opponentAI.playingAI && checkerContainerScript.PieceColor == opponentAI.aiCheckerColor) { opponentAI.aiCapturePositions.Add(potentialMoveLabel); } if (threatCheck) { opponentAI.aiThreatenedPositions.Add(potentialThreatened); } } } else { canCaptureDR = false; potentialMoveLabel.MoveDirection = null; } } else if ((checkerPosition >= 5 && checkerPosition < 9) || (checkerPosition >= 13 && checkerPosition < 17) || (checkerPosition >= 21 && checkerPosition < 25) || checkerPosition >= 29) { potentialMoveLabel = positionLabels[(checkerPosition - 1) - 3].GetComponent <PositionContainer>(); if (potentialMoveLabel.OccupationValue != 0 && potentialMoveLabel.OccupationValue != checkerContainerScript.PieceColor) { var potentialObject = potentialMoveLabel.OccupyingChecker.gameObject; var potentialThreatened = potentialMoveLabel; potentialMoveLabel = positionLabels[(checkerPosition - 1) - 7].GetComponent <PositionContainer>(); if (potentialMoveLabel.OccupationValue == 0 && !potentialMoveLabel.CaptureIndicatorEnabled) { canCaptureDR = true; potentialMoveLabel.MoveDirection = "DR"; CaptureObjectDR = potentialObject; if (!threatCheck) { CaptureRequired = true; } if (!checkerPrecheck) { potentialMoveLabel.EnableCaptureIndicator(); } if (recaptureCheck) { canRecapture = true; } if (opponentAI.playingAI && checkerContainerScript.PieceColor == opponentAI.aiCheckerColor) { opponentAI.aiCapturePositions.Add(potentialMoveLabel); } if (threatCheck) { opponentAI.aiThreatenedPositions.Add(potentialThreatened); } } } else { canCaptureDR = false; potentialMoveLabel.MoveDirection = null; } } }