Пример #1
0
//============================================================================//
#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);
        }
Пример #2
0
//============================================================================//
#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);
        }
Пример #3
0
//============================================================================//
#if UNITY_EDITOR
        // INITIALIZE //
        //
        virtual public void Initialize(AmpsBlueprint theOwnerBlueprint, AmpsHelpers.eStackFunction theStackFunction, string theModuleType)
        {
            stackFunction  = theStackFunction;
            name           = AmpsHelpers.formatEnumString(theStackFunction.ToString());
            moduleType     = theModuleType;
            ownerBlueprint = theOwnerBlueprint;
        }
Пример #4
0
//============================================================================//
#if UNITY_EDITOR
        // INITALIZE //
        //
        override public void Initialize(BaseStack theOwnerStack, AmpsBlueprint theOwnerBlueprint)
        {
            base.Initialize(theOwnerStack, theOwnerBlueprint);

            subMenuName = AmpsHelpers.formatEnumString(eCategories.Math.ToString());
            type        = "Normalize";
            SetDefaultName();
        }
Пример #5
0
//============================================================================//
#if UNITY_EDITOR
        // INITALIZE //
        //
        override public void Initialize(BaseStack theOwnerStack, AmpsBlueprint theOwnerBlueprint)
        {
            base.Initialize(theOwnerStack, theOwnerBlueprint);

            subMenuName = AmpsHelpers.formatEnumString(eCategories.Basic.ToString());
            type        = "Scalar";
            SetDefaultName();

            value = ScriptableObject.CreateInstance <ScalarProperty>();
            value.Initialize("Value", 1f, theOwnerBlueprint);
            AddProperty(value, true);
        }
Пример #6
0
//============================================================================//
#if UNITY_EDITOR
        // INITALIZE //
        //
        override public void Initialize(BaseStack theOwnerStack, AmpsBlueprint theOwnerBlueprint)
        {
            base.Initialize(theOwnerStack, theOwnerBlueprint);

            subMenuName = AmpsHelpers.formatEnumString(eCategories.Math.ToString());
            type        = "Converter";
            SetDefaultName();

            conversionMode = ScriptableObject.CreateInstance <DropdownProperty>();
            conversionMode.Initialize("Conversion mode", 0, theOwnerBlueprint);
            AddProperty(conversionMode, true);
        }
Пример #7
0
//============================================================================//
#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);
        }
Пример #8
0
        //============================================================================//
#if UNITY_EDITOR
        // INITIALIZE //
        //
        override public void Initialize(BaseStack theOwnerStack, AmpsBlueprint theOwnerBlueprint)
        {
            base.Initialize(theOwnerStack, theOwnerBlueprint);

            subMenuName = AmpsHelpers.formatEnumString(eCategories.Basic.ToString());
            type        = "Color";
            SetDefaultName();

            value = ScriptableObject.CreateInstance <ColorProperty>();
            value.Initialize("Color", Vector4.one, theOwnerBlueprint);
            AddProperty(value, true);
            implementsVisualization = false;
        }
Пример #9
0
//============================================================================//
#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);
        }
Пример #10
0
//============================================================================//
#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);
        }
Пример #11
0
//============================================================================//
#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);
        }
Пример #12
0
//============================================================================//
#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;
        }
Пример #13
0
//============================================================================//
#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);
        }
Пример #14
0
//============================================================================//
#if UNITY_EDITOR
        // INITIALIZE //
        //
        override public void Initialize(BaseStack theOwnerStack, AmpsBlueprint theOwnerBlueprint)
        {
            base.Initialize(theOwnerStack, theOwnerBlueprint);

            subMenuName = AmpsHelpers.formatEnumString(eCategories.OtherObjects.ToString());
            type        = "Transform sampler";
            SetDefaultName();

            sampledObject = ScriptableObject.CreateInstance <GameObjectProperty>();
            sampledObject.Initialize("Object", null, theOwnerBlueprint);
            sampledObject.SetDataModes(false, false, false, false, false, true);
            AddProperty(sampledObject, false);
            sampledTransformElement = ScriptableObject.CreateInstance <DropdownProperty>();
            sampledTransformElement.Initialize("Transform", 0, theOwnerBlueprint);
            AddProperty(sampledTransformElement, true);
            implementsVisualization = false;
        }
