Example #1
0
        public async Task <bool> KeyframeTo(Transform target, float seconds, Easing.Function easing = null)
        {
            var start = Transform;

            var moveid = ++movement;

            for (float f = 0; f < 1;)
            {
                await Task.NextPhysicsFrame();

                if (moveid != movement)
                {
                    return(false);
                }

                var eased = easing != null?easing(f) : f;

                var newtx = Transform.Lerp(start, target, eased, false);

                TryKeyframeTo(newtx);

                f += Time.Delta / seconds;
            }

            Transform = target;
            return(true);
        }
Example #2
0
 public ScaleTitle(GameObject titleObj, Vector3 initial, Vector3 target, float dur, Easing.FunctionType easingType)
 {
     title        = titleObj;
     initialScale = initial;
     targetScale  = target;
     duration     = dur;
     easeType     = Easing.GetFunctionWithTypeEnum(easingType);
 }
 public TweenUIPosition(GameObject obj, Vector2 start, Vector2 end, float time, Easing.FunctionType easeType)
 {
     rectTransform  = obj.GetComponent <RectTransform>();
     startPos       = start;
     endPos         = end;
     duration       = time;
     easingFunction = Easing.GetFunctionWithTypeEnum(easeType);
 }
Example #4
0
 public SlideCharacter(GameObject chara, Vector3 initial, Vector3 target, float dur, Easing.FunctionType easingType)
 {
     character  = chara;
     initialPos = initial;
     targetPos  = target;
     duration   = dur;
     easeType   = Easing.GetFunctionWithTypeEnum(easingType);
 }
        protected override float GetCurrentValue()
        {
            float value = 0.0f;

            Easing.Function interpolationMethod = Easing.GetEasingFunction(interpolationType);
            value = interpolationMethod(startInterpolation, TargetInterpolation, currentTime / totalTime);

            return(value);
        }
Example #6
0
 public void scale(Vector3 target, bool locally, [Optional, DefaultParameterValue(0)] Easing.Function easing)
 {
     if (this.m_timer > 0f)
     {
         Debug.LogError("Cannot modify task after it has been started!");
     }
     else
     {
         this.m_scaling        = new Scaling();
         this.m_scaling.axis   = new bool[] { true, true, true };
         this.m_scaling.start  = !locally ? this.m_transform.lossyScale : this.m_transform.localScale;
         this.m_scaling.target = target;
         this.m_scaling.local  = locally;
         this.m_scaling.easing = easing;
     }
 }
Example #7
0
 public void translate(Vector3 target, bool locally, [Optional, DefaultParameterValue(0)] Easing.Function easing)
 {
     if (this.m_timer > 0f)
     {
         Debug.LogError("Cannot modify task after it has been started!");
     }
     else
     {
         this.m_translation           = new Translation();
         this.m_translation.axis      = new bool[] { true, true, true };
         this.m_translation.start     = !locally ? this.m_transform.position : this.m_transform.localPosition;
         this.m_translation.target    = target;
         this.m_translation.local     = locally;
         this.m_translation.easing    = easing;
         this.m_translation.algorithm = TranslationAlgorithm.LINEAR;
     }
 }
Example #8
0
 public void rotate(Vector3 rotateBy, bool locally, [Optional, DefaultParameterValue(0)] Easing.Function easing)
 {
     if (this.m_timer > 0f)
     {
         Debug.LogError("Cannot modify task after it has been started!");
     }
     else
     {
         this.m_rotation          = new Rotation();
         this.m_rotation.axis     = new bool[] { true, true, true };
         this.m_rotation.start    = !locally ? this.m_transform.rotation : this.m_transform.localRotation;
         this.m_rotation.rotateBy = rotateBy;
         this.m_rotation.local    = locally;
         this.m_rotation.easing   = easing;
         this.m_rotation.lazy     = false;
     }
 }
        public static IEnumerator Interpolate(Vector3 initialValue, Vector3 finalValue, float duration, System.Action <Vector3> setter, Ease ease = Ease.Linear, System.Action onFinished = null, TimeScale timeScale = TimeScale.Delta)
        {
            Vector3 diff = finalValue - initialValue;

            Easing.Function easeFunc = ease.GetFunction();

            System.Action <float> lerp = (float t) =>
            {
                Vector3 currentValue = initialValue + diff * easeFunc(t);
                setter.Invoke(currentValue);
            };

            yield return(Lerp(lerp, duration, timeScale));

            setter.Invoke(finalValue);
            onFinished?.Invoke();
        }
