Ejemplo n.º 1
0
        void EditResource(string name, float rariety, int spawnAmount, Mesh mesh, Texture2D texture, bool replaceGroundTexture, int index)
        {
            int[]          finalTiles    = new int[rPossibleTiles.Count];
            List <Feature> finalFeatures = new List <Feature>();

            finalTiles = rPossibleTiles.ToArray();

            //fill feature list with data from rule.possibleFeatures
            for (int i = 0; i < rPossibleFeatures.Count; i++)
            {
                finalFeatures.Add(rPossibleFeatures[i]);
            }


            //nullify duplicate tiles
            for (int i = 0; i < rPossibleTiles.Count; i++)
            {
                for (int z = 0; z < rPossibleTiles.Count; z++)
                {
                    if (rPossibleTiles[i] == rPossibleTiles[z] && i != z)
                    {
                        rPossibleTiles.RemoveAt(z);
                    }
                }
            }
            finalTiles = rPossibleTiles.ToArray();

            //nullify duplicate features
            for (int i = 0; i < finalFeatures.Count; i++)
            {
                for (int z = 0; z < finalFeatures.Count; z++)
                {
                    if (finalFeatures[i] == finalFeatures[z] && i != z)
                    {
                        finalFeatures.RemoveAt(z);
                    }
                }
            }

            resourceManager.AddResourceAtIndex(new Resource(name, rariety, spawnAmount, mesh, texture, replaceGroundTexture, new HexRule(finalTiles, finalFeatures.ToArray())), index);
        }