private bool UpdateMaterialColor() { bool nComplete = false; mCurrentColor = ScriptCommon.ColorTarget(mCurrentColor, mTargetColor, ScriptCommon.FrameValue(mPerSecDiscolor), out nComplete); reflect.color = new Color(mCurrentColor.r * mBoxColorFactor, mCurrentColor.g * mBoxColorFactor, mCurrentColor.b * mBoxColorFactor, reflect.color.a); material.SetColor("_Tint", new Color(mCurrentColor.r * mSkyColorFactor, mCurrentColor.g * mSkyColorFactor, mCurrentColor.b * mSkyColorFactor, mCurrentColor.a)); return(nComplete); }
private bool UpdateCameraRotation() { bool nComplete = false; Vector3 nCurrent = viewer.transform.rotation.eulerAngles; Vector3 nRotation = ScriptCommon.RotationTarget(nCurrent, mTargetRotation, ScriptCommon.FrameValue(mPerSecRotate), out nComplete); viewer.transform.rotation = Quaternion.Euler(nRotation.x, nRotation.y, nRotation.z); return(nComplete); }
void Update() { if (!mRunning || mPaused) { return; } float nFrameRotation = ScriptCommon.FrameValue(mFullRotation / mSeconds); RectTransform nTransLeft = goImageLeft.GetComponent <RectTransform>(); if (goImageRight.activeSelf) { RectTransform nTransRight = goImageRight.GetComponent <RectTransform>(); mRotationRight -= nFrameRotation; if (mRotationRight > -mMaxRotation) { if (mSwapped == null && mRotationRight < -mSwapRotation) { mSwapped = goImageMaskRight.GetComponent <Image>().sprite; goImageMaskRight.GetComponent <Image>().sprite = goImageContainer.GetComponent <Image>().sprite; } nTransRight.rotation = Quaternion.Euler(0, 0, mRotationRight); } else { //GetComponent<AudioSource>().Play(); //Danger on goImageRight.SetActive(false); float nOver = -mMaxRotation - mRotationRight; if (nOver > 0) { mRotationLeft -= nOver; nTransLeft.rotation = Quaternion.Euler(0, 0, mRotationLeft); } } } else { mRotationLeft -= nFrameRotation; if (mRotationLeft > -mMaxRotation) { nTransLeft.rotation = Quaternion.Euler(0, 0, mRotationLeft); } else { //GetComponent<AudioSource>().Stop(); //Danger off goImageLeft.SetActive(false); mRunning = false; } } }
void Update() { if (mMove) { float nMove = ScriptCommon.FrameValue(mPerSecMove); if (transform.position.y >= mMoveTo.y) { transform.position = new Vector3(mMoveTo.x, transform.position.y - nMove, mMoveTo.z); if (transform.position.y <= mMoveTo.y) { transform.position = new Vector3(mMoveTo.x, mMoveTo.y, mMoveTo.z); mMove = false; } } else if (transform.position.y < mMoveTo.y) { transform.position = new Vector3(mMoveTo.x, transform.position.y + nMove, mMoveTo.z); if (transform.position.y >= mMoveTo.y) { transform.position = new Vector3(mMoveTo.x, mMoveTo.y, mMoveTo.z); mMove = false; } } } else if (mBust) { mMoveCount++; if (mMoveCount <= mMoveCountToFall) { float nDrop = ScriptCommon.FrameValue(mPerSecDrop); transform.position = new Vector3(transform.position.x, transform.position.y, transform.position.z - nDrop); } else if (mMoveCount <= mMoveCountToExit) { float nDrop = ScriptCommon.FrameValue(mPerSecDrop); float nRotate = ScriptCommon.FrameValue(mPerSecRotate); transform.Rotate(new Vector3(-nRotate, nRotate * mRotDirY, nRotate * mRotDirZ)); transform.position = new Vector3(transform.position.x, transform.position.y - nDrop, transform.position.z); } else { mBust = false; Destroy(gameObject); } } }
private bool UpdateCameraPosition() { bool nComplete = false; float nZ = ScriptCommon.NumberTarget(viewer.transform.position.z, mTargetZ, ScriptCommon.FrameValue(mPerSecMove), out nComplete); viewer.transform.position = new Vector3(mOriginalPosition.x, mOriginalPosition.y, nZ); return(nComplete); }