Beispiel #1
0
        protected override bool spawnFilteredInputs(string outputName)
        {
            if (!isCarryable(_keyName, _keyInput))
            {
                if (_verbose)
                {
                    Debug.Log("Failed to generate door unlock puzzle: key was not carryable.");
                }
                return(false);
            }

            // Try to generate our key
            PuzzleOutput possibleKeyInput = _keyInput.generatePuzzle(_keyName);

            if (possibleKeyInput == null)
            {
                if (_verbose)
                {
                    Debug.Log("Failed to generate door unlock puzzle: key input failed");
                }
                return(false);
            }

            // Make sure our connecting area is valid
            PuzzleOutput areaValidation = _connectingArea.areaGeneratePuzzle(this);

            if (areaValidation == null)
            {
                _keyInput.despawnItems();
                if (_verbose)
                {
                    Debug.Log("Failed to generate door unlock puzzle: room of origin failed");
                }
                return(false);
            }

            if (_verbose)
            {
                Debug.Log(string.Format("Successfully generated door unlock puzzle with {0} as a key", _keyName));
            }
            _itemsToSpawn.AddRange(possibleKeyInput.Items);
            _relationshipsToSpawn.AddRange(possibleKeyInput.Relationships);
            _itemsToSpawn.AddRange(areaValidation.Items);
            _relationshipsToSpawn.AddRange(areaValidation.Relationships);

            return(true);
        }
Beispiel #2
0
        protected override bool spawnFilteredInputs(string outputName)
        {
            PuzzleOutput possibleInput = _myArea.areaGeneratePuzzle(this);

            if (possibleInput == null)
            {
                if (_verbose)
                {
                    Debug.Log("Failed to generate Spawn Puzzle. Input Area was unable to generate.");
                }
                return(false);
            }
            _itemsToSpawn.AddRange(possibleInput.Items);
            _relationshipsToSpawn.AddRange(possibleInput.Relationships);
            (_spawnedOutput as PuzzleItem).setProperty("spawnArea", _myArea.name);
            return(true);
        }