protected void RunInteraction(bool onMove) { int parameterID = (onMove) ? moveParameterID : dropParameterID; switch (actionListSource) { case ActionListSource.InScene: Interaction interaction = (onMove) ? interactionOnMove : interactionOnDrop; if (interaction != null && gameObject.layer != LayerMask.NameToLayer(KickStarter.settingsManager.deactivatedLayer)) { if (!onMove || !KickStarter.actionListManager.IsListRunning(interaction)) { if (parameterID >= 0) { ActionParameter parameter = interaction.GetParameter(parameterID); if (parameter != null && parameter.parameterType == ParameterType.GameObject) { parameter.gameObject = gameObject; } } interaction.Interact(); } } break; case ActionListSource.AssetFile: ActionListAsset actionListAsset = (onMove) ? actionListAssetOnMove : actionListAssetOnDrop; if (actionListAsset != null && gameObject.layer != LayerMask.NameToLayer(KickStarter.settingsManager.deactivatedLayer)) { if (!onMove || !KickStarter.actionListAssetManager.IsListRunning(actionListAsset)) { if (parameterID >= 0) { ActionParameter parameter = actionListAsset.GetParameter(parameterID); if (parameter != null && parameter.parameterType == ParameterType.GameObject) { parameter.gameObject = gameObject; if (GetComponent <ConstantID>()) { parameter.intValue = GetComponent <ConstantID>().constantID; } else { ACDebug.LogWarning("Cannot set the value of parameter " + parameterID + " ('" + parameter.label + "') as " + gameObject.name + " has no Constant ID component.", gameObject); } } } actionListAsset.Interact(); } } break; } }
public void SetParameter(ActionListSource source, GameObject gameObject) { if (source == ActionListSource.InScene && cutscene != null) { if (cutscene.useParameters && parameterID >= 0 && cutscene.parameters.Count > parameterID) { ActionParameter parameter = cutscene.GetParameter(parameterID); if (parameter != null) { parameter.SetValue(gameObject); } } if (!pausesCharacter) { cutscene.Interact(); } } else if (source == ActionListSource.AssetFile && actionListAsset != null) { if (actionListAsset.useParameters && parameterID >= 0 && actionListAsset.parameters.Count > parameterID) { int idToSend = 0; if (gameObject.GetComponent <ConstantID>()) { idToSend = gameObject.GetComponent <ConstantID>().constantID; } else { ACDebug.LogWarning(gameObject.name + " requires a ConstantID script component!", gameObject); } ActionParameter parameter = actionListAsset.GetParameter(parameterID); if (parameter != null) { parameter.SetValue(idToSend); } } if (!pausesCharacter) { actionListAsset.Interact(); } } }