/* Functions */

        private void Awake()
        {
#if TMP_PRO
            this.mTextMesh = this.GetComponent <TextMeshPro>();
#endif
            this.mTweenerHandler = this.GetComponent <JCS_TweenerHandler>();
            this.mFadeObject     = this.GetComponent <JCS_FadeObject>();
        }
Пример #2
0
        /// <summary>
        /// Fade a screen to cetain amount of value.
        /// </summary>
        /// <param name="time"></param>
        /// <param name="color"></param>
        public void Focus(float time, Color color)
        {
            float alpha = color.a;

            JCS_FadeObject fadeObj = this.mFadeScreen.FadeObject;

            Color fakeColor = color;

            fakeColor.a = 0;

            fadeObj.LocalColor   = fakeColor;
            fadeObj.FadeInAmount = alpha;
            fadeObj.FadeIn(time);
        }
Пример #3
0
        //========================================
        //      Unity's function
        //------------------------------
        private void Awake()
        {
            mText = this.GetComponent <Text>();

            mFadeObject        = this.GetComponent <JCS_FadeObject>();
            mSimpleTrackAction = this.GetComponent <JCS_SimpleTrackAction>();
            mSlideEffect       = this.GetComponent <JCS_SlideEffect>();

            // set the fade out call back,
            // so we active from pool,
            // and check to see if the object is fade out complete.
            // if is complete set the active to false (return
            // to pool).
            mFadeObject.fadeOutCallback = FadeOutCompleteCallback;
        }
Пример #4
0
        /* Functions */

        private void Awake()
        {
            this.mFadeObject = this.GetComponent <JCS_FadeObject>();
        }
Пример #5
0
        /// <summary>
        /// Fade out the screen, back to original amount of value.
        /// </summary>
        public void UnFocus(float time)
        {
            JCS_FadeObject fadeObj = this.mFadeScreen.FadeObject;

            fadeObj.FadeOut(time);
        }
Пример #6
0
        /// <summary>
        /// Fade out the screen, back to original amount of value.
        /// </summary>
        public void UnFocus()
        {
            JCS_FadeObject fadeObj = this.mFadeScreen.FadeObject;

            fadeObj.FadeOut();
        }
Пример #7
0
        /* Functions */

        private void Awake()
        {
            this.mAO = this.GetComponent <JCS_FadeObject>();

            mAO.LocalAlpha = 0;
        }
Пример #8
0
        /// <summary>
        /// Drop an item.
        /// </summary>
        /// <param name="item"> item u want to spawn </param>
        /// <param name="index"> index to know the force this is pushing to. </param>
        /// <param name="isEven"> is the index even number? </param>
        /// <param name="isGravity"> do gravity effect. </param>
        /// <param name="spreadEffect"> do spread effect. </param>
        /// <param name="rotateDrop"> rotate while dropping. </param>
        /// <param name="waveEffect"> do wave effect while on the ground. </param>
        /// <param name="destroyFade"> while picking it up will fade and destroy. </param>
        private void DropAnItem(
            JCS_Item item,
            int index,
            bool isEven,
            bool isGravity,
            bool spreadEffect,
            bool rotateDrop,
            bool waveEffect,
            bool destroyFade)
        {
            JCS_Item newItem = (JCS_Item)JCS_Utility.SpawnGameObject(
                item,
                this.transform.position,
                this.transform.rotation);

            bool isEvenIndex = ((index % 2) == 0) ? true : false;

            if (isGravity)
            {
                JCS_OneJump oj = newItem.gameObject.AddComponent <JCS_OneJump>();

                float gapDirection = mSpreadGap;
                if (isEvenIndex)
                {
                    gapDirection = -mSpreadGap;
                }

                oj.BounceBackfromWall = BounceBackfromWall;

                float gapForce = 0;

                if (spreadEffect)
                {
                    if (isEven)
                    {
                        if (!isEvenIndex)
                        {
                            gapForce = (gapDirection * (index - 1)) + gapDirection;
                        }
                        else
                        {
                            gapForce = (gapDirection * (index)) + gapDirection;
                        }
                    }
                    // if total is odd
                    else
                    {
                        if (isEvenIndex)
                        {
                            gapForce = (gapDirection * (index));
                        }
                        else
                        {
                            gapForce = (gapDirection * (index)) + gapDirection;
                        }
                    }
                }

                float jumpForce = mJumpForce;
                if (mRandomizeJumpForce)
                {
                    jumpForce += JCS_Random.Range(-mRandomizeJumpForceForce, mRandomizeJumpForceForce);
                }

                oj.DoForce(gapForce, jumpForce, mIncludeDepth);

                if (rotateDrop)
                {
                    JCS_ItemRotation irx = newItem.gameObject.AddComponent <JCS_ItemRotation>();
                    irx.RotateSpeed     = JCS_Random.Range(-mRotateSpeed, mRotateSpeed);
                    irx.Effect          = true;
                    irx.RotateDirection = JCS_Vector3Direction.FORWARD;

                    // if z axis interact in game
                    if (mIncludeDepth)
                    {
                        // add rotation on y axis.
                        JCS_ItemRotation iry = newItem.gameObject.AddComponent <JCS_ItemRotation>();
                        iry.RotateSpeed     = JCS_Random.Range(-mRotateSpeed, mRotateSpeed);
                        iry.Effect          = true;
                        iry.RotateDirection = JCS_Vector3Direction.UP;

                        // add rotation on z axis.
                        JCS_ItemRotation irz = newItem.gameObject.AddComponent <JCS_ItemRotation>();
                        irz.RotateSpeed     = JCS_Random.Range(-mRotateSpeed, mRotateSpeed);
                        irz.Effect          = true;
                        irz.RotateDirection = JCS_Vector3Direction.RIGHT;
                    }
                }
            }

            if (waveEffect)
            {
                JCS_3DConstWaveEffect cwe = newItem.gameObject.AddComponent <JCS_3DConstWaveEffect>();
                cwe.SetObjectType(newItem.GetObjectType());
                cwe.Effect = true;
            }

            if (destroyFade)
            {
                JCS_DestroyObjectWithTime dowt = newItem.gameObject.AddComponent <JCS_DestroyObjectWithTime>();
                dowt.FadeTime    = mFadeTime;
                dowt.DestroyTime = mDestroyTime;

                Renderer[] renderers = newItem.GetComponentsInChildren <Renderer>();

                foreach (Renderer rdr in renderers)
                {
                    JCS_FadeObject fo = rdr.gameObject.AddComponent <JCS_FadeObject>();

                    dowt.FadeObjects.Add(fo);

                    // set the object type the same.
                    fo.SetObjectType(item.GetObjectType());
                    fo.UpdateUnityData();
                }
            }
        }