private IEnumerator DelayedStart()
    {
        audioSource.volume = 0;
        yield return(new WaitForSeconds(4));

        volumeTween.Tween(audioSource.volume, normalVolume, 12, AnimationCurve.EaseInOut(0, 0, 1, 1));
    }
예제 #2
0
        internal TimelineClip CreateNewClipContainerInternal()
        {
            var clipContainer = new TimelineClip(this);

            clipContainer.asset = null;

            // position clip at end of sequence
            var newClipStart = 0.0;

            for (var a = 0; a < m_Clips.Count - 1; a++)
            {
                var clipDuration = m_Clips[a].duration;
                if (double.IsInfinity(clipDuration))
                {
                    clipDuration = TimelineClip.kDefaultClipDurationInSeconds;
                }
                newClipStart = Math.Max(newClipStart, m_Clips[a].start + clipDuration);
            }

            clipContainer.mixInCurve  = AnimationCurve.EaseInOut(0, 0, 1, 1);
            clipContainer.mixOutCurve = AnimationCurve.EaseInOut(0, 1, 1, 0);
            clipContainer.start       = newClipStart;
            clipContainer.duration    = TimelineClip.kDefaultClipDurationInSeconds;
            clipContainer.displayName = "untitled";
            return(clipContainer);
        }
예제 #3
0
        /// <summary>
        /// Constructor
        /// </summary>
        public P2DAbstractForceController(Transform xf, List <Rigidbody2D> bodies, AABB container)
            : base(ControllerType.WindController, xf, bodies, container)
        {
            Strength     = 1.0f;
            Position     = new Vector2(0, 0);
            MaximumSpeed = 100.0f;
            TimingMode   = WindType.Constant;
            ImpulseTime  = 0.0f;
            Variation    = 0.0f;
            Randomize    = new System.Random();
            DecayMode    = DecayMode.None;

            DecayStart = 0.0f;
            DecayEnd   = 0.0f;

            StrengthCurve = new AnimationCurve();
            StrengthCurve.AddKey(new Keyframe(0, 0));
            StrengthCurve.AddKey(new Keyframe(0.1f, -4));
            StrengthCurve.AddKey(new Keyframe(0.2f, 5));
            StrengthCurve.AddKey(new Keyframe(0.4f, 5));
            StrengthCurve.AddKey(new Keyframe(0.5f, 0));
            StrengthCurve.AddKey(new Keyframe(0.65f, -3));
            StrengthCurve.AddKey(new Keyframe(0.8f, 0));
            StrengthCurve.postWrapMode = WrapMode.Loop;

            DecayCurve = new AnimationCurve();
            DecayCurve = AnimationCurve.EaseInOut(0, 1, 10, 0);
        }
예제 #4
0
 // Token: 0x06000674 RID: 1652 RVA: 0x0001E610 File Offset: 0x0001C810
 public override void OnExit()
 {
     this.CreateBlinkEffect(base.transform.position);
     this.modelTransform = base.GetModelTransform();
     if (this.modelTransform)
     {
         TemporaryOverlay temporaryOverlay = this.modelTransform.gameObject.AddComponent <TemporaryOverlay>();
         temporaryOverlay.duration              = 0.6f;
         temporaryOverlay.animateShaderAlpha    = true;
         temporaryOverlay.alphaCurve            = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
         temporaryOverlay.destroyComponentOnEnd = true;
         temporaryOverlay.originalMaterial      = Resources.Load <Material>("Materials/matHuntressFlashBright");
         temporaryOverlay.AddToCharacerModel(this.modelTransform.GetComponent <CharacterModel>());
         TemporaryOverlay temporaryOverlay2 = this.modelTransform.gameObject.AddComponent <TemporaryOverlay>();
         temporaryOverlay2.duration              = 0.7f;
         temporaryOverlay2.animateShaderAlpha    = true;
         temporaryOverlay2.alphaCurve            = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
         temporaryOverlay2.destroyComponentOnEnd = true;
         temporaryOverlay2.originalMaterial      = Resources.Load <Material>("Materials/matHuntressFlashExpanded");
         temporaryOverlay2.AddToCharacerModel(this.modelTransform.GetComponent <CharacterModel>());
     }
     if (this.characterModel)
     {
         this.characterModel.invisibilityCount--;
     }
     if (this.hurtboxGroup)
     {
         HurtBoxGroup hurtBoxGroup = this.hurtboxGroup;
         int          hurtBoxesDeactivatorCounter = hurtBoxGroup.hurtBoxesDeactivatorCounter - 1;
         hurtBoxGroup.hurtBoxesDeactivatorCounter = hurtBoxesDeactivatorCounter;
     }
     base.OnExit();
 }
