public void accept(AreaConnectionRelationship rel) { // Not dealing with these during runtime unless it's a locked door if (!rel.locked) { throw new UnityException("AreaConnectionRelationship applied during game!"); } // Otherwise, destroy both our key and lock for now PlayState.instance.playAudio(PlayState.instance.lockClip); if (_item1.inInventory) { _item1.currentSlot.removeItem(); } if (_item1.insideItem) { _item1.removeFromOtherItem(); } _item1.die(); if (_item2.inInventory) { _item2.currentSlot.removeItem(); } if (_item2.insideItem) { _item2.removeFromOtherItem(); } _item2.die(); }
public PuzzleOutput areaGeneratePuzzle(BuildingBlock buildingBlockToBind) { if (_verbose) { Debug.Log("spawning Area: " + _name); } if (_boundBuildingBlock != null) { if (_verbose) { Debug.Log("Area already bound to another building block!"); } return(new PuzzleOutput()); } else { BuildingBlock.shuffle(_inputs); foreach (IAreaConnector input in _inputs) { PuzzleOutput possibleInput = input.areaGeneratePuzzle(this); if (possibleInput == null) { continue; } _input = input; _boundBuildingBlock = buildingBlockToBind; PuzzleOutput result = new PuzzleOutput(); result.Items.AddRange(possibleInput.Items); result.Relationships.AddRange(possibleInput.Relationships); // Add an area connection relationship here AreaConnectionRelationship connectionRelationship = input.makeConnection(this); result.Relationships.Add(connectionRelationship); return(result); } return(null); } }
public void accept(AreaConnectionRelationship rel) { // Mark a connection between two areas here // The actual connections are built after all the relationships are added addArea(rel.firstAreaName); addArea(rel.secondAreaName); if (!rel.locked) { if (!_areaConnections[rel.firstAreaName].Contains(rel.secondAreaName)) { _areaConnections[rel.firstAreaName].Add(rel.secondAreaName); } } else { // Handle locked connections. if (!_lockedAreaConnections[rel.firstAreaName].Contains(rel)) { _lockedAreaConnections[rel.firstAreaName].Add(rel); } _itemNames.Add(rel.keyName); } }