Пример #15
0
        // SHOW OPTIONS //
        //
        public void ShowOptions()
        {
            GenericMenu propertyOptionsMenu = new GenericMenu();

            propertyOptionsMenu.AddItem(new GUIContent(AmpsHelpers.formatEnumString(AmpsHelpers.ePropertyOperations.Constant.ToString())),
                                        false,
                                        SetModeConstant);

            if (allowDataModeRandomConstant)
            {
                propertyOptionsMenu.AddItem(new GUIContent(AmpsHelpers.formatEnumString(AmpsHelpers.ePropertyOperations.Random.ToString())),
                                            false,
                                            SetModeRandom);
            }

            if (allowDataModeCurve)
            {
                propertyOptionsMenu.AddItem(new GUIContent(AmpsHelpers.formatEnumString(AmpsHelpers.ePropertyOperations.Curve.ToString())),
                                            false,
                                            SetModeCurve);
            }

            if (allowDataModeRandomCurve)
            {
                propertyOptionsMenu.AddItem(new GUIContent(AmpsHelpers.formatEnumString(AmpsHelpers.ePropertyOperations.RandomCurve.ToString())),
                                            false,
                                            SetModeRandomCurve);
            }

            if (allowDataModeReference)
            {
                propertyOptionsMenu.AddItem(new GUIContent(AmpsHelpers.formatEnumString(AmpsHelpers.ePropertyOperations.Reference.ToString())),
                                            false,
                                            SetModeReference);
            }

            if (allowDataModeParameter)
            {
                propertyOptionsMenu.AddItem(new GUIContent(AmpsHelpers.formatEnumString(AmpsHelpers.ePropertyOperations.Parameter.ToString())),
                                            false,
                                            SetModeParameter);
            }
            propertyOptionsMenu.ShowAsContext();
        }
Пример #16
0
        //============================================================================//
#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;
        }
Пример #17
0
//============================================================================//
#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);
        }
Пример #18
0
//============================================================================//
#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;
        }
Пример #19
0
        // SHOW MODULES //
        //
        public void ShowModules(out bool shouldRepaint)
        {
            shouldRepaint = false;
            AmpsHelpers.eModuleOperations moduleOperation;
            bool isInfoModulePresent = false;                   // A constantly updating info module makes debugging easier.

            if (modules.Count > 0)
            {
                if (selectedModule == null)
                {
                    selectedModule = modules[0];                                                // Deleting/replacing Blueprints can cause it to be null.
                }
                // We store current selection so we can tell if a module selected itself,
                // in which case we need to repaint the UI.
                BaseModule previousSelection = selectedModule;

                foreach (BaseModule m in modules)
                {
                    // We pass selectedModule so the module can switch draw styles if it recognizes
                    // itself, but can also change the selection to itself from inside.
                    // ModuleOperation is defined by which button the user clicked.
                    m.ShowModule(ref selectedModule, out moduleOperation);
                    switch (moduleOperation)
                    {
                    case AmpsHelpers.eModuleOperations.NoOperation:
                        break;

                    case AmpsHelpers.eModuleOperations.ShowOptions:
                        GenericMenu moduleOptionsMenu = new GenericMenu();
                        moduleOptionsMenu.AddItem(new GUIContent(AmpsHelpers.formatEnumString(AmpsHelpers.eModuleOperations.Duplicate.ToString())),
                                                  false,
                                                  DuplicateSelectedModule);
                        moduleOptionsMenu.AddSeparator("");
                        moduleOptionsMenu.AddItem(new GUIContent(AmpsHelpers.formatEnumString(AmpsHelpers.eModuleOperations.Remove.ToString())),
                                                  false,
                                                  RemoveSelectedModule);
                        moduleOptionsMenu.ShowAsContext();
                        break;

                    case AmpsHelpers.eModuleOperations.MoveUp:
                        MoveUpSelectedModule();
                        break;

                    case AmpsHelpers.eModuleOperations.MoveDown:
                        MoveDownSelectedModule();
                        break;
                    }

                    if (m.GetType() == typeof(InfoModule) && m.isEnabled)
                    {
                        isInfoModulePresent = true;
                    }
                }

                if (isInfoModulePresent)
                {
                    shouldRepaint = true;
                }

                if (selectedModule != previousSelection)
                {
                    shouldRepaint = true;
                    GUI.FocusControl(AmpsHelpers.stringControlName);
                }
            }
        }