// Main processing function that processes this component and // it's children public IEnumerator Process() { Debug.Assert(GetAwaitingInputs() == 0); _isProcessing = true; NewShipComponentOutput[] outputs = InnerProcess(); // Bit of a hack - used so animations will start to change before calculating them. if (this is NewGraphicalShipComponent) { yield return(new WaitForSeconds(0.1f)); } yield return(new WaitForSeconds(GetProcessingDelay())); foreach (NewShipComponentOutput output in outputs) { output.Send(); NewShipComponent child = output.component; if (child.GetAwaitingInputs() == 0) { StartCoroutine(child.Process()); } } _isProcessing = false; }
protected void Awake() { _isProcessing = false; // Define inputs and outputs outputs = new NewShipComponentOutput[children.Length]; for (int i = 0; i < children.Length; i++) { NewShipComponent child = children[i]; outputs[i] = new NewShipComponentOutput(child); } ElementTypes[][] possibleInputTypes = DefineInputs(); inputs = new NewShipComponentInput[possibleInputTypes.Length]; for (int i = 0; i < possibleInputTypes.Length; i++) { inputs[i] = new NewShipComponentInput(possibleInputTypes[i]); } }
public NewShipComponentOutput(NewShipComponent comp) { this._component = comp; // Dummy value - means the index is not set inputIndex = -1; }
void Awake() { relComponent = GetComponent <NewShipComponent>(); isTextual = (relComponent is NewTextualShipComponent); }