public void Validate(DungeonFlow flow, DungeonValidator validator)
        {
            var tiles = flow.GetUsedTileSets()
                        .SelectMany(ts => ts.TileWeights.Weights.Select(w => w.Value))
                        .Where(t => t != null);

            var tileDoorways = new Dictionary <GameObject, Doorway[]>();

            foreach (var tile in tiles)
            {
                tileDoorways[tile] = tile.GetComponentsInChildren <Doorway>(true);
            }

            CheckDoorwayCount(flow, validator);
            CheckDoorwayUpVectors(flow, validator, tileDoorways);
            CheckDoorwayForwardVectors(flow, validator, tileDoorways);
            CheckDoorwaySockets(flow, validator, tileDoorways);
        }
Beispiel #2
0
        private void CheckTileSets(DungeonFlow flow, DungeonValidator validator)
        {
            var tileSets = flow.GetUsedTileSets();

            foreach (var tileSet in tileSets)
            {
                if (tileSet == null)
                {
                    continue;
                }

                foreach (var tileWeight in tileSet.TileWeights.Weights)
                {
                    if (tileWeight.Value == null)
                    {
                        validator.AddWarning("The tile set '{0}' has a missing tile", tileSet, tileSet.name);
                    }

                    if (tileWeight.MainPathWeight <= 0f && tileWeight.BranchPathWeight <= 0f)
                    {
                        validator.AddWarning("Tile set '{0}' has a tile ({1}) set up with a main path weight and branch path weight of zero. This tile will never appear in the dungeon", tileSet, tileSet.name, (tileWeight.Value == null) ? "NULL" : tileWeight.Value.name);
                    }

                    if (tileWeight.DepthWeightScale != null)
                    {
                        bool hasNonZeroKeyframe = false;

                        foreach (var key in tileWeight.DepthWeightScale.keys)
                        {
                            if (key.value > 0f)
                            {
                                hasNonZeroKeyframe = true;
                                break;
                            }
                        }

                        if (!hasNonZeroKeyframe)
                        {
                            validator.AddWarning("Tile set '{0}' has a tile ({1}) set up with a depth curve that will always return zero. This tile will never appear in the dungeon", tileSet, tileSet.name, tileWeight.Value.name);
                        }
                    }
                }
            }
        }
Beispiel #3
0
        protected virtual void PreProcess()
        {
            if (preProcessData.Count > 0)
            {
                return;
            }

            ChangeStatus(GenerationStatus.PreProcessing);

            var usedTileSets = DungeonFlow.GetUsedTileSets().Concat(tilesPendingInjection.Select(x => x.TileSet)).Distinct();

            foreach (var tileSet in usedTileSets)
            {
                foreach (var tile in tileSet.TileWeights.Weights)
                {
                    if (tile.Value != null)
                    {
                        useableTiles.Add(tile.Value);
                        tile.TileSet = tileSet;
                    }
                }
            }
        }