예제 #1
0
        /// <summary>
        ///
        /// </summary>
        private void FindScrollIndex()
        {
            if (mFocusBtn == null)
            {
                JCS_Debug.LogError(
                    "Cannot do the movement without focus button...");
                return;
            }

            // get the current scroll index.
            int currentScrollIndex = mFocusBtn.ScrollIndex;

            if (mLastScrollIndex == currentScrollIndex)
            {
                JCS_Debug.LogError(
                    "Last Scroll Index and Current Scroll Index are the same...");
                return;
            }

            // 如果 現在是8(last), 我點5(current),
            // last - current = 3
            // 也就是說 往上移動三格
            int diffIndex = mLastScrollIndex - currentScrollIndex;

            mTargetScrollIndex = diffIndex;

            mScrollIndexCounter = 0;

            mAnimating = true;
        }
        /// <summary>
        /// Initialize all the button under this panel.
        /// </summary>
        private void InitSequenceButtons()
        {
            JCS_SlideEffect se = null;

            for (int index = 0; index < mSlideButtons.Length; ++index)
            {
                se = mSlideButtons[index];

                if (se == null)
                {
                    JCS_Debug.LogError("Missing jcs_button assign in the inspector");
                    continue;
                }

                //
                se.transform.SetParent(this.transform);

                se.AutoAddEvent = false;
            }

            for (int index = 0; index < mAreaEffects.Length; ++index)
            {
                se = mAreaEffects[index];

                if (se == null)
                {
                    JCS_Debug.LogError("Missing jcs_button assign in the inspector");
                    continue;
                }

                //
                se.transform.SetParent(this.transform);
            }
        }
예제 #3
0
        /* Functions */

        private void Awake()
        {
            if (mType == JCS_2DPortalType.TRANSFER_PORTAL && mTargetPortal == null)
            {
                JCS_Debug.LogError("Transform portal does not exists.");
            }
        }
예제 #4
0
        /// <summary>
        /// Do Pythagorean Theorem.
        /// </summary>
        /// <param name="s1"> side 1 / hyp </param>
        /// <param name="s2"> side 2 </param>
        /// <param name="type"> target side you want to find. </param>
        /// <returns> result side. </returns>
        public static float PythagoreanTheorem(float s1, float s2, TriSides type)
        {
            switch (type)
            {
            case TriSides.hyp:
            {
                // a^2 + b^2 = c^2
                float a = Mathf.Pow(s1, 2);
                float b = Mathf.Pow(s2, 2);

                return(Mathf.Sqrt(a + b));
            }

            case TriSides.opp:
            case TriSides.adj:
            {
                // c^2 - b^2 = a^2
                float c = Mathf.Pow(s1, 2);
                float b = Mathf.Pow(s2, 2);

                float sub = c - b;

                return(Mathf.Sqrt(sub));
            }
            }

            JCS_Debug.LogError("This not suppose to happen here...");

            return(0);
        }
        //========================================
        //      Unity's function
        //------------------------------
        protected void Awake()
        {
            mTargetList = new JCS_Vector <JCS_Player>();

            mAudioListener = this.GetComponent <AudioListener>();

            // find the camera in the scene first
            mJCS_2DCamera = (JCS_2DCamera)FindObjectOfType(typeof(JCS_2DCamera));

            // if still null spawn a default one!
            if (mJCS_2DCamera == null)
            {
                JCS_Debug.LogError("There is not JCS_2DCamera attach to, spawn a default one!");

                // Spawn a Default one!
                this.mJCS_2DCamera = JCS_Utility.SpawnGameObject(
                    JCS_2DCamera.JCS_2DCAMERA_PATH,
                    transform.position,
                    transform.rotation).GetComponent <JCS_2DCamera>();
            }

            mJCS_2DCamera.SetFollowTarget(this.transform);

            // record down the fild of view
            mTargetFieldOfView = mJCS_2DCamera.fieldOfView;
        }
