Beispiel #1
0
    private IEnumerator SetDirection(GameObject target)
    {
        Debug.Log("Starting direction set");
        yield return(new WaitForSeconds(0.38f));

        direction           = target.GetComponent <ConveyorDirection>().direction;
        transform.position *= 1.001f;
        Debug.Log("Direction set");
    }
    uint RotateRight(uint x, int y)
    {
        // Assume rotating the currentDirection var
        // & it with output directions so it picks one it is allowed to output to
        //(original >> bits) | (original << (32 - bits))
        uint k = (x >> y);

        ConveyorDirection.Direction newDir = ((ConveyorDirection.Direction)k & outputDirections);
        while (newDir == ConveyorDirection.Direction.noDirection)
        {
            k = k >> 1;
            if (k < 1)
            {
                k = 8;
            }
            newDir = ((ConveyorDirection.Direction)k & outputDirections);
        }
        return(k);
    }