コード例 #1
0
ファイル: Ease.cs プロジェクト: toepoke/Fluqi
#pragma warning restore 1591


		/// <summary>
		/// Converts the Easing option into a string.
		/// </summary>
		/// <param name="ease">Easing option to convert</param>
		/// <returns>Converted string</returns>
		public static string EaseToString(eEase ease) {
			switch (ease) {
				case eEase.None: return "";
				case eEase.linear: return "linear";
				case eEase.swing: return "swing";
				case eEase.easeInQuad: return "easeInQuad";
				case eEase.easeOutQuad: return "easeOutQuad";
				case eEase.easeInOutQuad: return "easeInOutQuad";
				case eEase.easeInCubic: return "easeInCubic";
				case eEase.easeInOutCubic: return "easeInOutCubic";
				case eEase.easeInQuery: return "easeInQuery";
				case eEase.easeOutQuart: return "easeOutQuart";
				case eEase.easeInOutQuery: return "easeInOutQuery";
				case eEase.easeInQuint: return "easeInQuint";
				case eEase.easeOutQuint: return "easeOutQuint";
				case eEase.easeInExpo: return "easeInExpo";
				case eEase.easeOutExpo: return "easeOutExpo";
				case eEase.easeInOutExpo: return "easeInOutExpo";
				case eEase.easeInSine: return "easeInSine";
				case eEase.easeOutSine: return "easeOutSine";
				case eEase.easeInOutSine: return "easeInOutSine";
				case eEase.easeInCirc: return "easeInCirc";
				case eEase.easeOutCirc: return "easeOutCirc";
				case eEase.easeInOutCirc: return "easeInOutCirc";
				case eEase.easeInElastic: return "easeInElastic";
				case eEase.easeOutElastic: return "easeOutElastic";
				case eEase.easeInOutElastic: return "easeInOutElastic";
				case eEase.easeInBack: return "easeInBack";
				case eEase.easeOutBack: return "easeOutBack";
				case eEase.easeInOutBack: return "easeInOutBack";
				case eEase.easeInBounce: return "easeInBounce";
				case eEase.easeOutBounce: return "easeOutBounce";
				case eEase.easeInOutBounce: return "easeInOutBounce";
			}

			throw new ArgumentException(string.Format("Easing has an invalid value ({0}).", ease.ToString()));
		}
コード例 #2
0
    public void Disable()
    {
        if(_Ease == eEase.EASE_OUT)
        {
            return;
        }

        for(int i = 0; i < _GameObjects.Length; ++i)
        {
            _Renderers[i].enabled = true;
            _GameObjects[i].active = true;
            _Transforms[i].position = _B;
            _Materials[i].SetFloat("_Alpha",_BAlpha);
        }

        _Ease = eEase.EASE_OUT;
        _Time = 1.0f;
        _C = _B;
        _SC = _SB;
    }
コード例 #3
0
    public void Enable()
    {
        this.active = true;

        for(int i = 0; i < _GameObjects.Length; ++i)
        {
            _Renderers[i].enabled = true;
            _GameObjects[i].active = true;
            _Transforms[i].position = _A;
            _Transforms[i].localScale = _SA;
            _Materials[i].SetFloat("_Alpha",_AAlpha);
        }

        _C = _A;
        _SC = _SA;
        _Ease = eEase.EASE_IN;
        _Time = 0.0f;
        _IsButtonDown = false;
        _Delay = _StartDelay;
    }
