Esempio n. 1
0
 public Anim()
 {
     if (Anim.< > f__mg$cache0 == null)
     {
         Anim.< > f__mg$cache0 = new Easing.EasingDelegate(Easing.Linear);
     }
     this.EaseFunction    = Anim.< > f__mg$cache0;
     this.optimizedUpdate = new Action <float>(this.UpdateWithoutCallback);
 }
Esempio n. 2
0
    public Coroutine ScaleTo(Graphic g, int frame, Vector3 target, Easing.EasingDelegate func)
    {
        var rt = g.GetComponent <RectTransform>();

        if (rt == null)
        {
            throw new ArgumentException("g");
        }
        return(StartAnimation("scale", ScaleToFunc(rt, frame, target, func)));
    }
Esempio n. 3
0
    public Coroutine RotateTo(Graphic g, int frame, float angle, Easing.EasingDelegate func)
    {
        var rt = g.GetComponent <RectTransform>();

        if (rt == null)
        {
            throw new ArgumentException("g");
        }
        return(StartCoroutine(RotateToFunc(rt, frame, angle, func)));
    }
Esempio n. 4
0
    public Coroutine MoveBy(Graphic g, int frame, Vector2 target, Easing.EasingDelegate func)
    {
        var rt = g.GetComponent <RectTransform>();

        if (rt == null)
        {
            throw new ArgumentException("g");
        }
        return(MoveBy(rt, frame, target, func));
    }
Esempio n. 5
0
    protected IEnumerator ScaleToFunc(RectTransform tr, int frame, Vector3 target, Easing.EasingDelegate func)
    {
        var origin = tr.localScale;
        var diff   = target - origin;

        for (int i = 0; i <= frame; i++)
        {
            var t = 1.0f / frame * i;
            tr.localScale = origin + func(t) * diff;
            yield return(null);
        }
    }
Esempio n. 6
0
    protected IEnumerator MoveToFunc(RectTransform tr, int frame, Vector2 target, Easing.EasingDelegate func)
    {
        var origin = tr.anchoredPosition;
        var diff   = target - origin;

        for (int i = 0; i <= frame; i++)
        {
            var t = 1.0f / frame * i;

            tr.anchoredPosition = origin + func(t) * diff;
            yield return(null);
        }
    }
Esempio n. 7
0
        private void OnAnimationFinishedTimer(uint id, object cookie)
        {
            this.originalLocation = this.starAnimator.LocalPosition;
            AnimUXPosition animUXPosition = new AnimUXPosition(this.starAnimator, 0.5f, Vector3.right * (float)Screen.width * 0.5f + Vector3.up * 100f * this.starAnimator.UXCamera.Scale);
            Anim           arg_83_0       = animUXPosition;

            if (VictoryStarAnimation.< > f__mg$cache0 == null)
            {
                VictoryStarAnimation.< > f__mg$cache0 = new Easing.EasingDelegate(Easing.SineEaseIn);
            }
            arg_83_0.EaseFunction             = VictoryStarAnimation.< > f__mg$cache0;
            animUXPosition.OnCompleteCallback = new Action <Anim>(this.OnTweenFinished);
            Service.AnimController.Animate(animUXPosition);
        }
Esempio n. 8
0
    protected IEnumerator RotateToFunc(RectTransform rt, int frame, float target, Easing.EasingDelegate func)
    {
        var origin = rt.localEulerAngles.z;

        if (origin > 180)
        {
            origin = origin - 360;
        }
        var diff = target - origin;

        for (int i = 0; i <= frame; i++)
        {
            var t = 1.0f / frame * i;
            rt.localEulerAngles = new Vector3(0, 0, origin + func(t) * diff);
            yield return(null);
        }
    }
Esempio n. 9
0
 public Anim()
 {
     this.EaseFunction    = new Easing.EasingDelegate(Easing.Linear);
     this.optimizedUpdate = new Action <float>(this.UpdateWithoutCallback);
 }
Esempio n. 10
0
 public Coroutine RotateTo(RectTransform tr, int frame, float angle, Easing.EasingDelegate func)
 {
     return(StartCoroutine(RotateToFunc(tr, frame, angle, func)));
 }