Example #10
0
 public void translateToAnchoredPos(Vector2 targetAnchoredPos, [Optional, DefaultParameterValue(0)] Easing.Function easing)
 {
     if (this.m_timer > 0f)
     {
         Debug.LogError("Cannot modify task after it has been started!");
     }
     else if (this.m_rectTransform == null)
     {
         Debug.LogError("No RectTransform specified before attempting to translate to anchored position!");
     }
     else
     {
         this.m_translationAnchoredPosition           = new TranslationAnchoredPosition();
         this.m_translationAnchoredPosition.start     = this.m_rectTransform.anchoredPosition;
         this.m_translationAnchoredPosition.target    = targetAnchoredPos;
         this.m_translationAnchoredPosition.easing    = easing;
         this.m_translationAnchoredPosition.algorithm = TranslationAlgorithm.LINEAR;
     }
 }
Example #11
0
    // Use this for initialization
    void Start()
    {
        filter = GetComponent <MeshFilter>();
        mesh   = new Mesh();
        mesh.MarkDynamic();
        filter.mesh = mesh;
        vertices    = new Vector3[subdivisions * e];
        tris        = new int[subdivisions * tv];

        switch (GlobalState.I.RadialMeshMode)
        {
        case RadialState.random:
            transform.localRotation = Quaternion.Euler(0, 0, Random.Range(0, 360));
            break;

        case RadialState.simple:
            break;

        case RadialState.orderly:
            rotationSpeed = 180;
            break;

        case RadialState.off:
            Destroy(gameObject);
            break;
        }

        initialSpeed = speed;

        startTime = Time.time;

        glow          = GetComponent <MeshRenderer>().material;
        emissionId    = Shader.PropertyToID("_EmissionColor");
        emissionColor = GlobalState.I.BaseColor;
        glow.SetColor(emissionId, Color.white * 0.1f);

        easingFunction = Easing.GetEasingFunction(easing);
        StartCoroutine(Pop(popDuration));
    }
Example #12
0
 public void reset(float duration, float delay, Easing.Function easingFunction)
 {
     this.reset();
     this.m_duration = duration;
     this.m_delay    = delay;
     if (this.m_translation != null)
     {
         this.m_translation.easing = easingFunction;
     }
     if (this.m_translationAnchoredPosition != null)
     {
         this.m_translationAnchoredPosition.easing = easingFunction;
     }
     if (this.m_rotation != null)
     {
         this.m_rotation.easing = easingFunction;
     }
     if (this.m_scaling != null)
     {
         this.m_scaling.easing = easingFunction;
     }
 }
Example #13
0
        /************************************************************************************************************************/

        /// <summary>Modify the current fade to use the specified `function` to calculate the weight.</summary>
        /// <example>See <see cref="CustomFade"/>.</example>
        public static void Apply(AnimancerComponent animancer, Easing.Function function)
        => Apply(animancer.States.Current, function);
        /************************************************************************************************************************/

        /// <summary>Modify the current fade to use the specified `function` to calculate the weight.</summary>
        /// <example>See <see cref="CustomFade"/>.</example>
        public static void Apply(AnimancerPlayable animancer, Easing.Function function)
        => Delegate.Acquire(function.GetDelegate()).Apply(animancer);
