Exemple #1
0
    public void SelectCases(int x, int y, int numberMouvement, IMovementType movementType)
    {
        if (numberMouvement < 0)
        {
            return;
        }
        if (x < 0 || x >= gridWidth)
        {
            return;
        }
        if (y < 0 || y >= gridHeight)
        {
            return;
        }
        Transform hexPos          = matrix[x, y];
        int       MovementPenalty = hexPos.GetChild(0).GetComponent <CaseScript>().terrain.getMovementPenaly(movementType);

        if (MovementPenalty == -1)
        {
            return;
        }
        if (numberMouvement != movementType.GetMovementNumber() && hexPos.Find("Character"))
        {
            return;
        }
        if (!selectableHexPos.ContainsKey(hexPos.GetHashCode()))
        {
            AttachSelector(hexPos);
        }
        SelectCases(x - 1, y, numberMouvement - MovementPenalty, movementType);
        SelectCases(x + 1, y, numberMouvement - MovementPenalty, movementType);
        SelectCases(x, y + 1, numberMouvement - MovementPenalty, movementType);
        SelectCases(x, y - 1, numberMouvement - MovementPenalty, movementType);
        if (y % 2 == 0)
        {
            SelectCases(x - 1, y - 1, numberMouvement - MovementPenalty, movementType);
            SelectCases(x - 1, y + 1, numberMouvement - MovementPenalty, movementType);
        }
        else
        {
            SelectCases(x + 1, y - 1, numberMouvement - MovementPenalty, movementType);
            SelectCases(x + 1, y + 1, numberMouvement - MovementPenalty, movementType);
        }
    }
Exemple #2
0
 public int GetMovementNumber()
 {
     return(movementType.GetMovementNumber());
 }