//============================================================================// #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 // INITIALIZE // // override public void Initialize(BaseStack theOwnerStack, AmpsBlueprint theOwnerBlueprint) { base.Initialize(theOwnerStack, theOwnerBlueprint); subMenuName = AmpsHelpers.formatEnumString(eCategories.Basic.ToString()); type = "Vector sampler"; SetDefaultName(); vector = ScriptableObject.CreateInstance <VectorProperty>(); vector.Initialize("Vector", Vector4.zero, theOwnerBlueprint); vector.coordSystemConversionMode = BaseProperty.eCoordSystemConversionMode.NoConversion; AddProperty(vector, true); }
//============================================================================// #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.Shapes.ToString()); type = "Point sampler"; SetDefaultName(); point = ScriptableObject.CreateInstance <VectorProperty>(); point.Initialize("Point", Vector4.zero, theOwnerBlueprint); point.coordSystemConversionMode = BaseProperty.eCoordSystemConversionMode.AsPosition; implementsVisualization = true; AddProperty(point, true); }
//============================================================================// #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 // INITIALIZE // // override public void Initialize(BaseStack theOwnerStack, AmpsBlueprint theOwnerBlueprint) { base.Initialize(theOwnerStack, theOwnerBlueprint); subMenuName = AmpsHelpers.formatEnumString(eCategories.Basic.ToString()); type = "Vector"; SetDefaultName(); value = ScriptableObject.CreateInstance <VectorProperty>(); value.Initialize("Value", Vector4.zero, theOwnerBlueprint); value.SetConversionMode(theOwnerStack.stackFunction); value.SetDefaultCoordSystem(theOwnerStack.stackFunction); AddProperty(value, true); implementsVisualization = true; }
//============================================================================// #if UNITY_EDITOR // INITIALIZE // // override public void Initialize(BaseStack theOwnerStack, AmpsBlueprint theOwnerBlueprint) { base.Initialize(theOwnerStack, theOwnerBlueprint); subMenuName = AmpsHelpers.formatEnumString(eCategories.OtherObjects.ToString()); type = "Volume sampler"; SetDefaultName(); sampledObject = ScriptableObject.CreateInstance <GameObjectProperty>(); sampledObject.Initialize("Object", null, theOwnerBlueprint); sampledObject.SetDataModes(false, false, false, false, false, true); AddProperty(sampledObject, false); insideValue = ScriptableObject.CreateInstance <VectorProperty>(); insideValue.Initialize("Value if inside", Vector4.one, theOwnerBlueprint); insideValue.SetConversionMode(theOwnerStack.stackFunction); insideValue.SetDefaultCoordSystem(theOwnerStack.stackFunction); AddProperty(insideValue, true); outsideValue = ScriptableObject.CreateInstance <VectorProperty>(); outsideValue.Initialize("Value if outside", Vector4.one, theOwnerBlueprint); outsideValue.SetConversionMode(theOwnerStack.stackFunction); outsideValue.SetDefaultCoordSystem(theOwnerStack.stackFunction); AddProperty(outsideValue, true); implementsVisualization = false; }
//============================================================================// #if UNITY_EDITOR // INITIALIZE // // override public void Initialize(BaseStack theOwnerStack, AmpsBlueprint theOwnerBlueprint) { base.Initialize(theOwnerStack, theOwnerBlueprint); subMenuName = ""; type = "Quick setup"; SetDefaultName(); modifySpawnRate.value = true; modifyDeathCondition.value = true; modifyAcceleration.value = true; modifyVelocity.value = true; modifyPosition.value = true; modifyRotationRate.value = true; modifyRotation.value = true; modifyScale.value = true; modifyColor.value = true; modifyPivotOffset.value = true; spawnRate = ScriptableObject.CreateInstance <ScalarProperty>(); spawnRate.Initialize("Spawn rate", 5, theOwnerBlueprint); spawnRate.allowDataModeReference = false; AddProperty(spawnRate, false); deathCondition = ScriptableObject.CreateInstance <ScalarProperty>(); deathCondition.Initialize("Death condition", 0, theOwnerBlueprint); deathCondition.allowDataModeReference = false; deathCondition.dataMode = BaseProperty.eDataMode.Curve; deathCondition.curve.curveInput = AmpsHelpers.eCurveInputs.ParticleTime; deathCondition.curve.inputRangeMin = 0; deathCondition.curve.inputRangeMax = 2; // Default lifetime. deathCondition.curve.curve.AddKey(0, 0); deathCondition.curve.curve.AddKey(1, 1); deathCondition.curve.outputRangeMin = 0; deathCondition.curve.outputRangeMax = 1; AddProperty(deathCondition, false); acceleration = ScriptableObject.CreateInstance <VectorProperty>(); acceleration.Initialize("Acceleration", new Vector4(0, -0.1f, 0, 0), theOwnerBlueprint); acceleration.allowDataModeReference = false; acceleration.coordSystemConversionMode = BaseProperty.eCoordSystemConversionMode.AsVelocity; acceleration.usePerComponentRandom = true; acceleration.hideW = true; AddProperty(acceleration, false); velocity = ScriptableObject.CreateInstance <VectorProperty>(); velocity.Initialize("Velocity min", new Vector4(0, 0, 0, 0), theOwnerBlueprint); velocity.allowDataModeReference = false; velocity.coordSystemConversionMode = BaseProperty.eCoordSystemConversionMode.AsVelocity; velocity.hideW = true; velocity.usePerComponentRandom = true; velocity.dataMode = BaseProperty.eDataMode.RandomConstant; velocity.randomMin = new Vector4(-1, 1, -1, 0); velocity.randomMax = new Vector4(1, 2, 1, 0); AddProperty(velocity, false); position = ScriptableObject.CreateInstance <VectorProperty>(); position.Initialize("Position", new Vector4(0, 0, 0, 0), theOwnerBlueprint); position.allowDataModeReference = false; position.coordSystemConversionMode = BaseProperty.eCoordSystemConversionMode.AsPosition; position.coordSystem = AmpsHelpers.eCoordSystems.Emitter; position.hideW = true; position.usePerComponentRandom = true; AddProperty(position, false); rotationRate = ScriptableObject.CreateInstance <VectorProperty>(); rotationRate.Initialize("Rotation rate", new Vector4(0, 0, 0, 0), theOwnerBlueprint); rotationRate.allowDataModeReference = false; rotationRate.coordSystemConversionMode = BaseProperty.eCoordSystemConversionMode.AsVelocity; rotationRate.hideW = true; rotationRate.usePerComponentRandom = true; AddProperty(rotationRate, false); rotation = ScriptableObject.CreateInstance <VectorProperty>(); rotation.Initialize("Rotation", new Vector4(0, 0, 0, 0), theOwnerBlueprint); rotation.allowDataModeReference = false; rotation.coordSystemConversionMode = BaseProperty.eCoordSystemConversionMode.AsRotation; rotation.coordSystem = AmpsHelpers.eCoordSystems.Emitter; rotation.hideW = true; rotation.usePerComponentRandom = true; AddProperty(rotation, false); scale = ScriptableObject.CreateInstance <VectorProperty>(); scale.Initialize("Scale", new Vector4(0.2f, 0.2f, 0.2f, 0), theOwnerBlueprint); scale.allowDataModeReference = false; scale.coordSystemConversionMode = BaseProperty.eCoordSystemConversionMode.AsScale; scale.coordSystem = AmpsHelpers.eCoordSystems.Emitter; scale.usePerComponentRandom = false; scale.hideW = true; AddProperty(scale, false); color = ScriptableObject.CreateInstance <ColorProperty>(); color.Initialize("Color", new Vector4(1, 0.5f, 0.25f, 1), theOwnerBlueprint); color.allowDataModeReference = false; color.usePerComponentRandom = false; AddProperty(color, false); pivotOffset = ScriptableObject.CreateInstance <VectorProperty>(); pivotOffset.Initialize("Pivot offset", new Vector4(0, 0, 0, 0), theOwnerBlueprint); pivotOffset.allowDataModeReference = false; pivotOffset.coordSystemConversionMode = BaseProperty.eCoordSystemConversionMode.AsPosition; pivotOffset.hideW = true; pivotOffset.usePerComponentRandom = true; AddProperty(pivotOffset, false); }
//============================================================================// #region GUI // SHOW PROPERTIES // // override public void ShowProperties(ref bool shouldRepaint) { base.ShowProperties(ref shouldRepaint); BaseProperty previousSelection = selectedProperty; PropertyGroup(""); if (orientation.displayData == null) { orientation.displayData = () => orientationDisplayData; // We have to do this here because delegates are not serialized. } orientation.ShowProperty(ref selectedProperty, false); if (alignmentVector == null) // HACK { alignmentVector = ScriptableObject.CreateInstance <VectorProperty>(); alignmentVector.Initialize("Alignment vector", new Vector4(0, 1, 0, 0), ownerBlueprint); alignmentVector.hideW = true; AddProperty(alignmentVector, false); } if (orientation.GetValue() == (int)eOrientation.VectorAlignedCameraFacing) { alignmentVector.ShowProperty(ref selectedProperty, false); } if (normalMode.displayData == null) { normalMode.displayData = () => normalModeDisplayData; // We have to do this here because delegates are not serialized. } normalMode.ShowProperty(ref selectedProperty, false); if (tangentMode.displayData == null) { tangentMode.displayData = () => tangentModeDisplayData; // We have to do this here because delegates are not serialized. } tangentMode.ShowProperty(ref selectedProperty, false); if (uv2Mode.displayData == null) { uv2Mode.displayData = () => uv2ModeDisplayData; // We have to do this here because delegates are not serialized. } uv2Mode.ShowProperty(ref selectedProperty, false); bool previousIsDoubleSided = isDoubleSided.GetValue(); isDoubleSided.ShowProperty(ref selectedProperty, false); bool currentIsDoubleSided = isDoubleSided.GetValue(); if (currentIsDoubleSided != previousIsDoubleSided) { ownerBlueprint.ownerEmitter.SoftReset(); } if (currentIsDoubleSided) { if (doubleSidedColorMode.displayData == null) { doubleSidedColorMode.displayData = () => doubleSidedColorModeDisplayData; // We have to do this here because delegates are not serialized. } doubleSidedColorMode.ShowProperty(ref selectedProperty, false); } if (selectedProperty != previousSelection) { shouldRepaint = true; } }