Esempio n. 1
0
        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;

            }
        }
Esempio n. 2
0
 public Area(string name, IAreaConnector input)
     : base(new List<BuildingBlock>())
 {
     _name = name;
     _boundBuildingBlock = null;
     _inputs = new List<IAreaConnector>() {input};
 }
Esempio n. 3
0
 public Area(string name, IAreaConnector input) : base(new List <BuildingBlock>())
 {
     _name = name;
     _boundBuildingBlock = null;
     _inputs             = new List <IAreaConnector>()
     {
         input
     };
 }
Esempio n. 4
0
        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);
            }
        }
Esempio n. 5
0
 public AreaConnectionRelationship makeConnection(IAreaConnector otherArea)
 {
     return new AreaConnectionRelationship(_name, otherArea.Name());
 }
Esempio n. 6
0
 public AreaConnectionRelationship makeConnection(IAreaConnector otherArea)
 {
     return(new AreaConnectionRelationship(_name, otherArea.Name()));
 }
Esempio n. 7
0
 public puzzlegen.relationship.AreaConnectionRelationship makeConnection(IAreaConnector otherArea)
 {
     return(new StartAreaRelationship(otherArea.Name()));
 }
Esempio n. 8
0
 public AreaConnectionRelationship makeConnection(IAreaConnector otherArea)
 {
     return(new AreaConnectionRelationship(_connectingArea.name, otherArea.Name(), true, _keyName, _keyInput.outputSpawnIndex()));
 }
Esempio n. 9
0
 public AreaConnectionRelationship makeConnection(IAreaConnector otherArea)
 {
     return new AreaConnectionRelationship(_connectingArea.name, otherArea.Name(), true, _keyName, _keyInput.outputSpawnIndex());
 }