예제 #5
0
 private void AddEliteMaterials(On.RoR2.CharacterBody.orig_FixedUpdate orig, RoR2.CharacterBody self)
 {
     if (self.HasBuff(EliteBuffIndex) && !self.GetComponent <RadiantBuffTracker>())
     {
         var modelLocator = self.modelLocator;
         if (modelLocator)
         {
             var modelTransform = self.modelLocator.modelTransform;
             if (modelTransform)
             {
                 var model = self.modelLocator.modelTransform.GetComponent <RoR2.CharacterModel>();
                 if (model)
                 {
                     var radiantBuffTracker = self.gameObject.AddComponent <RadiantBuffTracker>();
                     radiantBuffTracker.Body = self;
                     RoR2.TemporaryOverlay overlay = self.modelLocator.modelTransform.gameObject.AddComponent <RoR2.TemporaryOverlay>();
                     overlay.duration              = float.PositiveInfinity;
                     overlay.alphaCurve            = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
                     overlay.animateShaderAlpha    = true;
                     overlay.destroyComponentOnEnd = true;
                     overlay.originalMaterial      = EliteMaterial;
                     overlay.AddToCharacerModel(model);
                     radiantBuffTracker.Overlay    = overlay;
                     radiantBuffTracker.PulseTimer = 1;
                 }
             }
         }
     }
     orig(self);
 }
예제 #6
0
        public void UpdateFromConverter(CameraStatusConverter converter)
        {
            hasTarget          = converter.willHaveTarget;
            hasOrientation     = converter.willHaveOrientation;
            currentTarget      = converter.nextTarget;
            currentOrientation = converter.nextOrientation;
            focusDelta         = converter.intendedFocusDelta;
            toTargetMaxDelta   = converter.toTargetMaxSpeed * Time.deltaTime;
            cameraMaxDelta     = converter.cameraMaxSpeed * Time.deltaTime;
            switch (converter.sizeStyle)
            {
            case CurveStyle.Instantly:
                size      = converter.intendedSize;
                sizeCurve = AnimationCurve.Constant(0f, 1f, size);
                break;

            case CurveStyle.Linear:
                ResetTimer();
                sizeCurve = AnimationCurve.Linear(0f, size, converter.time, converter.intendedSize);
                break;

            case CurveStyle.EaseInOut:
                ResetTimer();
                sizeCurve = AnimationCurve.EaseInOut(0f, size, converter.time, converter.intendedSize);
                break;
            }
        }
    IEnumerator CooldownAnimation(bool isStartCooldown)
    {
        if (originalPos == Vector3.zero)
        {
            originalPos = transform.position;
        }

        float          timePassed = 0;
        AnimationCurve curve      = AnimationCurve.EaseInOut(0, 0, 1, 1);
        Vector3        startPos   = transform.position;
        Vector3        targetPos  = new Vector3(
            originalPos.x,
            isStartCooldown? (originalPos.y - cooldownYOffset): originalPos.y,
            originalPos.z
            );

        while (timePassed < cooldownAnimationDuration)
        {
            yield return(new WaitForFixedUpdate());

            timePassed        += Time.deltaTime;
            transform.position = Vector3.Lerp(startPos, targetPos, curve.Evaluate(timePassed / cooldownAnimationDuration));
        }

        transform.position = targetPos;
        cooldownAnimation  = null;
    }
예제 #8
0
 public void FadeOut()
 {
     m_AlphaCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
     m_loop       = false;
     m_maxAlpha   = m_projector.material.color.a;
     m_beginTime  = Time.time;
 }
예제 #9
0
        /// <summary>
        /// set the animation curve using a preset
        /// </summary>
        public void SetCurve(BasicEaseCurves curve)
        {
            AnimationCurve animation = AnimationCurve.Linear(0, 1, 1, 1);

            switch (curve)
            {
            case BasicEaseCurves.EaseIn:
                animation = new AnimationCurve(new Keyframe(0, 0), new Keyframe(1, 1, 2.5f, 0));
                break;

            case BasicEaseCurves.EaseOut:
                animation = new AnimationCurve(new Keyframe(0, 0, 0, 2.5f), new Keyframe(1, 1));
                break;

            case BasicEaseCurves.EaseInOut:
                animation = AnimationCurve.EaseInOut(0, 0, 1, 1);
                break;

            default:
                break;
            }

            Curve = animation;

            // Update the cached keys
            cachedKeys = Curve.keys;
        }