Example #15
0
        static ConfigGameplay()
        {
            Dictionary <GameLogic.CharacterType, Dictionary <string, int> > dictionary = new Dictionary <GameLogic.CharacterType, Dictionary <string, int> >(new CharacterTypeBoxAvoidanceComparer());
            Dictionary <string, int> dictionary2 = new Dictionary <string, int>();

            dictionary2.Add("Skeleton001", 10);
            dictionary2.Add("Skeleton002", 10);
            dictionary2.Add("Skeleton003", 10);
            dictionary2.Add("Skeleton004", 10);
            dictionary2.Add("Skeleton005", 10);
            dictionary2.Add("Skeleton006", 10);
            dictionary2.Add("Skeleton007", 8);
            dictionary2.Add("Skeleton008", 6);
            dictionary.Add(GameLogic.CharacterType.Skeleton, dictionary2);
            dictionary2 = new Dictionary <string, int>();
            dictionary2.Add("Jelly001", 10);
            dictionary2.Add("Jelly002", 10);
            dictionary2.Add("Jelly003", 10);
            dictionary2.Add("Jelly004", 6);
            dictionary.Add(GameLogic.CharacterType.Jelly, dictionary2);
            dictionary2 = new Dictionary <string, int>();
            dictionary2.Add("Pygmy001", 10);
            dictionary2.Add("Pygmy002", 10);
            dictionary2.Add("Pygmy003", 10);
            dictionary2.Add("Pygmy004", 10);
            dictionary.Add(GameLogic.CharacterType.Pygmy, dictionary2);
            dictionary2 = new Dictionary <string, int>();
            dictionary2.Add("Worg001", 10);
            dictionary2.Add("Worg002", 10);
            dictionary2.Add("Worg003", 0);
            dictionary2.Add("Worg004", 0);
            dictionary.Add(GameLogic.CharacterType.Worg, dictionary2);
            dictionary2 = new Dictionary <string, int>();
            dictionary2.Add("Crocodile001", 10);
            dictionary2.Add("Crocodile002", 10);
            dictionary2.Add("Crocodile003", 10);
            dictionary.Add(GameLogic.CharacterType.Crocodile, dictionary2);
            dictionary2 = new Dictionary <string, int>();
            dictionary2.Add("Rat001", 10);
            dictionary2.Add("Rat002", 10);
            dictionary2.Add("Rat003", 10);
            dictionary.Add(GameLogic.CharacterType.Rat, dictionary2);
            dictionary2 = new Dictionary <string, int>();
            dictionary2.Add("Anubis001", 10);
            dictionary2.Add("Anubis002", 10);
            dictionary2.Add("Anubis003", 10);
            dictionary.Add(GameLogic.CharacterType.Anubis, dictionary2);
            dictionary2 = new Dictionary <string, int>();
            dictionary2.Add("Mummy001", 10);
            dictionary2.Add("Mummy002", 10);
            dictionary.Add(GameLogic.CharacterType.Mummy, dictionary2);
            dictionary2 = new Dictionary <string, int>();
            dictionary2.Add("Goblin001", 10);
            dictionary2.Add("Goblin002", 10);
            dictionary2.Add("Goblin003", 10);
            dictionary2.Add("Goblin004", 10);
            dictionary.Add(GameLogic.CharacterType.Goblin, dictionary2);
            dictionary2 = new Dictionary <string, int>();
            dictionary2.Add("Yeti001", 10);
            dictionary2.Add("Yeti002", 10);
            dictionary2.Add("Yeti003", 10);
            dictionary2.Add("Yeti004", 10);
            dictionary.Add(GameLogic.CharacterType.Yeti, dictionary2);
            dictionary2 = new Dictionary <string, int>();
            dictionary2.Add("Shroom001", 10);
            dictionary2.Add("Shroom002", 10);
            dictionary2.Add("Shroom003", 10);
            dictionary2.Add("Shroom004", 10);
            dictionary.Add(GameLogic.CharacterType.Shroom, dictionary2);
            CHARACTER_SPAWN_WEIGHTS              = dictionary;
            STUN_MATERIAL_COLOR                  = new Color(0.08235294f, 0.8470588f, 1f, 1f);
            POISON_MATERIAL_COLOR                = new Color(0.6196079f, 0.972549f, 0f, 1f);
            SLOW_MATERIAL_COLOR                  = new Color(0f, 1f, 1f, 1f);
            CLONE_COOLDOWN_MATERIAL_COLOR        = new Color(0.3882353f, 0.8980392f, 1f, 1f);
            CLONE_DECOY_MATERIAL_COLOR           = new Color(0.6156863f, 0f, 1f, 1f);
            CLONE_HEAL_MATERIAL_COLOR            = new Color(0.4431373f, 1f, 0.2666667f, 1f);
            DEFAULT_NORMALIZED_HP_AFTER_REVIVE   = 0.5f;
            PASSIVE_HP_REGEN_PROXIMITY_THRESHOLD = 9f;
            PASSIVE_HP_REGEN_TICK_INTERVAL       = 0.2f;
            PASSIVE_HP_REGEN_PCT_PER_TICK        = 0.2f;
            HERO_HP_SAFEGUARD_MAX_HP_LOSS_PER_MINION_HIT_NORMALIZED = 0.1f;
            GLOBAL_MELEE_DAMAGE_VARIATION_PCT       = 0.03f;
            OUT_OF_BOUNDS_CHECKING_ENABLED          = true;
            CHARACTER_FULLSPEED_ACCELERATION_TIMER  = 0.18f;
            CHARACTER_FULLSPEED_ACCELERATION_EASING = Easing.Function.IN_CUBIC;
            ROTATION_STEERING_THRESHOLD             = 0.9f;
            SUPPORT_CHARACTER_AUTO_KILL_RADIUS      = float.MaxValue;
            CRITTER_MAX_COUNT              = 8;
            AGGRO_RANGE_IDLE               = 10f;
            AGGRO_RANGE_ALARMED            = 5f;
            AI_UPDATE_INTERVAL             = 0.0666666f;
            MAX_MONSER_PURSUIT_PATH_LENGTH = 20f;
            Dictionary <ProjectileType, Projectile.ProjectileProperties> dictionary3 = new Dictionary <ProjectileType, Projectile.ProjectileProperties>(new ProjectileTypeBoxAvoidanceComparer());

            Projectile.ProjectileProperties properties = new Projectile.ProjectileProperties();
            properties.Type   = ProjectileType.Fireball;
            properties.Radius = 0.6f;
            properties.DestroyAfterContact = true;
            properties.MaxLifetime         = 3f;
            properties.Speed      = 8f;
            properties.DamageType = DamageType.Ranged;
            dictionary3.Add(ProjectileType.Fireball, properties);
            Projectile.ProjectileProperties properties2 = new Projectile.ProjectileProperties();
            properties2.Type   = ProjectileType.Orb;
            properties2.Radius = 0.6f;
            properties2.DestroyAfterContact = true;
            properties2.MaxLifetime         = 2f;
            properties2.Speed      = 14f;
            properties2.DamageType = DamageType.Magic;
            dictionary3.Add(ProjectileType.Orb, properties2);
            Projectile.ProjectileProperties properties3 = new Projectile.ProjectileProperties();
            properties3.Type   = ProjectileType.Dragonball;
            properties3.Radius = 0.6f;
            properties3.DestroyAfterContact = true;
            properties3.MaxLifetime         = 3f;
            properties3.Speed      = 10f;
            properties3.DamageType = DamageType.Ranged;
            dictionary3.Add(ProjectileType.Dragonball, properties3);
            Projectile.ProjectileProperties properties4 = new Projectile.ProjectileProperties();
            properties4.Type   = ProjectileType.Rock;
            properties4.Radius = 0.6f;
            properties4.DestroyAfterContact = true;
            properties4.MaxLifetime         = 3f;
            properties4.CollideWithGround   = true;
            properties4.Speed      = 8f;
            properties4.DamageType = DamageType.Ranged;
            dictionary3.Add(ProjectileType.Rock, properties4);
            Projectile.ProjectileProperties properties5 = new Projectile.ProjectileProperties();
            properties5.Type   = ProjectileType.Frostball;
            properties5.Radius = 0.6f;
            properties5.DestroyAfterContact = true;
            properties5.MaxLifetime         = 3f;
            properties5.Speed      = 10f;
            properties5.DamageType = DamageType.Ranged;
            dictionary3.Add(ProjectileType.Frostball, properties5);
            Projectile.ProjectileProperties properties6 = new Projectile.ProjectileProperties();
            properties6.Type   = ProjectileType.Bubbles;
            properties6.Radius = 0.6f;
            properties6.DestroyAfterContact = true;
            properties6.MaxLifetime         = 3f;
            properties6.Speed      = 10f;
            properties6.DamageType = DamageType.Ranged;
            dictionary3.Add(ProjectileType.Bubbles, properties6);
            Projectile.ProjectileProperties properties7 = new Projectile.ProjectileProperties();
            properties7.Type   = ProjectileType.Splinters1;
            properties7.Radius = 0.6f;
            properties7.DestroyAfterContact = true;
            properties7.MaxLifetime         = 3f;
            properties7.Speed      = 10f;
            properties7.DamageType = DamageType.Ranged;
            dictionary3.Add(ProjectileType.Splinters1, properties7);
            Projectile.ProjectileProperties properties8 = new Projectile.ProjectileProperties();
            properties8.Type   = ProjectileType.Splinters2;
            properties8.Radius = 0.6f;
            properties8.DestroyAfterContact = true;
            properties8.MaxLifetime         = 3f;
            properties8.Speed      = 10f;
            properties8.DamageType = DamageType.Ranged;
            dictionary3.Add(ProjectileType.Splinters2, properties8);
            Projectile.ProjectileProperties properties9 = new Projectile.ProjectileProperties();
            properties9.Type   = ProjectileType.Ink;
            properties9.Radius = 0.6f;
            properties9.DestroyAfterContact = true;
            properties9.MaxLifetime         = 3f;
            properties9.Speed      = 10f;
            properties9.DamageType = DamageType.Ranged;
            dictionary3.Add(ProjectileType.Ink, properties9);
            Projectile.ProjectileProperties properties10 = new Projectile.ProjectileProperties();
            properties10.Type   = ProjectileType.Coins;
            properties10.Radius = 0.6f;
            properties10.DestroyAfterContact = true;
            properties10.MaxLifetime         = 3f;
            properties10.Speed      = 10f;
            properties10.DamageType = DamageType.Ranged;
            dictionary3.Add(ProjectileType.Coins, properties10);
            PROJECTILE_PROTOTYPE_PROPERTIES = dictionary3;
            USE_RANDOMIZED_BOSS_PERKS       = false;
            PET_MAX_LEVEL = 5;
            List <int> list = new List <int>();

            list.Add(2);
            list.Add(3);
            list.Add(4);
            list.Add(5);
            PET_PERK_MILESTONE_LEVELS = list;
            CHARACTER_MELEE_ATTACK_DESTRUCTIBLE_HIT_RADIUS = 2.25f;
        }
