private IEnumerator MovementNpcX(Wave wave, GameObject npc, Vector3 dstPos, int listIndex, float sign) { yield return(new WaitForSeconds(MovementData.npcMoveTime * listIndex * MovementData.waitBeforeMoveNextNpc)); Vector3 startPos = npc.transform.position; GameEntities.NPCs.NPC npcC = npc.GetComponent <GameEntities.NPCs.NPC>(); npcC.StartMove(); float startMove = 0.5f; // percent value float endMove = 0.4f; // percent value float moveDuration = (1f - startMove) * MovementData.npcMoveTime + endMove * MovementData.npcMoveTime; yield return(npcC.StartCoroutine(OnWayMovementNpcX(npc, startPos, dstPos, sign, startMove, 1, 0, moveDuration, false))); yield return(npcC.StartCoroutine(OnWayMovementNpcX(npc, startPos, dstPos, sign, -1, endMove, (1f - startMove) * MovementData.npcMoveTime, moveDuration, true))); npcC.EndMove(); }