예제 #10
0
    public IEnumerator SetColorPingPong(SpriteRenderer spr, Color StartColor, Color EndColor, float time, int count)
    {
        float          t     = 0f;
        AnimationCurve curve = AnimationCurve.EaseInOut(0f, 0f, 1f, 1f);

        spr.SetColor(StartColor);
        Color oneColor = StartColor;

        for (int i = 0; i < count * 2; ++i)
        {
            while (t < 1.0f)
            {
                t = Mathf.Clamp01(t + Time.unscaledDeltaTime / time);
                float r = Mathf.Lerp(StartColor.r, EndColor.r, curve.Evaluate(t));
                float g = Mathf.Lerp(StartColor.g, EndColor.g, curve.Evaluate(t));
                float b = Mathf.Lerp(StartColor.b, EndColor.b, curve.Evaluate(t));
                float a = Mathf.Lerp(StartColor.a, EndColor.a, curve.Evaluate(t));

                spr.SetColor(new Color(r, g, b, a));
                yield return(null);
            }
            t = 0f;
            Color temp = StartColor;
            StartColor = EndColor;
            EndColor   = temp;
        }

        spr.SetColor(oneColor);
    }
예제 #11
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        var warp = (TeleportTransitionWarp)target;

        warp.PositionLerp = EditorGUILayout.CurveField("Position Lerp", warp.PositionLerp, GUILayout.Height(50));

        GUILayout.BeginHorizontal();
        GUILayout.Label("Position Lerp Modes");
        if (GUILayout.Button("Default"))
        {
            warp.PositionLerp = AnimationCurve.Linear(0, 0, 1, 1);
        }
        if (GUILayout.Button("Ease"))
        {
            warp.PositionLerp = AnimationCurve.EaseInOut(0, 0, 1, 1);
        }
        if (GUILayout.Button("Step 5"))
        {
            CreateStep(warp, 5);
        }
        if (GUILayout.Button("Step 10"))
        {
            CreateStep(warp, 10);
        }
        GUILayout.EndHorizontal();
    }
