Exemplo n.º 1
0
    // To get the int[] with values for site, spot, and action
    public void getDataFromSeed()
    {
        // This will use the default bit values in SeedManager

        string seed = "FFFFFF"; // seed must be in hexidecimal

        int[] interactableData = seedToByte.getActions(seed);
    }
Exemplo n.º 2
0
    /// <summary>
    /// Returns list of Interactable IDs generated from encoding a seed string into
    /// a series of interactable actions.
    /// </summary>
    private InteractableID[] getPathIDs(string seedString)
    {
        // This is specifically for 108 bit seeds used in the devcon demo
        List <int> bitList = SeedToByte.customList(3, 4, 2, 4, 4);

        int[] actions = converter.getActions(seedString, bitList);

        List <InteractableID> locationIDs = new List <InteractableID>();

        int count = 0;

        while (count < actions.Length)
        {
            int siteID = actions[count];

            for (int j = 0; j < SeedManager.ActionCount; j++)
            {
                int spotID   = actions[count + (2 * j) + 1];
                int actionID = actions[count + (2 * j) + 2];
                locationIDs.Add(new InteractableID(siteID, spotID, actionID));
            }

            count += 1 + 2 * SeedManager.ActionCount;
        }

        return(locationIDs.ToArray());
    }
Exemplo n.º 3
0
    public string getSentenceFromHex(string hex)
    {
        int[]  actions = seeds.getActions(hex);
        string words   = getSentenceFromActions(actions);

        return(words);
    }
Exemplo n.º 4
0
    // Modified to create a list of gameobjects with interactable attached as monobehavior
    private Interactable[] GetInteractableLocations()
    {
        SeedToByte locations = NavAIMesh.GetComponent <SeedToByte>();

        int[] actions = locations.getActions(gameState.SeedString);
        List <Interactable> locationIDs = new List <Interactable>();

        int count = 0;

        while (count < actions.Length)
        {
            int siteID = actions[count];

            for (int j = 0; j < gameState.ActionCount; j++)
            {
                int spotID   = actions[count + (2 * j) + 1];
                int actionID = actions[count + (2 * j) + 2];
                locationIDs.Add(new Interactable(siteID, spotID, actionID));
            }

            count += 1 + 2 * gameState.ActionCount;
        }

        return(locationIDs.ToArray());
    }
Exemplo n.º 5
0
    // Test to make sure a BIP39 sentence can be retrieved from a list of actions
    public int[] testGetSentence()
    {
        int[] passed = new int[2];
        passed[1] = 1;

        string testingHex = "3720B091810D8127C55630F55DD2275C05";

        int[]  actions = seeds.getActions(testingHex);
        string words   = bpc.getSentenceFromActions(actions);

        if (words == "ugly call give address amount venture misery dose quick spoil weekend inspire")
        {
            passed[0] = 1;
        }
        else
        {
            Debug.Log("BIP39 test converting actions to sentence failed");
        }

        return(passed);
    }
Exemplo n.º 6
0
    /// <summary>
    /// Returns list of Interactable IDs generated from encoding a seed string into
    /// a series of interactable actions.
    /// </summary>
    private InteractableID[] getPathIDs(string seedString)
    {
        int[] actions = converter.getActions(seedString);
        List <InteractableID> locationIDs = new List <InteractableID>();

        int count = 0;

        while (count < actions.Length)
        {
            int siteID = actions[count];

            for (int j = 0; j < SeedManager.ActionCount; j++)
            {
                int spotID   = actions[count + (2 * j) + 1];
                int actionID = actions[count + (2 * j) + 2];
                locationIDs.Add(new InteractableID(siteID, spotID, actionID));
            }

            count += 1 + 2 * SeedManager.ActionCount;
        }

        return(locationIDs.ToArray());
    }