//============================================================================// #if UNITY_EDITOR // INITIALIZE // // override public void Initialize(BaseStack theOwnerStack, AmpsBlueprint theOwnerBlueprint) { base.Initialize(theOwnerStack, theOwnerBlueprint); samplerCondition = ScriptableObject.CreateInstance <DropdownProperty>(); samplerCondition.Initialize("Sample condition", 0, theOwnerBlueprint); AddProperty(samplerCondition, true); sampleOnSpawn = ScriptableObject.CreateInstance <BoolProperty>(); sampleOnSpawn.Initialize("Sample on spawn?", true, theOwnerBlueprint); AddProperty(sampleOnSpawn, true); interval = ScriptableObject.CreateInstance <ScalarProperty>(); interval.Initialize("Interval", 1, theOwnerBlueprint); interval.SetDataModes(true, false, false, false, true, true); AddProperty(interval, true); intervalOffset = ScriptableObject.CreateInstance <ScalarProperty>(); intervalOffset.Initialize("Initial delay", 0, theOwnerBlueprint); intervalOffset.SetDataModes(true, false, false, false, true, true); AddProperty(intervalOffset, true); directValue = ScriptableObject.CreateInstance <ScalarProperty>(); directValue.Initialize("Direct value", 0, theOwnerBlueprint); directValue.SetDataModes(false, false, true, true, true, true); AddProperty(directValue, true); System.Random theRandom = new System.Random(); randomSeed = theRandom.Next(1, 65536); }
//============================================================================// #if UNITY_EDITOR // INITIALIZE // // override public void Initialize(BaseStack theOwnerStack, AmpsBlueprint theOwnerBlueprint) { base.Initialize(theOwnerStack, theOwnerBlueprint); subMenuName = ""; type = "Quad renderer"; SetDefaultName(); orientation = ScriptableObject.CreateInstance <DropdownProperty>(); orientation.Initialize("Orientation", 1, theOwnerBlueprint); AddProperty(orientation, false); alignmentVector = ScriptableObject.CreateInstance <VectorProperty>(); alignmentVector.Initialize("Alignment vector", new Vector4(0, 1, 0, 0), theOwnerBlueprint); alignmentVector.hideW = true; AddProperty(alignmentVector, false); normalMode = ScriptableObject.CreateInstance <DropdownProperty>(); normalMode.Initialize("Normal mode", 0, theOwnerBlueprint); AddProperty(normalMode, false); tangentMode = ScriptableObject.CreateInstance <DropdownProperty>(); tangentMode.Initialize("Tangent mode", 0, theOwnerBlueprint); AddProperty(tangentMode, false); uv2Mode = ScriptableObject.CreateInstance <DropdownProperty>(); uv2Mode.Initialize("UV2 mode", 0, theOwnerBlueprint); AddProperty(uv2Mode, false); isDoubleSided = ScriptableObject.CreateInstance <BoolProperty>(); isDoubleSided.Initialize("Double sided?", false, theOwnerBlueprint); AddProperty(isDoubleSided, false); doubleSidedColorMode = ScriptableObject.CreateInstance <DropdownProperty>(); doubleSidedColorMode.Initialize("Backside color mode", 0, theOwnerBlueprint); AddProperty(doubleSidedColorMode, false); }
//============================================================================// #if UNITY_EDITOR // INITALIZE // // override public void Initialize(BaseStack theOwnerStack, AmpsBlueprint theOwnerBlueprint) { base.Initialize(theOwnerStack, theOwnerBlueprint); subMenuName = AmpsHelpers.formatEnumString(eCategories.Basic.ToString()); type = "Scalar condition"; SetDefaultName(); useStackValue = ScriptableObject.CreateInstance <BoolProperty>(); useStackValue.Initialize("Use stack value?", true, theOwnerBlueprint); AddProperty(useStackValue, true); valueA = ScriptableObject.CreateInstance <ScalarProperty>(); valueA.Initialize("Value A", 0f, theOwnerBlueprint); AddProperty(valueA, true); condition = ScriptableObject.CreateInstance <DropdownProperty>(); condition.Initialize("Condition", 0, theOwnerBlueprint); condition.SetDataModes(true, false, false, false, false, false); AddProperty(condition, false); valueB = ScriptableObject.CreateInstance <ScalarProperty>(); valueB.Initialize("Value B", 1f, theOwnerBlueprint); AddProperty(valueB, true); valueFalse = ScriptableObject.CreateInstance <ScalarProperty>(); valueFalse.Initialize("Output for FALSE", 1f, theOwnerBlueprint); AddProperty(valueFalse, true); valueTrue = ScriptableObject.CreateInstance <ScalarProperty>(); valueTrue.Initialize("Output for TRUE", 1f, theOwnerBlueprint); AddProperty(valueTrue, true); }
//============================================================================// #region GUI // SHOW PROPERTIES // // override public void ShowProperties(ref bool shouldRepaint) { base.ShowProperties(ref shouldRepaint); BaseProperty previousSelection = selectedProperty; PropertyGroup("Mesh"); sampledMesh.ShowProperty(ref selectedProperty, false); if (sampledMeshElement.displayData == null) { sampledMeshElement.displayData = () => meshElementsDisplayData; // We have to do this here because delegates are not serialized. } sampledMeshElement.ShowProperty(ref selectedProperty, false); if (samplingOrder.displayData == null) { samplingOrder.displayData = () => samplingOrderDisplayData; // We have to do this here because delegates are not serialized. } samplingOrder.ShowProperty(ref selectedProperty, false); if (isEmitterRelative == null) // HACK { isEmitterRelative = ScriptableObject.CreateInstance <BoolProperty>(); isEmitterRelative.Initialize("Emitter relative?", ownerBlueprint); AddProperty(isEmitterRelative, true); } isEmitterRelative.ShowProperty(ref selectedProperty, false); if (selectedProperty != previousSelection) { shouldRepaint = true; } }
//============================================================================// #if UNITY_EDITOR // INITIALIZE // // override public void Initialize(BaseStack theOwnerStack, AmpsBlueprint theOwnerBlueprint) { base.Initialize(theOwnerStack, theOwnerBlueprint); subMenuName = AmpsHelpers.formatEnumString(eCategories.Basic.ToString()); type = "Property sampler"; SetDefaultName(); property = ScriptableObject.CreateInstance <DropdownProperty>(); property.Initialize("Property", 0, theOwnerBlueprint); AddProperty(property, true); sampleFromParent = ScriptableObject.CreateInstance <BoolProperty>(); sampleFromParent.Initialize("Sample parent?", false, property.ownerBlueprint); AddProperty(sampleFromParent, true); modifyX = ScriptableObject.CreateInstance <BoolProperty>(); modifyX.Initialize("Modify X?", true, theOwnerBlueprint); AddProperty(modifyX, true); modifyY = ScriptableObject.CreateInstance <BoolProperty>(); modifyY.Initialize("Modify Y?", true, theOwnerBlueprint); AddProperty(modifyY, true); modifyZ = ScriptableObject.CreateInstance <BoolProperty>(); modifyZ.Initialize("Modify Z?", true, theOwnerBlueprint); AddProperty(modifyZ, true); modifyW = ScriptableObject.CreateInstance <BoolProperty>(); modifyW.Initialize("Modify W?", true, theOwnerBlueprint); AddProperty(modifyW, true); }
// COPY PROPERTY // // override public void CopyProperty(BaseProperty originalProperty, AmpsBlueprint theOwnerBlueprint) { base.CopyProperty(originalProperty, theOwnerBlueprint); BoolProperty originalBoolProperty = originalProperty as BoolProperty; value = originalBoolProperty.value; }
//============================================================================// #if UNITY_EDITOR // INITIALIZE // // override public void Initialize(BaseStack theOwnerStack, AmpsBlueprint theOwnerBlueprint) { base.Initialize(theOwnerStack, theOwnerBlueprint); modifySpawnRate = ScriptableObject.CreateInstance <BoolProperty>(); modifySpawnRate.Initialize("Modify Spawn rate?", false, theOwnerBlueprint); modifySpawnRate.allowDataModeReference = false; AddProperty(modifySpawnRate, false); modifyDeathCondition = ScriptableObject.CreateInstance <BoolProperty>(); modifyDeathCondition.Initialize("Modify Death condition?", false, theOwnerBlueprint); modifyDeathCondition.allowDataModeReference = false; AddProperty(modifyDeathCondition, false); modifyDeathDuration = ScriptableObject.CreateInstance <BoolProperty>(); modifyDeathDuration.Initialize("Modify Death duration?", false, theOwnerBlueprint); modifyDeathDuration.allowDataModeReference = false; AddProperty(modifyDeathDuration, false); modifyCustomScalar = ScriptableObject.CreateInstance <BoolProperty>(); modifyCustomScalar.Initialize("Modify Custom scalar?", false, theOwnerBlueprint); modifyCustomScalar.allowDataModeReference = false; AddProperty(modifyCustomScalar, false); modifyCustomVector = ScriptableObject.CreateInstance <BoolProperty>(); modifyCustomVector.Initialize("Modify Custom vector?", false, theOwnerBlueprint); modifyCustomVector.allowDataModeReference = false; AddProperty(modifyCustomVector, false); modifyAcceleration = ScriptableObject.CreateInstance <BoolProperty>(); modifyAcceleration.Initialize("Modify Acceleration?", false, theOwnerBlueprint); modifyAcceleration.allowDataModeReference = false; AddProperty(modifyAcceleration, false); modifyVelocity = ScriptableObject.CreateInstance <BoolProperty>(); modifyVelocity.Initialize("Modify Velocity?", false, theOwnerBlueprint); modifyVelocity.allowDataModeReference = false; AddProperty(modifyVelocity, false); modifyPosition = ScriptableObject.CreateInstance <BoolProperty>(); modifyPosition.Initialize("Modify Position?", false, theOwnerBlueprint); modifyPosition.allowDataModeReference = false; AddProperty(modifyPosition, false); modifyRotationRate = ScriptableObject.CreateInstance <BoolProperty>(); modifyRotationRate.Initialize("Modify Rotation rate?", false, theOwnerBlueprint); modifyRotationRate.allowDataModeReference = false; AddProperty(modifyRotationRate, false); modifyRotation = ScriptableObject.CreateInstance <BoolProperty>(); modifyRotation.Initialize("Modify Rotation?", false, theOwnerBlueprint); modifyRotation.allowDataModeReference = false; AddProperty(modifyRotation, false); modifyScale = ScriptableObject.CreateInstance <BoolProperty>(); modifyScale.Initialize("Modify Scale?", false, theOwnerBlueprint); modifyScale.allowDataModeReference = false; AddProperty(modifyScale, false); modifyColor = ScriptableObject.CreateInstance <BoolProperty>(); modifyColor.Initialize("Modify Color?", false, theOwnerBlueprint); modifyColor.allowDataModeReference = false; AddProperty(modifyColor, false); modifyPivotOffset = ScriptableObject.CreateInstance <BoolProperty>(); modifyPivotOffset.Initialize("Modify Pivot offset?", false, theOwnerBlueprint); modifyPivotOffset.allowDataModeReference = false; AddProperty(modifyPivotOffset, false); }
//============================================================================// #if UNITY_EDITOR // INITIALIZE // // override public void Initialize(BaseStack theOwnerStack, AmpsBlueprint theOwnerBlueprint) { base.Initialize(theOwnerStack, theOwnerBlueprint); subMenuName = AmpsHelpers.formatEnumString(eCategories.Misc.ToString()); type = "Event listener"; SetDefaultName(); eventName = ScriptableObject.CreateInstance <StringProperty>(); eventName.Initialize("Event name", theOwnerBlueprint); eventName.value = "event"; eventName.SetDataModes(true, false, false, false, false, false); AddProperty(eventName, false); untriggeredValue = ScriptableObject.CreateInstance <VectorProperty>(); untriggeredValue.Initialize("Untriggered value", theOwnerBlueprint); AddProperty(untriggeredValue, false); triggeredCustomValue = ScriptableObject.CreateInstance <VectorProperty>(); triggeredCustomValue.Initialize("Triggered value", theOwnerBlueprint); triggeredCustomValue.constant = new Vector4(1, 0, 0, 0); AddProperty(triggeredCustomValue, false); triggerDataMode = ScriptableObject.CreateInstance <DropdownProperty>(); triggerDataMode.Initialize("Trigger data mode", 0, theOwnerBlueprint); triggerDataMode.SetDataModes(true, false, false, false, false, false); AddProperty(triggerDataMode, false); infiniteTriggerCount = ScriptableObject.CreateInstance <BoolProperty>(); infiniteTriggerCount.Initialize("Infinite trigger count?", theOwnerBlueprint); infiniteTriggerCount.value = true; infiniteTriggerCount.SetDataModes(true, false, false, false, false, false); AddProperty(infiniteTriggerCount, false); maxTriggerCount = ScriptableObject.CreateInstance <ScalarProperty>(); maxTriggerCount.Initialize("Max trigger count per loop", 1f, theOwnerBlueprint); maxTriggerCount.SetDataModes(true, false, false, false, false, false); maxTriggerCount.isInteger = true; AddProperty(maxTriggerCount, false); triggerToggle = ScriptableObject.CreateInstance <BoolProperty>(); triggerToggle.Initialize("Does an event toggle?", theOwnerBlueprint); triggerToggle.value = true; triggerToggle.SetDataModes(true, false, false, false, false, false); AddProperty(triggerToggle, false); triggerDuration = ScriptableObject.CreateInstance <ScalarProperty>(); triggerDuration.Initialize("Trigger duration", 1f, theOwnerBlueprint); triggerDuration.SetDataModes(true, true, false, false, false, false); AddProperty(triggerDuration, false); }
//============================================================================// #if UNITY_EDITOR // INITIALIZE // // override public void Initialize(BaseStack theOwnerStack, AmpsBlueprint theOwnerBlueprint) { base.Initialize(theOwnerStack, theOwnerBlueprint); subMenuName = AmpsHelpers.formatEnumString(eCategories.Misc.ToString()); type = "Child control"; SetDefaultName(); value = ScriptableObject.CreateInstance <ScalarProperty>(); value.Initialize("Value", 0f, theOwnerBlueprint); value.SetDataModes(true, false, false, false, false, false); AddProperty(value, false); condition = ScriptableObject.CreateInstance <DropdownProperty>(); condition.Initialize("Condition", 0, theOwnerBlueprint); condition.SetDataModes(true, false, false, false, false, false); AddProperty(condition, false); useCurrentStack = ScriptableObject.CreateInstance <BoolProperty>(); useCurrentStack.Initialize("Current stack?", theOwnerBlueprint); useCurrentStack.value = true; useCurrentStack.SetDataModes(true, false, false, false, false, false); AddProperty(useCurrentStack, false); property = ScriptableObject.CreateInstance <DropdownProperty>(); property.Initialize("Property", 0, theOwnerBlueprint); property.SetDataModes(true, false, false, false, false, false); AddProperty(property, false); propertyVectorComponent = ScriptableObject.CreateInstance <DropdownProperty>(); propertyVectorComponent.Initialize("Component", 0, theOwnerBlueprint); propertyVectorComponent.SetDataModes(true, false, false, false, false, false); AddProperty(propertyVectorComponent, false); action = ScriptableObject.CreateInstance <DropdownProperty>(); action.Initialize("Action", 0, theOwnerBlueprint); action.SetDataModes(true, false, false, false, false, false); AddProperty(action, false); maxEventCount = ScriptableObject.CreateInstance <ScalarProperty>(); maxEventCount.Initialize("Max event count per loop", 1f, theOwnerBlueprint); maxEventCount.SetDataModes(true, false, false, false, false, false); maxEventCount.isInteger = true; AddProperty(maxEventCount, false); minEventDelay = ScriptableObject.CreateInstance <ScalarProperty>(); minEventDelay.Initialize("Min event delay", 0.1f, theOwnerBlueprint); minEventDelay.SetDataModes(true, false, false, false, false, false); AddProperty(minEventDelay, false); }
//============================================================================// #if UNITY_EDITOR // INITIALIZE // // override public void Initialize(BaseStack theOwnerStack, AmpsBlueprint theOwnerBlueprint) { base.Initialize(theOwnerStack, theOwnerBlueprint); subMenuName = ""; type = "Motion tweaker"; SetDefaultName(); modifyAcceleration.value = true; modifyVelocity.value = true; modifyMomentum = ScriptableObject.CreateInstance <BoolProperty>(); modifyMomentum.Initialize("Modify momentum?", true, theOwnerBlueprint); modifyMomentum.allowDataModeReference = false; AddProperty(modifyMomentum, false); modifyDisplacement = ScriptableObject.CreateInstance <BoolProperty>(); modifyDisplacement.Initialize("Modify displacement?", true, theOwnerBlueprint); modifyDisplacement.allowDataModeReference = false; AddProperty(modifyDisplacement, false); accelerationMultiplier = ScriptableObject.CreateInstance <VectorProperty>(); accelerationMultiplier.Initialize("Acceleration multiplier", Vector4.one, theOwnerBlueprint); accelerationMultiplier.coordSystemConversionMode = BaseProperty.eCoordSystemConversionMode.NoConversion; accelerationMultiplier.allowDataModeReference = false; accelerationMultiplier.hideW = true; AddProperty(accelerationMultiplier, false); momentumMultiplier = ScriptableObject.CreateInstance <VectorProperty>(); momentumMultiplier.Initialize("Momentum multiplier", Vector4.one, theOwnerBlueprint); momentumMultiplier.coordSystemConversionMode = BaseProperty.eCoordSystemConversionMode.NoConversion; momentumMultiplier.allowDataModeReference = false; momentumMultiplier.hideW = true; AddProperty(momentumMultiplier, false); velocityMultiplier = ScriptableObject.CreateInstance <VectorProperty>(); velocityMultiplier.Initialize("Velocity multiplier", Vector4.one, theOwnerBlueprint); velocityMultiplier.coordSystemConversionMode = BaseProperty.eCoordSystemConversionMode.NoConversion; velocityMultiplier.allowDataModeReference = false; velocityMultiplier.hideW = true; AddProperty(velocityMultiplier, false); displacementMultiplier = ScriptableObject.CreateInstance <VectorProperty>(); displacementMultiplier.Initialize("Displacement multiplier", Vector4.one, theOwnerBlueprint); displacementMultiplier.coordSystemConversionMode = BaseProperty.eCoordSystemConversionMode.NoConversion; displacementMultiplier.allowDataModeReference = false; displacementMultiplier.hideW = true; AddProperty(displacementMultiplier, false); }
//============================================================================// #if UNITY_EDITOR // INITALIZE // // override public void Initialize(BaseStack theOwnerStack, AmpsBlueprint theOwnerBlueprint) { base.Initialize(theOwnerStack, theOwnerBlueprint); subMenuName = AmpsHelpers.formatEnumString(eCategories.Basic.ToString()); type = "Scalar accumulator"; SetDefaultName(); useStackValue = ScriptableObject.CreateInstance <BoolProperty>(); useStackValue.Initialize("Use stack value?", true, theOwnerBlueprint); AddProperty(useStackValue, true); changePerSecond = ScriptableObject.CreateInstance <ScalarProperty>(); changePerSecond.Initialize("Change per second", 1f, theOwnerBlueprint); AddProperty(changePerSecond, true); }
//============================================================================// #if UNITY_EDITOR // INITIALIZE // // override public void Initialize(BaseStack theOwnerStack, AmpsBlueprint theOwnerBlueprint) { base.Initialize(theOwnerStack, theOwnerBlueprint); type = "Basic setup"; emitterDuration = ScriptableObject.CreateInstance <ScalarProperty>(); emitterDuration.Initialize("Emitter duration", 5, theOwnerBlueprint); emitterDuration.SetDataModes(true, false, false, false, false, true); AddProperty(emitterDuration, false); isLooping = ScriptableObject.CreateInstance <BoolProperty>(); isLooping.SetDataModes(true, false, false, false, false, false); isLooping.Initialize("Looping?", true, theOwnerBlueprint); AddProperty(isLooping, false); maxParticles = ScriptableObject.CreateInstance <ScalarProperty>(); maxParticles.Initialize("Particle limit", 10, theOwnerBlueprint); maxParticles.SetDataModes(true, true, false, false, false, false); maxParticles.isInteger = true; AddProperty(maxParticles, false); updateRate = ScriptableObject.CreateInstance <ScalarProperty>(); updateRate.Initialize("Updates per second", 30, theOwnerBlueprint); updateRate.SetDataModes(true, false, false, false, false, false); AddProperty(updateRate, false); timeScale = ScriptableObject.CreateInstance <ScalarProperty>(); timeScale.Initialize("Time scale", 1, theOwnerBlueprint); timeScale.SetDataModes(true, false, false, false, false, false); AddProperty(timeScale, false); accelerationNoiseSmoothing = ScriptableObject.CreateInstance <ScalarProperty>(); accelerationNoiseSmoothing.Initialize("Accel. noise smoothing", 0.5f, theOwnerBlueprint); accelerationNoiseSmoothing.SetDataModes(true, false, false, false, false, false); AddProperty(accelerationNoiseSmoothing, false); playOnAwake = ScriptableObject.CreateInstance <BoolProperty>(); playOnAwake.SetDataModes(true, false, false, false, false, false); playOnAwake.Initialize("Plays on start?", true, theOwnerBlueprint); AddProperty(playOnAwake, false); pauseWhenUnseenDuration = ScriptableObject.CreateInstance <ScalarProperty>(); pauseWhenUnseenDuration.Initialize("Pause when unseen duration", 1, theOwnerBlueprint); pauseWhenUnseenDuration.SetDataModes(true, false, false, false, false, false); AddProperty(pauseWhenUnseenDuration, false); //canParentControlPlayback = ScriptableObject.CreateInstance<BoolProperty>(); //canParentControlPlayback.SetDataModes(true, false, false, false, false, false); //canParentControlPlayback.Initialize("Can parent control playback?", true, theOwnerBlueprint); //AddProperty(canParentControlPlayback, false); }
// GET VALUE // // public bool GetValue() { bool returnValue = false; #if UNITY_EDITOR CheckReferences(); #endif switch (dataMode) { case eDataMode.Constant: returnValue = value; break; case eDataMode.Reference: if (reference != null) { BoolProperty theReference = (BoolProperty)reference.property; returnValue = theReference.GetValue(); } break; case eDataMode.Parameter: if (wasParameterQueried == false) { parameter = ownerBlueprint.ownerEmitter.GetParameter(parameterName, AmpsHelpers.eParameterTypes.Bool); wasParameterQueried = true; } if (parameter != null) { returnValue = parameter.GetBoolValue(); } else { returnValue = value; } break; } return(returnValue); }
//============================================================================// #if UNITY_EDITOR // INITIALIZE // // override public void Initialize(BaseStack theOwnerStack, AmpsBlueprint theOwnerBlueprint) { base.Initialize(theOwnerStack, theOwnerBlueprint); subMenuName = AmpsHelpers.formatEnumString(eCategories.Shapes.ToString()); type = "Mesh sampler"; SetDefaultName(); sampledMesh = ScriptableObject.CreateInstance <MeshProperty>(); sampledMesh.Initialize("Mesh"); AddProperty(sampledMesh, true); sampledMeshElement = ScriptableObject.CreateInstance <DropdownProperty>(); sampledMeshElement.Initialize("Element", 0, theOwnerBlueprint); AddProperty(sampledMeshElement, true); samplingOrder = ScriptableObject.CreateInstance <DropdownProperty>(); samplingOrder.Initialize("Order", 0, theOwnerBlueprint); AddProperty(samplingOrder, true); isEmitterRelative = ScriptableObject.CreateInstance <BoolProperty>(); isEmitterRelative.Initialize("Emitter relative?", theOwnerBlueprint); AddProperty(isEmitterRelative, true); implementsVisualization = false; }
//============================================================================// #if UNITY_EDITOR // INITIALIZE // // override public void Initialize(BaseStack theOwnerStack, AmpsBlueprint theOwnerBlueprint) { base.Initialize(theOwnerStack, theOwnerBlueprint); subMenuName = AmpsHelpers.formatEnumString(eCategories.Misc.ToString()); type = "Info"; SetDefaultName(); label = ScriptableObject.CreateInstance <StringProperty>(); label.Initialize("=", theOwnerBlueprint); label.value = "n.a."; AddProperty(label, false); showCurrentStack = ScriptableObject.CreateInstance <BoolProperty>(); showCurrentStack.Initialize("Show current stack value?", theOwnerBlueprint); showCurrentStack.value = true; showCurrentStack.SetDataModes(true, false, false, false, false, false); AddProperty(showCurrentStack, false); property = ScriptableObject.CreateInstance <DropdownProperty>(); property.Initialize("Property", 0, theOwnerBlueprint); AddProperty(property, true); }