void Update() { if (isFadeEnd) { return; } time += Time.deltaTime; float alpha = 1.0f; if (fadeType == FadeType.FADEIN) { alpha = easing.CubicIn(easing.DelayTime(time, 0.0f, takeTime), 1.0f, 0.0f); } else if (fadeType == FadeType.FADEOUT) { alpha = easing.CubicIn(easing.DelayTime(time, 0.0f, takeTime), 0.0f, 1.0f); } GetComponent <Image>().color = new Color(fadeColor.r, fadeColor.g, fadeColor.b, alpha); if (time >= takeTime) { isFadeEnd = true; } }
private void Moving() { if (!isMove) { return; } moveTime += Time.deltaTime; float posY; if (moveTime < 0.5f) { posY = easing.CubicOut(easing.DelayTime(moveTime, 0.0f, 0.5f), originPosY, originPosY + jumpSpeed); } else { posY = easing.CubicIn(easing.DelayTime(moveTime, 0.5f, 0.5f), originPosY + jumpSpeed, originPosY); } transform.localPosition = new Vector3( transform.localPosition.x, posY, transform.localPosition.z); if (moveTime >= 1.0f) { moveTime = 0.0f; isMove = false; } }
private void Moving() { if (isMoveEnd) { return; } moveTime += Time.deltaTime; float pos_x = easing.Linear(easing.DelayTime(moveTime, 0.0f, moveTakeTimeList[moveCount]), start_pos.x, movePointList[moveCount].x); float pos_y = easing.Linear(easing.DelayTime(moveTime, 0.0f, moveTakeTimeList[moveCount]), start_pos.y, movePointList[moveCount].y); transform.localPosition = new Vector3(pos_x, pos_y, 0.0f); if (easing.DelayTime(moveTime, 0.0f, moveTakeTimeList[moveCount]) == 1.0f) { moveTime = 0.0f; start_pos = movePointList[moveCount]; moveCount++; if (moveCount >= movePointList.Count) { isMoveEnd = true; } } }
private void UpdateEasing() { if (isEasingEnd) { return; } time += Time.deltaTime; if (time > easingStart[easingStart.Count - 1] + easingTakeTime[easingTakeTime.Count - 1]) { time = easingStart[easingStart.Count - 1] + easingTakeTime[easingTakeTime.Count - 1]; } totalFoodCost = (int)easing.Linear( easing.DelayTime(time, easingStart[0], easingTakeTime[0]), 0.0f, player.OneDayFoodCost); totalAnimalPurchaseCost = (int)easing.Linear( easing.DelayTime(time, easingStart[1], easingTakeTime[1]), 0.0f, player.OneDayAnimalPurchaseCost); totalToyCost = (int)easing.Linear( easing.DelayTime(time, easingStart[2], easingTakeTime[2]), 0.0f, player.OneDayToyCost); totalVisitors = (int)easing.Linear( easing.DelayTime(time, easingStart[3], easingTakeTime[3]), 0.0f, player.OneDayVisitors); totalEntranceFee = (int)easing.Linear( easing.DelayTime(time, easingStart[4], easingTakeTime[4]), 0.0f, player.entranceFee * player.OneDayVisitors); balanceOfPayments = (int)easing.Linear( easing.DelayTime(time, easingStart[5], easingTakeTime[5]), 0.0f, totalEntranceFee - (totalFoodCost + totalAnimalPurchaseCost + totalToyCost)); }