Example #16
0
 private IEnumerator animationRoutine(float targetAlpha, float duration, Easing.Function easing)
 {
 public bool Initialize()
 {
     _orbiting = false;
     _alive = true;
     _orbitEasing = Easing.EaseFunction(EaseType.EaseInSine);
     _chargeEasing = Easing.EaseFunction(EaseType.Linear);
     ForwardIndicator.SetActive(false);
     return true;
 }
 private IEnumerator animatedProgressRoutine(float sourceV, float targetV, float duration, Easing.Function easingFunction, AnimationComplete completeCallback, float delay)
 {
 private IEnumerator animationRoutine(float duration, float targetHeight, Easing.Function easing)
 {
Example #20
0
 public void translateWithQuarticBezier(Vector3 target, bool locally, Vector3 bezierP1, Vector3 bezierP2, Vector3 bezierP3, [Optional, DefaultParameterValue(0)] Easing.Function easing)
 {
     if (this.m_timer > 0f)
     {
         Debug.LogError("Cannot modify task after it has been started!");
     }
     else
     {
         this.m_translation           = new Translation();
         this.m_translation.axis      = new bool[] { true, true, true };
         this.m_translation.start     = !locally ? this.m_transform.position : this.m_transform.localPosition;
         this.m_translation.target    = target;
         this.m_translation.local     = locally;
         this.m_translation.easing    = easing;
         this.m_translation.algorithm = TranslationAlgorithm.QUARTIC_BEZIER;
         this.m_translation.cp0       = bezierP1;
         this.m_translation.cp1       = bezierP2;
         this.m_translation.cp2       = bezierP3;
     }
 }
Example #21
0
 /// <summary>Modify the current fade to use the specified `function` to calculate the weight.</summary>
 /// <example>See <see cref="CustomFade"/>.</example>
 public static void Apply(AnimancerPlayable animancer, Easing.Function function)
 => Apply(animancer.States.Current, function);
Example #22
0
 /// <summary>Modify the current fade to use the specified `function` to calculate the weight.</summary>
 /// <example>See <see cref="CustomFade"/>.</example>
 public static void Apply(AnimancerNode node, Easing.Function function)
 => Delegate.Acquire(function.GetDelegate()).Apply(node);
Example #23
0
        public IEnumerator CoFadeImageAlpha(float iterator, float time, float startA, float endA, Image image, Easing.Function function, Easing.Direction direction)
        {
            while (iterator < time)
            {
                iterator += Time.deltaTime;
                if (iterator > time)
                {
                    iterator = time;
                }

                float val = JoniUtility.Easing.GetTerpedPosition(iterator, time, function, direction);

                float newA = ExtendedLerp.LerpWithoutClamp(startA, endA, val);

                Color col = image.color;

                image.color = new Color(col.r, col.g, col.b, newA);
                yield return(0);
            }
        }
Example #24
0
 public Lerper()
 {
     m_easingFunction = new Easing.Four(Easing.Linear.easeNone);
 }
Example #25
0
        public IEnumerator CoMoveX(float iterator, float time, float startX, float endX, Transform transform, Easing.Function function, Easing.Direction direction)
        {
            while (iterator < time)
            {
                iterator += Time.deltaTime;
                if (iterator > time)
                {
                    iterator = time;
                }

                float val = JoniUtility.Easing.GetTerpedPosition(iterator, time, function, direction);

                float newX = ExtendedLerp.LerpWithoutClamp(startX, endX, val);

                Vector3 position = transform.localPosition;

                transform.localPosition = new Vector3(newX, position.y, position.z);

                yield return(0);
            }
        }
Example #26
0
 public Lerper(Easing.Function easingFunction)
 {
     m_easingFunction = easingFunction;
 }
Example #27
0
    public Lerper(EasingType easingType)
    {
        switch (easingType)
        {
        case EasingType.Linear:
        {
            m_easingFunction = new Easing.Four(Easing.Linear.easeNone);
        }
        break;

        case EasingType.ExpoEaseIn:
        {
            m_easingFunction = new Easing.Four(Easing.Expo.easeIn);
        }
        break;

        case EasingType.ExpoEaseOut:
        {
            m_easingFunction = new Easing.Four(Easing.Expo.easeOut);
        }
        break;

        case EasingType.ExpoEaseInOut:
        {
            m_easingFunction = new Easing.Four(Easing.Expo.easeInOut);
        }
        break;

        case EasingType.BounceEaseIn:
        {
            m_easingFunction = new Easing.Four(Easing.Bounce.easeIn);
        }
        break;

        case EasingType.BounceEaseOut:
        {
            m_easingFunction = new Easing.Four(Easing.Bounce.easeOut);
        }
        break;

        case EasingType.BounceEaseInOut:
        {
            m_easingFunction = new Easing.Four(Easing.Bounce.easeInOut);
        }
        break;

        case EasingType.BackEaseIn:
        {
            m_easingFunction = new Easing.Five(Easing.Back.easeIn);
        }
        break;

        case EasingType.BackEaseOut:
        {
            m_easingFunction = new Easing.Five(Easing.Back.easeOut);
        }
        break;

        case EasingType.BackEaseInOut:
        {
            m_easingFunction = new Easing.Five(Easing.Back.easeInOut);
        }
        break;
        }
    }
Example #28
0
 public static IEnumerator DoOverEasedTime(float duration, Easing.Function func, TimedAction timedAction)
 {
     return(DoOverTime(duration, t => { timedAction(func(t)); }));
 }
Example #29
0
        public IEnumerator CoScaleLoop(float iterator, float time, float startS, float endS, Transform transform, Easing.Function function, Easing.Direction direction)
        {
            while (iterator < time)
            {
                iterator += Time.deltaTime;
                if (iterator > time)
                {
                    iterator = time;
                }

                float val = JoniUtility.Easing.GetTerpedPosition(iterator, time, function, direction);

                float newS = ExtendedLerp.LerpWithoutClamp(startS, endS, val);

                transform.localScale = new Vector3(newS, newS, newS);

                if (iterator == time)
                {
                    iterator = 0;
                    float tempS = endS;
                    endS   = startS;
                    startS = tempS;
                }

                yield return(0);
            }
        }