Exemple #1
0
    private void GenerateStartAndFinishOnMap()
    {
        Debug.Log("Generating SandF");
        bool isStartSet  = false;
        bool isFinishSet = false;

        while (!isStartSet)
        {
            Vector2 tempKey = ReturnRandomMapDictionaryKey();
            Debug.Log(tempKey.ToString());
            if (mapInfo.generatedMapDictionary[tempKey].GetNodeType().Equals(Keys.NodeTypes.MAP))
            {
                MapNode tempNode = mapInfo.generatedMapDictionary[tempKey];
                tempNode.ChangeType(Keys.NodeTypes.START);
                mapInfo.startNode = tempNode;
                isStartSet        = true;
            }
        }
        while (!isFinishSet)
        {
            Vector2 tempKey = ReturnRandomMapDictionaryKey();
            Debug.Log(tempKey.ToString());
            if (mapInfo.generatedMapDictionary[tempKey].GetNodeType().Equals(Keys.NodeTypes.MAP))
            {
                MapNode tempNode = mapInfo.generatedMapDictionary[tempKey];
                tempNode.ChangeType(Keys.NodeTypes.FINISH);
                mapInfo.finishNode = tempNode;
                isFinishSet        = true;
            }
        }
    }