コード例 #4
0
    void Update()
    {
        _Delay -= Time.deltaTime;

        if(_Delay > 0.0f)
        {
            return;
        }

        _Delay = 0.0f;

        switch(_Ease)
        {
            case eEase.EASE_IN:
                _Time += Time.deltaTime;

                if(_Time > 1.0f)
                {
                    _Time = 1.0f;
                    _C = _B;
                    _Ease = eEase.EASE_NONE;

                    if(_FireEventOnFinishTransitionIn)
                    {
                        Director._Instance.FireEvent(_Event);
                    }
                }

                float fRealTime = 1.0f - _Time;
                _C = _B + (_A - _B) * (fRealTime * fRealTime);
                _SC = _SB + (_SA - _SB) * (fRealTime * fRealTime);
                _Alpha = _BAlpha + (_AAlpha - _BAlpha) * (fRealTime * fRealTime);

                for(int i = 0; i < _GameObjects.Length; ++i)
                {
                    _Transforms[i].position = _C;
                    _Transforms[i].localScale = _SC;
                    _Materials[i].SetFloat("_Alpha",_Alpha);
                }

                break;

            case eEase.EASE_OUT:

                _Time -= Time.deltaTime;

                if(_Time < 0.0f)
                {
                    _Time = 0.0f;
                    _C = _A;
                    _Ease = eEase.EASE_KILL;
                }

                _C = _A + (_B - _A) * (_Time * _Time);
                _SC = _SA + (_SB - _SA) * (_Time * _Time);
                _Alpha = _AAlpha + (_BAlpha - _AAlpha) * (_Time * _Time);

                for(int i = 0; i < _GameObjects.Length; ++i)
                {
                    _Transforms[i].position = _C;
                    _Transforms[i].localScale = _SC;
                    _Materials[i].SetFloat("_Alpha",_Alpha);
                }

                break;

            case eEase.EASE_KILL:
                this.active = false;

                for(int i = 0; i < _GameObjects.Length; ++i)
                {
                    _Renderers[i].enabled = false;
                    _GameObjects[i].active = false;
                    _Transforms[i].position = _A;
                    _Transforms[i].localScale = _SA;
                    _Materials[i].SetFloat("_Alpha",_Alpha);
                }

                break;
        }

        this.transform.position = _C;

        if(_IsButton)
        {
            if(Input.GetMouseButtonDown(0))
            {
                Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                RaycastHit hit;

           		if(Physics.Raycast(ray, out hit, 100))
                {
                    if(hit.transform.gameObject.name == this.name)
                    {
                        _IsButtonDown = true;

                        for(int i = 0; i < _GameObjects.Length; ++i)
                        {
                            _Materials[i].SetFloat("_Button",1.0f);
                        }
                    }
                }
            }

            if(Input.GetMouseButtonUp(0))
            {
                Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                RaycastHit hit;

           		if(Physics.Raycast(ray, out hit, 100))
                {
                    if(hit.transform.gameObject.name == this.name)
                    {
                        if(_IsButtonDown)
                        {
                            Director._Instance.FireEvent(_Event);
                        }
                    }
                }

                _IsButtonDown = false;

                for(int i = 0; i < _GameObjects.Length; ++i)
                {
                    _Materials[i].SetFloat("_Button",0.0f);
                }
            }

            if(!_IsButtonDown)
            {
                Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                RaycastHit hit;

           		if(Physics.Raycast(ray, out hit, 100))
                {
                    if(hit.transform.gameObject.name == this.name)
                    {
                        for(int i = 0; i < _GameObjects.Length; ++i)
                        {
                            _Materials[i].SetFloat("_Over",1.0f);
                        }
                    }
                    else
                    {
                        for(int i = 0; i < _GameObjects.Length; ++i)
                        {
                            _Materials[i].SetFloat("_Over",0.0f);
                        }

                    }
                }
            }
            else
            {
                for(int i = 0; i < _GameObjects.Length; ++i)
                {
                    _Materials[i].SetFloat("_Over",0.0f);
                }
            }
        }
    }
コード例 #5
0
    void Start()
    {
        _Time = 0.0f;
        _Ease = eEase.EASE_KILL;
        _C = _A;

        for(int i = 0; i < _GameObjects.Length; ++i)
        {
            _Renderers.Add(_GameObjects[i].GetComponent<Renderer>());
            _Renderers[i].enabled = false;
            _GameObjects[i].active = false;
            _Transforms.Add(_GameObjects[i].transform);
            _Transforms[i].position = _A;
            _Transforms[i].localScale = _SA;
            _Materials.Add(_Renderers[i].material);
        }
    }
コード例 #6
0
ファイル: UIGO.cs プロジェクト: Johangsl/GameDevChronicles
    public void Enable()
    {
        this.active = true;

        _Renderer.enabled = true;
        _Transform.position = _A;
        _Transform.localScale = _SA;
        _Material.SetFloat("_Alpha",_AAlpha);

        _C = _A;
        _SC = _SA;
        _Ease = eEase.EASE_IN;
        _Time = 0.0f;
        _IsButtonDown = false;
        _DoLerp = false;
        _Lerp = 0.0f;
        _Delay = _StartDelay;
    }
コード例 #7
0
ファイル: UIGO.cs プロジェクト: Johangsl/GameDevChronicles
    public void Disable()
    {
        if(_Ease == eEase.EASE_OUT)
        {
            return;
        }

        _Renderer.enabled = true;
        this.active = true;
        _Transform.position = _B;
        _Material.SetFloat("_Alpha",_BAlpha);

        _Ease = eEase.EASE_OUT;
        _Time = 1.0f;
        _C = _B;
        _SC = _SB;
    }
コード例 #8
0
ファイル: UIGO.cs プロジェクト: Johangsl/GameDevChronicles
    void Start()
    {
        _Time = 0.0f;
        _Ease = eEase.EASE_KILL;
        _C = _A;

        _Renderer = this.GetComponent<Renderer>();
        _Transform = this.transform;
        _Material = _Renderer.material;
        _IsButtonDown = false;
    }