示例#1
0
    void hoverWireRecursion(GridPoint currentGridPoint, int powerEntryPoint)
    {
        GridPoint nextGridPoint = currentGridPoint.AdjacentPointsCircular() [powerEntryPoint + 3];

        if (inRange(nextGridPoint))
        {
            HexagonBase hexBase = getHexagon(nextGridPoint);
            if (hexBase is HexagonPower)
            {
                HexagonPower nextHexPower = (HexagonPower)hexBase;
                Wire         activeWire   = nextHexPower.getWireAtEntryPoint(powerEntryPoint);
                if ((activeWire != null) && !nextHexPower.isRotating() && !activeWire.hover)
                {
                    activeWire.setHover(true);
                    int nextPowerEntryPoint = nextHexPower.otherEndpointOfWire(powerEntryPoint);
                    hoverWires.Add(activeWire);
                    hoverWireRecursion(nextGridPoint, (nextPowerEntryPoint + 3) % 6);
                }
            }
        }
    }
示例#2
0
    void emitPowerRecursion(GridPoint currentGridPoint, int powerEntryPoint)
    {
        GridPoint nextGridPoint = currentGridPoint.AdjacentPointsCircular() [powerEntryPoint + 3];

        if (hexField.inRange(nextGridPoint))
        {
            HexagonBase hexBase = hexField.getHexagon(nextGridPoint);
            if (hexBase is HexagonPower)
            {
                HexagonPower nextHexPower = (HexagonPower)hexBase;
                Wire         activeWire   = nextHexPower.getWireAtEntryPoint(powerEntryPoint);
                if ((activeWire != null) && !nextHexPower.isRotating())
                {
                    activeWire.setPowered(true);
                    int nextPowerEntryPoint = nextHexPower.otherEndpointOfWire(powerEntryPoint);
                    poweredWires.Add(activeWire);
                    emitPowerRecursion(nextGridPoint, ((nextPowerEntryPoint + 9) % 6));
                }
            }
        }
    }