예제 #6
0
        /// <summary>
        /// Selection this selection.
        ///
        /// ATTENTION(jenchieh): this can only use by the 'Event
        /// Trigger' component.
        /// </summary>
        /// <param name="selection"> selection to select. </param>
        public void SelectSelection(JCS_ButtonSelection selection, bool hoverCheck = false)
        {
            if (selection == null)
            {
                return;
            }

            /*
             * Time complexity: O(n)
             *
             * NOTE(jenchieh): might need to change this if we there are
             * more than 30 selections.
             */
            for (int index = 0;
                 index < mSelections.Count;
                 ++index)
            {
                JCS_ButtonSelection bs = mSelections[index];

                if (bs == selection)
                {
                    SelectSelection(index, hoverCheck);
                    return;
                }
            }

            JCS_Debug.LogError(@"Try to select a selection, but seems like the 
selection is not in the group...");
        }
        //========================================
        //      Unity's function
        //------------------------------
        protected override void Awake()
        {
            base.Awake();

            // record down the position
            mRectTransform = this.GetComponent <RectTransform>();

            if (mMask == null)
            {
                JCS_Debug.LogError(
                    "No mask applied...");
                return;
            }

            this.transform.SetParent(mMask.transform);
            mMaskRectTransform = this.mMask.GetComponent <RectTransform>();

            mMaskTargetPosition = this.mMaskRectTransform.localPosition;

            // min value cannot be lower or equal to max value
            if (mMinValue >= mMaxValue)
            {
                mMinValue = mMaxValue + 1;  // force min < max value
            }
        }
예제 #8
0
        private void OnEnable()
        {
            if (mTargetTransform == null)
            {
                JCS_Debug.LogError(
                    "Cannot set the calculate circle position with null target transform...");
                return;
            }

            // on enable set the random position
            // with in the circle range.

            // get the position.
            Vector3 newPos = CalculateCirclePosition();

            // set to the position.
            if (mReverseDirection)
            {
                // set the target transform.
                this.mDisableWidthCertainRangeEvent.SetTargetTransfrom(null);
                this.mDisableWidthCertainRangeEvent.TargetPosition = newPos;

                // starting position.
                SetPosition(this.mTargetTransform.position);
            }
            else
            {
                // set the target transform.
                this.mJCSTweener.SetTargetTransform(this.mTargetTransform);
                this.mDisableWidthCertainRangeEvent.SetTargetTransfrom(this.mTargetTransform);

                // starting position.
                SetPosition(newPos);
            }

            mJCSTweener.UpdateUnityData();

            // reset alpha change.
            mJCSTweener.LocalAlpha = 1.0f;

            // enable the sprite renderer component.
            mJCSTweener.LocalEnabled = true;

            // reset tweener
            mJCSTweener.ResetTweener();

            // update the unity data first.
            if (mReverseDirection)
            {
                /*
                 * Reverse could only use DoTween, cannot
                 * use DoTweenContinue.
                 */
                mJCSTweener.DoTween(newPos);
            }
            else
            {
                mJCSTweener.DoTweenContinue(this.mTargetTransform);
            }
        }
예제 #9
0
        /// <summary>
        /// Actually make the text render on the screen.
        /// </summary>
        private void UpdateTextRender()
        {
#if TMP_PRO
            if (mTextContainer == null && mTextMesh == null)
#else
            if (mTextContainer == null)
#endif
            {
                JCS_Debug.LogError("Text slot cannot be null references...");
                return;
            }

            double renderNumber       = System.Math.Round(mCurrentNumber, mRoundPlace);
            string renderNumberString = renderNumber.ToString();
            if (mPlusSignWhenPositive && JCS_Mathf.isPositive(renderNumber))
            {
                renderNumberString = "+" + renderNumberString;
            }

            mFullString
                = PreString
                  + renderNumberString
                  + PostString;

            if (mTextContainer)
            {
                mTextContainer.text = mFullString;
            }
#if TMP_PRO
            if (mTextMesh)
            {
                mTextMesh.text = mFullString;
            }
#endif
        }
        /// <summary>
        /// Randomly pick one attack animation.
        /// </summary>
        /// <returns> animation index to attack state. </returns>
        private JCS_AttackState GetRandomAttackState()
        {
            // apply a random attack animation.
            int attackAnimIndex = JCS_Random.Range(1, mAttackAnimationCount + 1);

            switch (attackAnimIndex)
            {
            case 1:
                return(JCS_AttackState.ATTACK_01);

            case 2:
                return(JCS_AttackState.ATTACK_02);

            case 3:
                return(JCS_AttackState.ATTACK_03);

            case 4:
                return(JCS_AttackState.ATTACK_04);

            case 5:
                return(JCS_AttackState.ATTACK_05);
            }

            JCS_Debug.LogError("This shouldn't happens");

            // this sould not happens.
            return(JCS_AttackState.ATTACK_01);
        }
        /// <summary>
        /// Do this when transfering to different server.
        ///
        /// For instance:
        /// Login Server -> Channel Server
        /// </summary>
        /// <param name="hostname"> Host name </param>
        /// <param name="port"> Port Number </param>
        /// <param name="force"> force to switch server? (Default : false) </param>
        /// <param name="handler"> handler handle packet income. </param>
        public void SwitchServer(
            string hostname,
            int port,
            bool force,
            JCS_ClientHandler handler)
        {
            if (instance.HOST_NAME == hostname &&
                instance.PORT == port &&
                handler == null)
            {
                JCS_Debug.LogError(
                    "Not need to switch server, we already in....");
                return;
            }

            // update hostname, port, and handler.
            instance.HOST_NAME = hostname;
            instance.PORT      = port;
            if (handler != null)
            {
                PresetClientHandler(handler);
            }

            // start switching server.
            ON_SWITCH_SERVER = true;

            FORCE_SWITCH_SERVER = force;
        }
예제 #12
0
        /// <summary>
        /// Fix the percentage of the liquid bar shown.
        /// </summary>
        private void FixPercentage()
        {
            if (mCurrentValue < mMinValue ||
                mCurrentValue > mMaxValue)

            {
                JCS_Debug.LogError(
                    "JCS_GUILiquidBar",

                    "Value should with in min(" + mMinValue + ") ~ max(" + mMaxValue + ") value");

                return;
            }

            float realValue         = mMaxValue - mMinValue;
            float currentPercentage = mCurrentValue / realValue;


            float realDistance = (mMaxPos - mMinPos) * currentPercentage;

            switch (GetAlign())
            {
            case JCS_Align.ALIGN_LEFT:
            case JCS_Align.ALIGN_RIGHT:
                mMaskTargetPosition.x = mMinPos + realDistance;
                break;

            case JCS_Align.ALIGN_BOTTOM:
            case JCS_Align.ALIGN_TOP:
                mMaskTargetPosition.y = mMinPos + realDistance;
                break;
            }
        }
        /// <summary>
        /// Process through the server request.
        /// </summary>
        private void ProcessServerRequest()
        {
            for (int index = 0; index < mServerRequest.Count; ++index)
            {
                if (index >= mServerRequest.Count ||
                    index >= mClient.Count ||
                    index >= mBinaryReader.Count)
                {
                    continue;
                }

                JCS_BinaryReader br     = mBinaryReader[index];
                JCS_Client       client = mClient[index];

                try
                {
                    // handle packet.
                    mServerRequest[index].Invoke(br, client);
                }
                catch (System.Exception e)
                {
                    JCS_Debug.LogError("Packet Handle Error : " + e.ToString());
                }
            }

            // done all request, wait for next frame's request.
            mServerRequest.Clear();
            mClient.Clear();
            mBinaryReader.Clear();
        }
        /// <summary>
        /// Decode the buffer by the public key.
        /// </summary>
        /// <param name="message"> buffer to decode. </param>
        /// <returns> decoded message. </returns>
        public System.Object Decode(System.Object message)
        {
            byte[] undecrypted = (byte[])message;

            int packetLength = undecrypted.Length - JCS_NetworkConstant.DECODE_BUFFER_LEN;

            // Check packet length
            if (undecrypted.Length < 0 || undecrypted.Length > JCS_NetworkConstant.INBUFSIZE)
            {
                // TODO(JenChieh): split the packet system
                JCS_Debug.LogError("Packet recieved is too big!!!");
                return(null);
            }

            // decrypt packet and check if damaged / wrong packet
            for (int index = 0; index < JCS_NetworkConstant.DECODE_BUFFER_LEN; ++index)
            {
                if ((char)undecrypted[index] != (char)JCS_NetworkConstant.DECODE_BUFFER[index])
                {
                    JCS_Debug.LogError("Wrong Packet Header!!!");
                    return(null);
                }
            }

            // Get the real message
            byte[] decryptedBuffer = new byte[packetLength];
            for (int index = 0; index < packetLength; ++index)
            {
                decryptedBuffer[index] = undecrypted[index + JCS_NetworkConstant.DECODE_BUFFER_LEN];
            }

            return(decryptedBuffer);
        }
예제 #15
0
        //========================================
        //      Self-Define
        //------------------------------
        //----------------------
        // Public Functions

        /// <summary>
        /// Start the dialogue, in other word same as start a conversation.
        /// </summary>
        /// <param name="script">
        /// Script to use to run the dialogue.
        /// </param>
        public void ActiveDialogue(JCS_DialogueScript script)
        {
            mDialogueScript = script;

            if (mActive)
            {
                JCS_Debug.LogError(
                    "Dialogue System is already active... Failed to active another one.");
                return;
            }

            // check if the script attached is available?
            if (DialogueScript == null)
            {
                return;
            }


            // reset the action, so it will always start
            // from the beginning.
            mDialogueScript.ResetAction();

            // active panel
            PanelActive(true);

            // otherwise active the dialogue
            mActive = true;

            // run the first action.
            RunAction();

            // Play the active dialogue sound.
            JCS_SoundManager.instance.GetGlobalSoundPlayer().PlayOneShot(mActiveSound);
        }
예제 #16
0
        /// <summary>
        /// When player get hit.
        /// </summary>
        public override void Hit()
        {
            if (!mHitEffect)
            {
                JCS_Debug.LogError(
                    "You call the function without checking the hit effect?");

                return;
            }

            ExitClimbing(0);

            int randDirection = JCS_Random.Range(0, 2);        // 0 ~ 1

            // if 0 push right, else if 1 push left
            float pushVel = (randDirection == 0) ? mHitVelX : -mHitVelX;

            // apply force as velocity
            this.mVelocity.x += pushVel;

            // hop a bit. (velcotiy y axis)
            this.mVelocity.y += mHitVelY;


            DoAnimation(JCS_LiveObjectState.STAND);
        }
예제 #17
0
        /// <summary>
        /// Update the time UI
        /// </summary>
        /// <param name="hour"></param>
        /// <param name="minute"></param>
        /// <param name="seocond"></param>
        public void UpdateTimeUI(float hour, float minute, float second)
        {
#if TMP_PRO
            if (mTextContainer == null && mTextMesh == null)
#else
            if (mTextContainer == null)
#endif
            {
                JCS_Debug.LogError("Text slot cannot be null references...");
                return;
            }

            DoHourUI(hour);
            DoMinuteUI(minute);
            DoSecondUI(second);

            if (mTextContainer)
            {
                mTextContainer.text = mHoursText + mMinutesText + mSecondsText;
            }
#if TMP_PRO
            if (mTextMesh)
            {
                mTextMesh.text = mHoursText + mMinutesText + mSecondsText;
            }
#endif
        }
예제 #18
0
        /// <summary>
        /// Encode the message before being sent to the other end.
        /// </summary>
        /// <param name="message"> buffer to encode. </param>
        /// <returns> encoded message. </returns>
        public System.Object Encode(System.Object message)
        {
            byte[] unencrypted = (byte[])message;

            int packetLength = JCS_NetworkConstant.ENCODE_BUFFER_LEN + unencrypted.Length;

            // Check packet length
            if (packetLength < 0 || packetLength > JCS_NetworkConstant.OUTBUFSIZE)
            {
                JCS_Debug.LogError("Packet you are sending is too big!");
                return(null);
            }

            byte[] encryptedBuffer = new byte[packetLength];

            // encrypt the packet for security usage
            for (int index = 0; index < JCS_NetworkConstant.ENCODE_BUFFER_LEN; ++index)
            {
                encryptedBuffer[index] = JCS_NetworkConstant.ENCODE_BUFFER[index];
            }

            // apply message
            for (int index = JCS_NetworkConstant.ENCODE_BUFFER_LEN; index < packetLength; ++index)
            {
                encryptedBuffer[index] = unencrypted[index - JCS_NetworkConstant.ENCODE_BUFFER_LEN];
            }

            return(encryptedBuffer);
        }
예제 #19
0
        /// <summary>
        /// Do all the mimicing for all the mimic animations.
        ///
        /// Simply just have them exact the same frame.
        /// </summary>
        private void DoMimicAnimations()
        {
            /* Cannot have mirror animation as a null reference... */
            if (mMirrorAnimation == null)
            {
                return;
            }

            SpriteRenderer mirrorSR = (SpriteRenderer)mMirrorAnimation.LocalType;

            foreach (JCS_2DAnimation anim in mMimicAnimations)
            {
                if (anim == null)
                {
                    continue;
                }

                if (mMimicFrame)
                {
                    if (mMirrorAnimation.LocalSprite == null)
                    {
                        anim.LocalSprite = null;
                    }
                    else
                    {
                        anim.PlayFrame(mMirrorAnimation.CurrentPlayingFrame);
                    }
                }

                if (mMimcFlip)
                {
                    anim.LocalFlipX = mMirrorAnimation.LocalFlipX;
                    anim.LocalFlipY = mMirrorAnimation.LocalFlipY;
                }


#if (UNITY_EDITOR)
                if (mMirrorAnimation.GetObjectType() != JCS_UnityObjectType.SPRITE ||
                    anim.GetObjectType() != JCS_UnityObjectType.SPRITE)
                {
                    JCS_Debug.LogError(
                        "Mimic order layer and mimic color has to be sprite renderer, not something else...");
                    continue;
                }
#endif

                if (mMimicColor)
                {
                    anim.LocalColor = mMirrorAnimation.LocalColor;
                }

                SpriteRenderer animSR = (SpriteRenderer)anim.LocalType;

                if (mMimicSortingOrder)
                {
                    animSR.sortingOrder = mirrorSR.sortingOrder;
                }
            }
        }
예제 #20
0
        /// <summary>
        /// Do aspect ratio calculation to webcam.
        /// </summary>
        private void DoAspect()
        {
            if (mWebCamTexture == null)
            {
                return;
            }

            if (mManuallySetSize)
            {
                return;
            }

            if (!mDetectDevice)
            {
                JCS_Debug.LogError("No webcam detected in the current devices");
                return;
            }

            if (GetRectTransform() != null)
            {
                var scs = JCS_ScreenSettings.instance;

                float screenWidth  = scs.STANDARD_SCREEN_SIZE.width;
                float screenHeight = scs.STANDARD_SCREEN_SIZE.height;

                float xRatio = screenWidth / (float)mWebCamTexture.width;
                float yRatio = screenHeight / (float)mWebCamTexture.height;

                float width  = 0.0f;
                float height = 0.0f;

                bool mode = (mMustBeFullScreen) ? (screenWidth > screenHeight) : (screenWidth < screenHeight);

                if (mode)
                {
                    width  = screenWidth;
                    height = (float)mWebCamTexture.height * xRatio;
                }
                else
                {
                    width  = (float)mWebCamTexture.width * yRatio;
                    height = screenHeight;
                }

                this.GetRectTransform().sizeDelta = new Vector2(width, height);
            }

            float scaleY = mWebCamTexture.videoVerticallyMirrored ? -1f : 1f;
            {
                Vector3 newScale = this.LocalScale;
                newScale.y     *= scaleY;
                this.LocalScale = newScale;
            }

            int orient = -this.mWebCamTexture.videoRotationAngle;

            this.LocalEulerAngles = new Vector3(0.0f, 0.0f, orient);
        }
예제 #21
0
        /// <summary>
        /// Take a snapshot and store image to data path.
        /// </summary>
        public string TakeSnapshotWebcam()
        {
            // No device detected!!
            // cannot take snap shot without the device!!
            if (!mDetectDevice)
            {
                JCS_Debug.LogError("No webcam detected in the current devices");
                return null;
            }

            var gs = JCS_GameSettings.instance;
            var prefix = gs.WEBCAM_FILENAME;
            var ext = gs.WEBCAM_EXTENSION;

            string savePath = SavePath();

            JCS_IO.CreateDirectory(savePath);

            Texture2D snap = new Texture2D(mWebCamTexture.width, mWebCamTexture.height);
            snap.SetPixels(mWebCamTexture.GetPixels());
            snap.Apply();

            // get the last saved webcam image's index
            int last_saved_index = LastImageFileIndex() + 1;

            string fullPath = ImagePathByIndex(last_saved_index);

            File.WriteAllBytes(fullPath, snap.EncodeToPNG());


            if (mSplash)
            {
                JCS_SceneManager sm = JCS_SceneManager.instance;

                if (sm.GetWhiteScreen() == null)
                    JCS_UtilityFunctions.PopJCSWhiteScreen();

                sm.GetWhiteScreen().FadeIn();

                // do the snap shot effect
                mSplashEffectTrigger = true;
            }

            // Stop the camera
            mWebCamTexture.Pause();

            // start the timer wait for resume
            mResumeTrigger = true;

            // play sound.
            {
                var soundm = JCS_SoundManager.instance;
                JCS_SoundPlayer sp = soundm.GetGlobalSoundPlayer();
                sp.PlayOneShot(mTakePhotoSound);
            }

            return fullPath;
        }
예제 #22
0
        /// <summary>
        /// Initialize all the buttons' scale size.
        /// </summary>
        private void InitAsympScale()
        {
            // if not this effect, return it.
            if (!mAsympEffect)
            {
                return;
            }

            JCS_RollSelectorButton currentBtn = null;

            int centerIndex = JCS_Mathf.FindMiddleIndex(mButtons.Length);

            // initialzie the scroll index.
            for (int index = 0;
                 index < mButtons.Length;
                 ++index)
            {
                currentBtn = mButtons[index];

                Vector3 scale = Vector3.zero;
                if (index <= centerIndex)
                {
                    scale = (mAsympDiffScale * index) + mAsympDiffScale;
                }
                else
                {
                    scale = (mAsympDiffScale * (index - ((index - centerIndex) * 2))) + mAsympDiffScale;
                }

                if (mPanelRoot != null)
                {
                    scale.x /= mPanelRoot.PanelDeltaWidthRatio;
                    scale.y /= mPanelRoot.PanelDeltaHeightRatio;
                }

                JCS_ScaleEffect se = currentBtn.GetScaleEffect();

                if (se == null)
                {
                    JCS_Debug.LogError(
                        "JCS_ScaleEffect are null but we still want the effect. plz make sure all the button have JCS_ScaleEffet component!");

                    // close the effect.
                    mAsympEffect = false;

                    return;
                }

                se.RecordScale += scale;

                // the change value plus the original scale.
                // so it will keep the original setting form the
                // level designer.
                se.TowardScale += scale + se.GetScaleValue();

                se.JCS_OnMouseOver();
            }
        }
예제 #23
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="diffIndex"></param>
        private void ApplyTargetForAnim(int diffIndex)
        {
            JCS_RollSelectorButton currentBtn = null;
            JCS_RollSelectorButton targetBtn  = null;

            Vector3[] newTargetPosHolder = new Vector3[mButtons.Length];
            int[]     scrollIndexHolder  = new int[mButtons.Length];

            // asymp scale effect
            Vector3[] newRecordScaleHolder = new Vector3[mButtons.Length];
            Vector3[] newTowardScaleHolder = new Vector3[mButtons.Length];

            for (int index = 0; index < mButtons.Length; ++index)
            {
                int overflowIndex = JCS_Mathf.OverFlowIndex(index + diffIndex, mButtons.Length);

                currentBtn = mButtons[index];
                targetBtn  = mButtons[overflowIndex];

                if (currentBtn == null || targetBtn == null)
                {
                    JCS_Debug.LogError("Missing `JCS_Button` assign in the inspector...");
                    continue;
                }

                Vector3 newTargetPos = currentBtn.SimpleTrackAction.TargetPosition;

                newTargetPos = targetBtn.SimpleTrackAction.TargetPosition;

                newTargetPosHolder[index] = newTargetPos;
                scrollIndexHolder[index]  = targetBtn.ScrollIndex;

                if (mAsympEffect)
                {
                    newRecordScaleHolder[index] = targetBtn.GetScaleEffect().RecordScale;
                    newTowardScaleHolder[index] = targetBtn.GetScaleEffect().TowardScale;
                }
            }

            for (int index = 0; index < mButtons.Length; ++index)
            {
                currentBtn = mButtons[index];

                currentBtn.SimpleTrackAction.TargetPosition = newTargetPosHolder[index];

                currentBtn.ScrollIndex = scrollIndexHolder[index];

                if (mAsympEffect)
                {
                    JCS_ScaleEffect se = currentBtn.GetScaleEffect();

                    se.RecordScale = newRecordScaleHolder[index];
                    se.TowardScale = newTowardScaleHolder[index];
                    se.Active();
                }
            }
        }
 /// <summary>
 ///
 /// </summary>
 public void WalkSound()
 {
     if (mWalkSound == null)
     {
         JCS_Debug.LogError("Play sound with null references...");
         return;
     }
     mSoundPlayer.PlayOneShot(mWalkSound, JCS_SoundSettings.instance.GetSkillsSound_Volume());
 }
예제 #25
0
        /// <summary>
        /// Reset the camera.
        /// </summary>
        public void ResetCamera()
        {
            if (mTargetTransform == null)
            {
                JCS_Debug.LogError("There is no target to reset the camera!");
                return;
            }

            SetToRevoluationAngle(mResetTargetAngle);
        }
        /// <summary>
        /// Hide the game UI.
        /// </summary>
        public void HideGameUI()
        {
            if (mGameUI == null)
            {
                JCS_Debug.LogError("Game UI is not an avialiable references");
                return;
            }

            mGameUI.Hide(true);
        }
예제 #27
0
        //----------------------
        // Protected Variables

        //========================================
        //      setter / getter
        //------------------------------

        //========================================
        //      Unity's function
        //------------------------------
        private void Awake()
        {
            this.mAudioSource = this.GetComponent <AudioSource>();

            // Check to see if there is audio attach in the game or not!
            if (mAudioSource.clip == null)
            {
                JCS_Debug.LogError("Sound Effect Object with out audio clip init...");
            }
        }
예제 #28
0
        /* Setter & Getter */

        /* Functions */

        protected override void Awake()
        {
            base.Awake();

            if (mPositionPlatform == null)
            {
                JCS_Debug.LogError(
                    "U have a ladder without a platform/ground to lean on.");
            }
        }
예제 #29
0
        /// <summary>
        /// When button get focus, design the code here...
        /// </summary>
        private void SetFocus()
        {
            if (mRollBtnSelector == null)
            {
                JCS_Debug.LogError("This button has been set focus but without the handler");
                return;
            }

            mRollBtnSelector.SetFocusSelector(this);
        }
예제 #30
0
        /// <summary>
        /// Check if spawning the game ui is fine. If already exists
        /// then is not fine.
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        private static bool CheckIfOkayToSpawnGameUI(JCS_DialogueType type)
        {
            if (JCS_UIManager.instance.GetJCSDialogue(type) != null)
            {
                JCS_Debug.LogError("(" + type.ToString() + ")No able to spawn Game UI cuz there are multiple GameUI in the scene...");
                return(false);
            }

            return(true);
        }