void Update() { Vector2 pos = transform.position; pos.x += mDirection.x * mSpeed * Time.deltaTime; pos.y += mDirection.y * mSpeed * Time.deltaTime; mHeightTime += Time.deltaTime; float deltaY = CEasingFunc.EaseCircIn(mHeightTime, 0, 0.02f, mHeightDuration); pos.y -= deltaY; if ((mHeightTime / mHeightDuration) > 0.9f) { Destroy(this.gameObject); } transform.position = pos; }
IEnumerator DoMoveCamera() { Transform tParent = mNextDoor.transform.parent; Transform tCamera = tParent.GetComponentInParent <CMap>().Scene.mMainCamera.transform; float tTime = 0; float tDuration = 0.3f; Vector2 tStartPos = tCamera.position; while (tTime < tDuration) { Vector2 pos = tCamera.position; pos.x = CEasingFunc.EaseExpoInOut(tTime, tStartPos.x, tParent.position.x - tStartPos.x, tDuration); pos.y = CEasingFunc.EaseExpoInOut(tTime, tStartPos.y, tParent.position.y - tStartPos.y, tDuration); tCamera.position = pos; tTime += Time.deltaTime; yield return(null); } tCamera.position = tParent.position; }