예제 #12
0
    public static int EaseInOut_s(IntPtr l)
    {
        int result;

        try
        {
            float timeStart;
            LuaObject.checkType(l, 1, out timeStart);
            float valueStart;
            LuaObject.checkType(l, 2, out valueStart);
            float timeEnd;
            LuaObject.checkType(l, 3, out timeEnd);
            float valueEnd;
            LuaObject.checkType(l, 4, out valueEnd);
            AnimationCurve o = AnimationCurve.EaseInOut(timeStart, valueStart, timeEnd, valueEnd);
            LuaObject.pushValue(l, true);
            LuaObject.pushValue(l, o);
            result = 2;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
        public static IEnumerator Rotate(GameObject door, float StartAngle, float EndAngle, float Speed, bool UnityConvention, float Offset, bool ShortestWay)
        {
            Quaternion StartRotation, EndRotation, RotationOffset;

            RotationOffset = Quaternion.Euler(0, Offset, 0);

            AnimationCurve curve = AnimationCurve.EaseInOut(0f, 0f, 1f, 1f);

            float TimeProgression = 0f;

            if (UnityConvention) // Unity Convention
            {
                StartRotation = Quaternion.Euler(0, StartAngle, 0);
                EndRotation   = Quaternion.Euler(0, EndAngle, 0);
            }

            else // Alex's Door System Convention
            {
                StartRotation = Quaternion.Euler(0, -StartAngle, 0);
                EndRotation   = Quaternion.Euler(0, -EndAngle, 0);
            }

            while (TimeProgression <= (1 / Speed))
            {
                TimeProgression += Time.deltaTime;
                float RotationProgression = Mathf.Clamp01(TimeProgression / (1 / Speed));
                float RotationCurveValue  = curve.Evaluate(RotationProgression);

                door.transform.rotation = Lerp(StartRotation * RotationOffset, EndRotation * RotationOffset, RotationCurveValue, ShortestWay);

                yield return(null);
            }
        }
 public static void RubyMatUpdate(CharacterBody self)
 {
     if (self && self.inventory)
     {
         EliteIndex equipmentEliteIndex = RoR2.EliteCatalog.GetEquipmentEliteIndex(self.inventory.GetEquipmentIndex());
         if (self && equipmentEliteIndex == EliteIndex.None && self.isElite)
         {
             int itemCount = self.inventory.GetItemCount(Assets.AffixOrangeItemIndex);
             if (itemCount > 0)
             {
                 equipmentEliteIndex = EliteAspectsChanges.AffixOrangeIndex;
             }
         }
         RoR2.CharacterModel characterModelFromCharacterBody = CloudUtils.GetCharacterModelFromCharacterBody(self);
         if (equipmentEliteIndex == EliteAspectsChanges.AffixOrangeIndex && !self.gameObject.GetComponent <DestroyEffectOnBuffEnd>() && characterModelFromCharacterBody)
         {
             DestroyEffectOnBuffEnd destroyEffectOnBuffEnd = self.gameObject.AddComponent <DestroyEffectOnBuffEnd>();
             destroyEffectOnBuffEnd.body = self;
             destroyEffectOnBuffEnd.buff = EliteAspectsChanges.AffixOrangeBuff;
             RoR2.TemporaryOverlay temporaryOverlay = characterModelFromCharacterBody.gameObject.AddComponent <RoR2.TemporaryOverlay>();
             temporaryOverlay.duration              = float.PositiveInfinity;
             temporaryOverlay.alphaCurve            = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
             temporaryOverlay.animateShaderAlpha    = true;
             temporaryOverlay.destroyComponentOnEnd = true;
             temporaryOverlay.originalMaterial      = Cloudburst.Cores.AssetsCore.mainAssetBundle.LoadAsset <Material>("Assets/Cloudburst/753network/Crystallize/Ruby.mat");
             temporaryOverlay.AddToCharacerModel(characterModelFromCharacterBody);
             destroyEffectOnBuffEnd.effect = temporaryOverlay;
         }
     }
 }
예제 #15
0
    private IEnumerator IESetActive(bool _value)
    {
        Vector3        _startValue = transform.localScale;
        AnimationCurve _curve      = AnimationCurve.EaseInOut(0f, 0f, 1f, 1f);

        if (lookAtCamera && _value)
        {
            lookAtCameraScript.SetActive(true);
        }

        float _timeKey = 0;

        while (_timeKey < 1)
        {
            _timeKey += Time.deltaTime / lerpScaleDuration;
            float _evaluatedTimeKey = _curve.Evaluate(_timeKey);

            transform.localScale = Vector3.Lerp(_startValue, _value ? openedScale : closedScale, _evaluatedTimeKey);
            yield return(null);
        }

        if (lookAtCamera && !_value)
        {
            lookAtCameraScript.SetActive(false);
        }

        yield return(null);
    }
예제 #16
0
    public void captain(Animation a)
    {
        AnimationClip ac = new AnimationClip();

        ac.legacy = true;
        //se voltea
        AnimationCurve rot = AnimationCurve.EaseInOut(18f, gameObject.transform.eulerAngles.y, 20f, gameObject.transform.eulerAngles.y - 180);
        //Evento de animación de caminar 1
        AnimationEvent cWalk = new AnimationEvent();

        cWalk.time         = 21;
        cWalk.functionName = "walkCycle";
        ac.AddEvent(cWalk);
        //camina
        AnimationCurve xgap    = AnimationCurve.EaseInOut(21f, gameObject.transform.position.x, 27f, 2.6f);
        AnimationCurve zgap    = AnimationCurve.EaseInOut(21f, gameObject.transform.position.z, 27f, 0.5f);
        AnimationCurve despawn = AnimationCurve.EaseInOut(25.35f, gameObject.transform.position.y, 29f, -2f);

        ac.SetCurve("", typeof(Transform), "localPosition.x", xgap);
        ac.SetCurve("", typeof(Transform), "localPosition.y", despawn);
        ac.SetCurve("", typeof(Transform), "localPosition.z", zgap);
        ac.SetCurve("", typeof(Transform), "localEulerAngles.y", rot);
        a.AddClip(ac, "capi");
        a.Play("capi");
    }
예제 #17
0
    void AdjustPlayerPositions()
    {
        int Radius = 5;

        if (players.Length > 5)
        {
            Radius = players.Length;
            Camera.main.orthographicSize = players.Length + 2;
        }
        //NOTE: When using Cos and Sin to get the values for X and Y, the circle starts from (1,0) i.e. leftmost position on the unit circle

        int   numPositions   = players.Length;
        float degreeInterval = 360 / numPositions;

        Debug.Log(string.Format("{0} players, {1} degrees between each, {2} radius", numPositions, degreeInterval, Radius));

        for (int i = 0; i < players.Length; i++)
        {
            float currentDegree = i * degreeInterval;
            float currentCos    = Mathf.Cos(currentDegree * Mathf.Deg2Rad);
            float currentSin    = Mathf.Sin(currentDegree * Mathf.Deg2Rad);

            //Debug.Log(string.Format("New Position for player {0}: {1:f2},{2:f2}", i + 1, currentCos, currentSin));

            players[i].xCurve = AnimationCurve.EaseInOut(0, 0, 1, currentCos * Radius);
            players[i].yCurve = AnimationCurve.EaseInOut(0, 0, 1, currentSin * Radius);

            //---Old non-animated way of positioning cards after the deal---//
            //players[i].gameObject.transform.Translate(currentCos * Radius, currentSin * Radius, 0);
        }
        curvesCalculated = true;
        Debug.Log("Curves Calculated");
    }
예제 #18
0
    public void order(Animation a, float x, float z, float alpha)
    {
        AnimationClip ac = new AnimationClip();

        ac.legacy = true;
        //Gira
        AnimationCurve rot = AnimationCurve.EaseInOut(alpha + 30f, gameObject.transform.eulerAngles.y, alpha + 30.5f, goTo(x, z));
        //Eventos de animación de caminar
        AnimationEvent cWalk = new AnimationEvent();

        cWalk.time         = alpha + 30.5f;
        cWalk.functionName = "walkCycle";
        ac.AddEvent(cWalk);
        cWalk              = new AnimationEvent();
        cWalk.time         = alpha + 36f;
        cWalk.functionName = "walkCycle";
        ac.AddEvent(cWalk);
        //camina
        AnimationCurve xgap = AnimationCurve.EaseInOut(alpha + 30.5f, gameObject.transform.position.x, alpha + 36f, x);
        AnimationCurve zgap = AnimationCurve.EaseInOut(alpha + 30.5f, gameObject.transform.position.z, alpha + 36f, z);

        ac.SetCurve("", typeof(Transform), "localPosition.x", xgap);
        ac.SetCurve("", typeof(Transform), "localPosition.y", AnimationCurve.Constant(30, 50, gameObject.transform.localPosition.y));
        ac.SetCurve("", typeof(Transform), "localPosition.z", zgap);
        ac.SetCurve("", typeof(Transform), "localEulerAngles.y", rot);
        a.AddClip(ac, "order");
        a.Play("order");
    }
예제 #19
0
        public void UpdateFromConverter(PlayerStatusConverter converter)
        {
            switch (converter.style)
            {
            case CurveStyle.Instantly:
                speed                = converter.intendedSpeed;
                rotationSpeed        = converter.intendedRotationalSpeed;
                speedCurve           = AnimationCurve.Constant(0f, 1f, speed);
                rotationalSpeedCurve = AnimationCurve.Constant(0f, 1f, rotationSpeed);
                break;

            case CurveStyle.Linear:
                ResetTimer();
                speedCurve           = AnimationCurve.Linear(0f, speed, converter.time, converter.intendedSpeed);
                rotationalSpeedCurve =
                    AnimationCurve.Linear(0f, rotationSpeed, converter.time, converter.intendedRotationalSpeed);
                break;

            case CurveStyle.EaseInOut:
                ResetTimer();
                speedCurve           = AnimationCurve.EaseInOut(0f, speed, converter.time, converter.intendedSpeed);
                rotationalSpeedCurve =
                    AnimationCurve.EaseInOut(0f, rotationSpeed, converter.time, converter.intendedRotationalSpeed);
                break;
            }
        }
 // Token: 0x06002F2B RID: 12075 RVA: 0x000C9698 File Offset: 0x000C7898
 public override void OnExit()
 {
     Util.PlaySound(BlinkState.endSoundString, base.gameObject);
     this.CreateBlinkEffect(Util.GetCorePosition(base.gameObject));
     this.modelTransform = base.GetModelTransform();
     if (this.modelTransform && BlinkState.destealthMaterial)
     {
         TemporaryOverlay temporaryOverlay = this.animator.gameObject.AddComponent <TemporaryOverlay>();
         temporaryOverlay.duration = 1f;
         temporaryOverlay.destroyComponentOnEnd   = true;
         temporaryOverlay.originalMaterial        = BlinkState.destealthMaterial;
         temporaryOverlay.inspectorCharacterModel = this.animator.gameObject.GetComponent <CharacterModel>();
         temporaryOverlay.alphaCurve         = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
         temporaryOverlay.animateShaderAlpha = true;
     }
     if (this.characterModel)
     {
         this.characterModel.invisibilityCount--;
     }
     if (this.hurtboxGroup)
     {
         HurtBoxGroup hurtBoxGroup = this.hurtboxGroup;
         int          hurtBoxesDeactivatorCounter = hurtBoxGroup.hurtBoxesDeactivatorCounter - 1;
         hurtBoxGroup.hurtBoxesDeactivatorCounter = hurtBoxesDeactivatorCounter;
     }
     if (base.characterMotor)
     {
         base.characterMotor.enabled = true;
     }
     base.PlayAnimation("Gesture, Additive", "BlinkEnd");
     base.OnExit();
 }
예제 #21
0
        /// <summary>
        /// Constructor. Semi-internal - If you use this be prepared for changes. The best way is to use named
        /// parameters for all optional arguments!
        /// </summary>
        /// <param name="target"></param>
        /// <param name="delay"></param>
        /// <param name="duration"></param>
        /// <param name="transitionMode"></param>
        /// <param name="timeUpdateMethod"></param>
        /// <param name="tweenType"></param>
        /// <param name="animationCurve"></param>
        /// <param name="coordinateSpace"></param>
        /// <param name="onStart"></param>
        /// <param name="onUpdate"></param>
        /// <param name="onComplete"></param>
        public TransitionStep(UnityEngine.GameObject target = null,
                              float delay    = 0,
                              float duration = 0.5f,
                              TransitionModeType transitionMode     = TransitionModeType.Specified,
                              TimeUpdateMethodType timeUpdateMethod = TimeUpdateMethodType.GameTime,
                              TransitionHelper.TweenType tweenType  = TransitionHelper.TweenType.linear,
                              AnimationCurve animationCurve         = null,
                              CoordinateSpaceType coordinateSpace   = CoordinateSpaceType.Global,
                              Action <TransitionStep> onStart       = null,
                              Action <TransitionStep> onUpdate      = null,
                              Action <TransitionStep> onComplete    = null)
        {
            Target           = target;
            Delay            = delay;
            Duration         = duration;
            TransitionMode   = transitionMode;
            TimeUpdateMethod = timeUpdateMethod;
            TweenType        = tweenType;
            AnimationCurve   = animationCurve ?? AnimationCurve.EaseInOut(0, 0, 1, 1);
            CoordinateSpace  = coordinateSpace;

            AddOnStartAction(onStart);
            AddOnUpdateAction(onUpdate);
            AddOnCompleteAction(onComplete);
        }
    private void Awake()
    {
        lightSource           = gameObject.AddComponent <Light>();
        lightSource.range     = Radius;
        lightSource.intensity = LightCurve.Evaluate(0);
        var ps = gameObject.GetComponent <ParticleSystem>();

        mat = ps.GetComponent <Renderer>().sharedMaterial;
        var color = mat.GetColor("_TintColor");
        var max   = Mathf.Max(color.r, Mathf.Max(color.g, color.b));

        color.r           = Mathf.Clamp01(color.r / max);
        color.g           = Mathf.Clamp01(color.g / max);
        color.b           = Mathf.Clamp01(color.b / max);
        color.a           = 1;
        lightSource.color = color;
#if UNITY_5_3
        //timeDuration = UseDurationFromParticleSystem? ps.startLifetime : Duration;
        var usedRate = ps.emission.rate.constantMax > 0 ? true : false;
        timeDuration = !usedRate ? ps.startLifetime : ps.startLifetime + ps.duration;
        isLoop       = ps.loop;
#else
        //timeDuration = UseDurationFromParticleSystem ? ps.main.startLifetime.constantMax : Duration;
        var usedRate = ps.emission.rateOverTime.constantMax > 0 ? true : false;
        timeDuration = !usedRate ? ps.main.startLifetime.constantMax : ps.main.startLifetime.constantMax + ps.main.duration;
        isLoop       = ps.main.loop;
#endif
        if (isLoop)
        {
            LightCurve = AnimationCurve.EaseInOut(0, 1, 1, 1);
        }
    }
예제 #23
0
    private void AddAnimationMoveToPlayerDeck(Vector3 endPosition)
    {
        var clip  = new AnimationClip();
        var curve = AnimationCurve.EaseInOut(0, transform.position.x, 1, endPosition.x);

        clip.SetCurve("", typeof(Transform), "localPosition.x", curve);
        curve = AnimationCurve.EaseInOut(0, transform.position.y, 0.7f, 0f);
        clip.SetCurve("", typeof(Transform), "localPosition.y", curve);
        curve = new AnimationCurve();
        curve.AddKey(0, transform.position.z);
        var keyframe = curve[0];

        keyframe.outTangent = 1;
        curve.MoveKey(0, keyframe);
        curve.AddKey(0.4f, transform.position.z - 2.5f);
        curve.AddKey(0.70f, transform.position.z - 4.7f);
        curve.AddKey(1f, endPosition.z);
        keyframe           = curve[3];
        keyframe.inTangent = 0;
        curve.MoveKey(3, keyframe);
        clip.SetCurve("", typeof(Transform), "localPosition.z", curve);
        clip.wrapMode = WrapMode.Once;

        var animEv = new AnimationEvent();

        animEv.functionName = "animFinished";
        animEv.time         = clip.length;
        clip.AddEvent(animEv);

        clip.legacy = true;
        GetComponent <Animation>().AddClip(clip, "MoveToPlayerDeckAnimation");
    }
 // Token: 0x06000823 RID: 2083 RVA: 0x00028A78 File Offset: 0x00026C78
 public override void OnExit()
 {
     if (base.characterBody && NetworkServer.active)
     {
         if (base.characterBody.HasBuff(BuffIndex.Cloak))
         {
             base.characterBody.RemoveBuff(BuffIndex.Cloak);
         }
         if (base.characterBody.HasBuff(BuffIndex.CloakSpeed))
         {
             base.characterBody.RemoveBuff(BuffIndex.CloakSpeed);
         }
     }
     if (!this.outer.destroying)
     {
         this.CastSmoke();
     }
     if (CastSmokescreenNoDelay.destealthMaterial)
     {
         TemporaryOverlay temporaryOverlay = this.animator.gameObject.AddComponent <TemporaryOverlay>();
         temporaryOverlay.duration = 1f;
         temporaryOverlay.destroyComponentOnEnd   = true;
         temporaryOverlay.originalMaterial        = CastSmokescreenNoDelay.destealthMaterial;
         temporaryOverlay.inspectorCharacterModel = this.animator.gameObject.GetComponent <CharacterModel>();
         temporaryOverlay.alphaCurve         = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
         temporaryOverlay.animateShaderAlpha = true;
     }
     base.OnExit();
 }
예제 #25
0
    IEnumerator scaleOutPanel(float duration)
    {
        SetPivot(panelRect, new Vector2(0.5f, 0f));
        float startHeight = panelRect.sizeDelta.y;
        float endHeight   = 0.0f;
        float startWidth  = panelRect.sizeDelta.y;
        float endWidth    = 0.0f;

        float          time        = 0.0f;
        AnimationCurve heightCurve = AnimationCurve.EaseInOut(time, startHeight, duration, endHeight);
        AnimationCurve widthCurve  = AnimationCurve.EaseInOut(time, startWidth, duration, endWidth);

        while (time < duration)
        {
            float currentHeight = heightCurve.Evaluate(time);
            float currentWidth  = widthCurve.Evaluate(time);
            panelRect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, currentHeight);
            panelRect.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, currentWidth);

            yield return(null);

            time += Time.deltaTime;
        }
        panelRect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, endHeight);
        panelRect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, endWidth);
        SetPivot(panelRect, new Vector2(0.5f, 0.5f));
        destroyMe();
    }