Esempio n. 11
0
        private void CreateSpawnGameObject()
        {
            MeshRenderer meshRenderer;
            MeshFilter   meshFilter;

            if (this.gameObject == null)
            {
                this.gameObject = new GameObject("SpawnProtectionView");
                meshRenderer    = this.gameObject.AddComponent <MeshRenderer>();
                meshFilter      = this.gameObject.AddComponent <MeshFilter>();
            }
            else
            {
                meshRenderer = this.gameObject.GetComponent <MeshRenderer>();
                meshFilter   = this.gameObject.GetComponent <MeshFilter>();
            }
            this.gameObject.SetActive(false);
            this.gameObject.transform.position = new Vector3(0f, 0.005f, 0f);
            this.gameObjectExists  = true;
            this.gameObjectVisible = false;
            meshFilter.sharedMesh  = this.mesh;
            if (this.material == null)
            {
                string shaderName = "Grid_Protection_PL";
                Shader shader     = Service.AssetManager.Shaders.GetShader(shaderName);
                if (shader == null)
                {
                    return;
                }
                this.material = UnityUtils.CreateMaterial(shader);
                meshRenderer.GetComponent <Renderer>().sharedMaterial = this.material;
                if (this.texture != null)
                {
                    this.material.mainTexture = this.texture;
                }
                else if (this.textureHandle == AssetHandle.Invalid)
                {
                    TextureVO textureVO = Service.StaticDataController.Get <TextureVO>("textureSpawnProtection1");
                    Service.AssetManager.Load(ref this.textureHandle, textureVO.AssetName, new AssetSuccessDelegate(this.OnTextureLoaded), null, null);
                }
            }
            this.material.SetFloat("_Speed", 0.4f);
            this.material.color = Color.black;
            this.animAlphaIn    = new AnimColor(this.material, 1f, Color.black, Color.white);
            Anim arg_1C2_0 = this.animAlphaIn;

            if (SpawnProtectionView.< > f__mg$cache0 == null)
            {
                SpawnProtectionView.< > f__mg$cache0 = new Easing.EasingDelegate(Easing.QuintEaseOut);
            }
            arg_1C2_0.EaseFunction  = SpawnProtectionView.< > f__mg$cache0;
            this.animAlphaOut       = new AnimColor(this.material, 1f, Color.white, Color.black);
            this.animAlphaOut.Delay = 3f;
            Anim arg_21A_0 = this.animAlphaOut;

            if (SpawnProtectionView.< > f__mg$cache1 == null)
            {
                SpawnProtectionView.< > f__mg$cache1 = new Easing.EasingDelegate(Easing.QuintEaseIn);
            }
            arg_21A_0.EaseFunction = SpawnProtectionView.< > f__mg$cache1;
            this.animAlphaOut.OnCompleteCallback = new Action <Anim>(this.OnAlphaOutComplete);
        }
Esempio n. 12
0
 public Coroutine MoveTo(RectTransform tr, int frame, Vector2 target, Easing.EasingDelegate func)
 {
     return(StartAnimation("move", MoveToFunc(tr, frame, target, func)));
 }
Esempio n. 13
0
 public Coroutine RotateTo(int frame, float angle, Easing.EasingDelegate func)
 {
     return(StartCoroutine(RotateToFunc(rt, frame, angle, func)));
 }
Esempio n. 14
0
 public Coroutine MoveBy(int frame, Vector2 target, Easing.EasingDelegate func)
 {
     return(MoveTo(rt, frame, rt.anchoredPosition + target, func));
 }
Esempio n. 15
0
 public Coroutine ScaleTo(RectTransform tr, int frame, Vector3 target, Easing.EasingDelegate func)
 {
     return(StartAnimation("scale", ScaleToFunc(tr, frame, target, func)));
 }
Esempio n. 16
0
 public Coroutine SizeTo(int frame, Vector2 target, Easing.EasingDelegate func)
 {
     return(StartAnimation("size", SizeToFunc(rt, frame, target, func)));
 }
    public static Vector2 EaseTowards(this Vector2 self, Vector2 destination, float t, float duration, Easing.EasingDelegate function)
    {
        float totalDistance = (destination - self).magnitude;
        float newDistance   = function(t, 0.0f, totalDistance, duration);

        return(Vector2.MoveTowards(self, destination, newDistance));
    }
Esempio n. 18
0
 public Coroutine MoveBy(RectTransform tr, int frame, Vector2 target, Easing.EasingDelegate func)
 {
     return(MoveTo(tr, frame, tr.anchoredPosition + target, func));
 }