Ejemplo n.º 1
0
 private void OnGO(Vector3 pos, int number, bool isCorrect, System.Action onComplete)
 {
     Map.Cell cell = NumberSelector.selectedCell;
     transform.localPosition = pos;
     gameObject.SetActive(true);
     _text.text = number.ToString();
     UAnimation.Make(gameObject)
     .MoveTo(MapRenderer.CalculateCellPosition(cell.row, cell.col))
     .Duration(0.5f)
     .Ease(UAnimation.EaseType.Linear)
     .Go(delegate() {
         if (isCorrect)
         {
             gameObject.SetActive(false);
             onComplete();
         }
         else
         {
             UAnimation.Make(gameObject)
             .MoveTo(pos)
             .Duration(0.5f)
             .Ease(UAnimation.EaseType.Linear)
             .Go(delegate() {
                 gameObject.SetActive(false);
                 onComplete();
             });
         }
     });
 }
Ejemplo n.º 2
0
    private float EaseValue(float t)
    {
        switch (_type)
        {
        case EaseType.Linear:
            return(EaseLinear(t));

        case EaseType.EaseInOutCubic:
            return(EaseInOutCubic(t));

        case EaseType.EaseInCubic:
            return(EaseInCubic(t));

        case EaseType.EaseOutCubic:
            return(EaseOutCubic(t));

        case EaseType.EaseInQuad:
            return(EaseInQuad(t));

        case EaseType.EaseOutQuad:
            return(EaseOutQuad(t));

        case EaseType.EaseInOutQuad:
            return(EaseInOutQuad(t));

        case EaseType.EaseInElastic:
            return(UAnimation.EaseInElastic(t));

        case EaseType.EaseOutElastic:
            return(UAnimation.EaseOutElastic(t));
        }
        return(t);
    }
Ejemplo n.º 3
0
    public static void Pop()
    {
        if (_sceneStack.Count > 0)
        {
            GameObject o = _scene[_sceneStack.Pop()];
            UAnimation.Make(o)
            .MoveTo(new Vector3(480, 0, 0))
            .Duration(0.5f)
            .Ease(UAnimation.EaseType.Linear)
            .Go(delegate() {
                o.SetActive(false);
            });
        }

        if (_sceneStack.Count > 0)
        {
            GameObject o = _scene[_sceneStack.Peek()];
            o.gameObject.SetActive(true);
            UAnimation.Make(o)
            .MoveTo(Vector3.zero)
            .Ease(UAnimation.EaseType.Linear)
            .Duration(0.5f)
            .Go();
        }
    }
Ejemplo n.º 4
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            transform.localPosition = new Vector3(0, -400, 0);
            transform.localScale    = new Vector3(1, 1, 1);
            transform.localRotation = Quaternion.Euler(0, 0, 0);


            UAnimation.Make(gameObject)
            .MoveTo(new Vector3(0, 0, 0))
            .ScaleTo(new Vector3(5, 5, 5))
            .RotateTo(new Vector3(0, 0, 90))
            .Duration(2f)
            .Ease(UAnimation.EaseType.EaseOutElastic)
            .Go();
        }
    }
Ejemplo n.º 5
0
    public static void Push(string sceneName)
    {
        if (_sceneStack.Count > 0)
        {
            GameObject o = _scene[_sceneStack.Peek()];

            UAnimation.Make(o)
            .MoveTo(new Vector3(-480, 0, 0))
            .Duration(0.5f)
            .Ease(UAnimation.EaseType.Linear)
            .Go(delegate() {
                o.SetActive(false);
            });
        }
        _scene[sceneName].SetActive(true);
        _scene[sceneName].transform.localPosition = new Vector3(480, 0, 0);
        UAnimation.Make(_scene[sceneName])
        .MoveTo(Vector3.zero)
        .Ease(UAnimation.EaseType.Linear)
        .Duration(0.5f)
        .Go();

        _sceneStack.Push(sceneName);
    }
Ejemplo n.º 6
0
 public ViewBehaviour(UAnimationType animationType)
 {
     this.AnimationType = animationType;
     this.Animation     = new UAnimation(animationType);
 }
Ejemplo n.º 7
0
    public static UAnimation Make(GameObject o)
    {
        UAnimation anim = o.AddComponent <UAnimation>();

        return(anim);
    }