예제 #26
0
 public void Init(float duration, float deltaHeight)
 {
     curve            = AnimationCurve.EaseInOut(0, 0, 1, 1);
     base.duration    = duration;
     this.deltaHeight = deltaHeight;
     delay            = 0;
 }
예제 #27
0
파일: BigDipper.cs 프로젝트: kijun/art
    IEnumerator CreateLine2()
    {
        var sp = new SplineParams();

        sp.spline = new BezierSpline2D(
            RV(), RV(), RV(), RV());
        sp.spline.AddCurve(RV(), RV(), RV());
        sp.spline.AddCurve(RV(), RV(), RV());
        sp.spline.AddCurve(RV(), RV(), RV());
        sp.color = Color.Lerp(blue, red, Random.value).WithAlpha(0);
        sp.width = Random.Range(0.02f, 0.2f);
        Animatable2[] anims = NoteFactory.CreateLine(sp);
        foreach (var l in anims)
        {
            l.AddAnimationCurve(AnimationKeyPath.Opacity, AnimationCurve.Linear(0, 0, 1, 1));
            yield return(new WaitForSeconds(0.01f));
        }

        yield return(new WaitForSeconds(2f));

        foreach (var l in anims)
        {
            //l.velocity = RandomHelper.RandomVector2(-0.5f, 0.5f, -0.5f, 0.5f);
            //l.angularVelocity = Random.Range(-90f, 90f);
            l.AddAnimationCurve(AnimationKeyPath.Opacity, AnimationCurve.EaseInOut(0, 1, 3, 0));
            l.DestroyIn(4f);
        }
    }
