Esempio n. 1
0
        override public void Apply()
        {
            _applying = true;

            Vector2 pt;

            if (connected)
            {
                pt = (Vector2)_storage[_controller.selectedPageId];
                if (pt == null)
                {
                    pt = (Vector2)(_default);
                }
            }
            else
            {
                pt = (Vector2)_default;
            }

            if (pt != null)
            {
                if (_tweener != null)
                {
                    if (_tweener != null)
                    {
                        _tweener.Cancel();
                    }
                    _tweener = Glide.Tweener.Tween(_owner, new { width = pt.x, height = pt.y }, _tweenTime, 0.0f);
                    _tweener.OnComplete(() =>
                    {
                        _applying = false;
                        _tweener  = null;
                    }
                                        );
                    Func <float, float> func;
                    if (Ease.EaseFunctions.TryGetValue(_tween, out func))
                    {
                        _tweener.Ease(func);
                    }
                    return;
                }
                else
                {
                    _owner.SetSize((int)((Vector2)pt).x, (int)((Vector2)pt).y);
                }
            }

            _applying = false;
        }
Esempio n. 2
0
    //----------------------------------------------------------------------------------

    // METHODS



    public override void BaseActionControl()
    {
        base.BaseActionControl();

        baseInputSpeed.BaseValue = InputSmoothing("Horizontal") * InputMultiplier;

        //Jumping
        if (Input.GetButtonDown("Jump"))
        {
            jumpAbility.CastAbility();
        }

        if (!Input.GetButton("Jump"))
        {
            jumpAbility.Cancel();
        }

        //Gliding
        if (Input.GetButton("Glide"))
        {
            glideAbility.CastAbility();
        }
        if (!Input.GetButton("Glide"))
        {
            glideAbility.Cancel();
        }

        if (Input.GetKey(KeyCode.B))
        {
            focusHealAbility.CastAbility();
        }


        //Blast Attack

        /*
         * if (Input.GetMouseButtonDown(0))
         * {
         *  blastAbility.CastAbility();
         * }
         */


        //[DEBUG]
        if (Input.GetKeyDown(KeyCode.R))
        {
            RespawnSwathe();
        }

        if (Input.GetAxis("Vertical") > 0 && IsGrounded)
        {
            interactableMethod?.Invoke();
        }

        if (Input.GetButtonDown("Jump"))
        {
            wallJumpAbility.CastAbility();
        }

        //Dashing
        if (Input.GetButtonDown("Dash"))
        {
            dashAbility.CastAbility();
        }

        //Slash
        if (Input.GetButtonDown("Slash"))
        {
            if (!vaultAbility.CanActivate)
            {
                slashAbility.CastAbility();
            }
            else
            {
                //Vault
                vaultAbility.CastAbility();
            }
        }

        /*
         * //Vault Toggle
         * if (Input.GetButtonDown("Vault"))
         * {
         *  vaultAbility.Toggle();
         * }
         */
    }
Esempio n. 3
0
        private void Refresh(object obj = null)
        {
            if (_isMouseMoved)
            {
                _owner.appContext.timers.AddByFrame(1, 1, Refresh);
                return;
            }
            float contentYLoc;
            float contentXLoc;

            contentYLoc = _yPerc * (_contentHeight - _maskHeight);
            contentXLoc = _xPerc * (_contentWidth - _maskWidth);

            if (_aniFlag)
            {
                float toX = _maskContentHolder.x, toY = _maskContentHolder.y;

                if (_vScroll)
                {
                    toY = -contentYLoc;
                }
                else
                {
                    if (_maskContentHolder.y != 0)
                    {
                        _maskContentHolder.y = 0;
                    }
                }
                if (_hScroll)
                {
                    toX = -contentXLoc;
                }
                else
                {
                    if (_maskContentHolder.x != 0)
                    {
                        _maskContentHolder.x = 0;
                    }
                }

                if (toX != _maskContentHolder.x || toY != _maskContentHolder.y)
                {
                    _maskHolder.mouseEnabled = false;
                    if (_tweener != null)
                    {
                        _tweener.Cancel();
                    }
                    _tweener = Glide.Tweener.Tween(_maskContentHolder,
                                                   new { x = toX, y = toY }, 0.5f, 0.0f);
                    _tweener.OnUpdate(__tweenUpdate);
                    _tweener.OnComplete(__tweenComplete);
                    _tweener.Ease(_easeTypeFunc);
                }
            }
            else
            {
                if (_tweener != null)
                {
                    _tweener.Cancel();
                    _tweener = null;
                }
                if (_vScroll)
                {
                    _maskContentHolder.y = -contentYLoc;
                }
                else
                {
                    _maskContentHolder.y = 0;
                }
                if (_hScroll)
                {
                    _maskContentHolder.x = -contentXLoc;
                }
                else
                {
                    _maskContentHolder.x = 0;
                }
                if (_vtScrollBar != null)
                {
                    _vtScrollBar.scrollPerc = _yPerc;
                }
                if (_hzScrollBar != null)
                {
                    _hzScrollBar.scrollPerc = _xPerc;
                }
            }

            _aniFlag = true;
        }