Пример #1
0
        public override void SetDefaultValues(BehaviorDefaultValues data)
        {
            weightMult = 1;
            timeSpeed  = 1;

            uniformEffectTime = 0;
            weight            = 0;
            isOnOneCharacter  = false;

            enabled = false;


            void AssignValues(PresetBehaviorValues result)
            {
                float showDuration = 0;

                emissionControl = result.emission;

                enabled = PresetAppearance.SetPreset(
                    false,
                    result,
                    ref movement,
                    ref showDuration,
                    ref rotation,
                    ref scale,
                    ref rotationQua,
                    ref hasTransformEffects,
                    ref setColor,
                    ref colorCurve);

                emissionControl.Initialize(showDuration);
            }

            PresetBehaviorValues values;

            //searches for local presets first, which override global presets
            if (TAnimBuilder.GetPresetFromArray(effectTag, data.presets, out values))
            {
                AssignValues(values);
                return;
            }

            //global presets
            if (TAnimBuilder.TryGetGlobalPresetBehavior(effectTag, out values))
            {
                AssignValues(values);
                return;
            }
        }
Пример #2
0
        public override void SetDefaultValues(BehaviorDefaultValues data)
        {
            int GetPresetIndex()
            {
                for (int i = 0; i < data.presets.Length; i++)
                {
                    if (data.presets[i].effectTag == effectTag)
                    {
                        return(i);
                    }
                }
                return(-1);
            }

            weightMult = 1;
            timeSpeed  = 1;

            uniformEffectTime = 0;
            weight            = 0;
            isOnOneCharacter  = false;

            int presetIndex = GetPresetIndex();

            if (presetIndex >= 0) //found preset
            {
                data.presets[presetIndex].Initialize();

                emissionControl = data.presets[presetIndex].emission;

                movementVec = Vector3.zero;

                setMovement = data.presets[presetIndex].movementX.enabled || data.presets[presetIndex].movementY.enabled || data.presets[presetIndex].movementZ.enabled;
                if (setMovement)
                {
                    movementX = data.presets[presetIndex].movementX;
                    movementY = data.presets[presetIndex].movementY;
                    movementZ = data.presets[presetIndex].movementZ;
                }

                scaleVec = Vector3.one;
                setScale = data.presets[presetIndex].scaleX.enabled || data.presets[presetIndex].scaleY.enabled;
                if (setScale)
                {
                    scaleX = data.presets[presetIndex].scaleX;
                    scaleY = data.presets[presetIndex].scaleY;

                    scaleVec.z = 1;
                }

                setRotation = data.presets[presetIndex].rotX.enabled || data.presets[presetIndex].rotY.enabled || data.presets[presetIndex].rotZ.enabled;
                rotationQua = Quaternion.identity;
                if (setRotation)
                {
                    rotX = data.presets[presetIndex].rotX;
                    rotY = data.presets[presetIndex].rotY;
                    rotZ = data.presets[presetIndex].rotZ;
                }

                hasTransformEffects = setMovement || setRotation || setScale;

                setColor = data.presets[presetIndex].color.enabled;
                if (setColor)
                {
                    colorCurve = data.presets[presetIndex].color;
                    colorCurve.Initialize();
                }

                enabled = hasTransformEffects || setColor;
            }
        }
 public PresetBehaviorValues() : base(false)
 {
     emission = new EmissionControl(false);
 }