/// <summary> /// Find the FirstPersonInteractor in the world, and use it to activate /// the TwineNode's child at the given index. /// </summary> /// <param name="index">Index of the child to activate.</param> private void ActivateChildAtIndex(int index) { // Find the interactor: FirstPersonInteractor interactor = (FirstPersonInteractor) FindObjectOfType(typeof(FirstPersonInteractor)); if (interactor != null) { GameObject interactorObject = interactor.gameObject; // Now activate the child using this interactor! TwineNode child = this.children [index].GetComponent<TwineNode> (); child.Activate (interactorObject); } }
protected override void PerformAction() { foreach (GameObject twineNodeObject in associatedTwineNodeObjects) { TwineNode twineNode = twineNodeObject.GetComponent <TwineNode> (); if (twineNode != null) { // Activate the node! if (twineNode.Activate(this.rootInteractor)) { return; } } } }