예제 #28
0
    /// <Summary>
    /// Completely overwrites AudioSourceParameters of a Sound to any value.
    /// Only use this if you have a known entry for all parameters, otherwise the sound will
    /// not play properly (eg, having no entry for pitch will make the sound never start or finish)
    /// </Summary>
    private static void ForceAudioSourceParameters(AudioSourceParameters audioSourceParameters, SoundSpawn soundSpawn)
    {
        AudioSource audioSource = soundSpawn.AudioSource;

        audioSource.volume                = audioSourceParameters.Volume;
        audioSource.pitch                 = audioSourceParameters.Pitch;
        audioSource.time                  = audioSourceParameters.Time;
        audioSource.panStereo             = audioSourceParameters.Pan;
        audioSource.spatialBlend          = audioSourceParameters.SpatialBlend;
        audioSource.minDistance           = audioSourceParameters.MinDistance;
        audioSource.maxDistance           = audioSourceParameters.MaxDistance;
        audioSource.spread                = audioSourceParameters.Spread;
        audioSource.outputAudioMixerGroup = Instance.CalcAudioMixerGroup(audioSourceParameters.MixerType);
        switch (audioSourceParameters.VolumeRolloffType)
        {
        case VolumeRolloffType.EaseInAndOut:
            audioSource.rolloffMode = AudioRolloffMode.Custom;
            audioSource.SetCustomCurve(AudioSourceCurveType.CustomRolloff,
                                       AnimationCurve.EaseInOut(0, 1, 1, 0));
            break;

        case VolumeRolloffType.Linear:
            audioSource.rolloffMode = AudioRolloffMode.Linear;
            break;

        case VolumeRolloffType.Logarithmic:
            audioSource.rolloffMode = AudioRolloffMode.Logarithmic;
            break;
        }
    }
 /// <summary>
 /// Reset parameters to their default state.
 /// </summary>
 void Reset()
 {
     Progress       = 0;
     Duration       = 0.5f;
     TweenType      = TransitionHelper.TweenType.linear;
     AnimationCurve = AnimationCurve.EaseInOut(0, 0, 1, 1);
 }
