public override void finishGroup() { base.finishGroup(); //find the master elevator, inject its elevator args into the other members of the group foreach (ElevatorBlock block in blocks) {//find master elevator if (!block.isConfiguredAsElevator) { continue; } if (masterBlock != null) { throw new System.Exception("multiple elevator blocks in group " + groupID); } masterBlock = block; } foreach (ElevatorBlock block in blocks) {//inject its elevator args if (block == masterBlock) { continue; } block.parseArgs(block.args + masterBlock.getElevatorArgs()); } }
public virtual void finishGroup() { //find the master elevator, inject its elevator args into the other members of the group ElevatorBlock masterBlock = null; foreach (ElevatorBlock block in blocks) {//find master elevator block.transform.parent = transform; if (!block.isConfiguredAsElevator) { continue; } block.resetElevator(); //so they can depart at same time if (masterBlock != null) { throw new System.Exception("multiple elevator blocks in group " + groupID); } masterBlock = block; } if (masterBlock == null) // no elevators in group { return; } List <ElevatorBlock> blockList = new List <ElevatorBlock>(); foreach (ElevatorBlock block in blocks) { blockList.Add(block); } foreach (ElevatorBlock block in blockList) {//inject its elevator args if (block == masterBlock) { continue; } string blockArgs = block.args + (block.args == "" ? "" : ",") + masterBlock.getElevatorArgs(); //Debug.Log("injecting " + blockArgs + " into block " + block + " master args: " + masterBlock.args); block.parseArgs(blockArgs); } }