예제 #30
0
            public void Update()
            {
                if (!renderer)
                {
                    if (itemFollower && itemFollower.followerInstance)
                    {
                        renderer = itemFollower.followerInstance.GetComponentInChildren <Renderer>();
                    }
                }

                if (blinkTimer > 0f)
                {
                    blinkTimer -= Time.deltaTime;
                    if (blinkTimer <= 0f)
                    {
                        if (renderer)
                        {
                            renderer.shadowCastingMode = ShadowCastingMode.On;
                            renderer.enabled           = true;

                            EffectManager.SpawnEffect(blinkEffect, new EffectData
                            {
                                origin = renderer.transform.position
                            }, false);

                            TemporaryOverlay temporaryOverlay = renderer.gameObject.AddComponent <TemporaryOverlay>();
                            temporaryOverlay.duration              = flashTimer = flashDuration;
                            temporaryOverlay.destroyObjectOnEnd    = false;
                            temporaryOverlay.destroyComponentOnEnd = true;
                            temporaryOverlay.originalMaterial      = materialFlash;
                            temporaryOverlay.alphaCurve            = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
                            temporaryOverlay.animateShaderAlpha    = true;
                            temporaryOverlay.SetupMaterial();

                            var materials = renderer.materials;
                            HG.ArrayUtils.ArrayAppend(ref materials, temporaryOverlay.materialInstance);
                            renderer.materials = materials;
                            materialInstance   = renderer.materials.Last();
                        }
                    }
                }

                if (flashTimer > 0f)
                {
                    flashTimer -= Time.deltaTime;
                    if (flashTimer <= 0f)
                    {
                        if (renderer && materialInstance)
                        {
                            var materials = renderer.materials;
                            var index     = System.Array.IndexOf(materials, materialInstance);
                            if (index != -1)
                            {
                                HG.ArrayUtils.ArrayRemoveAtAndResize(ref materials, index);
                            }
                            renderer.materials = materials;
                        }
                    }
                }
            }