private void FixedUpdate() { if (enemyList.enemies.Count == 0 && !heroBeingMoved) { AdvanceToNextWave(); uiScript.stage.Finished = true; newHeroPosition.x = hero.transform.position.x + 11; enemyList.StartingPosition = newHeroPosition; heroBeingMoved = true; } if (heroBeingMoved) { Rigidbody2D heroRigid = hero.GetComponent <Rigidbody2D>(); heroRigid.velocity = heroRigid.velocity.normalized * 5f; if (Math.Abs(Vector3.Distance(hero.transform.position, newHeroPosition)) > 0.5) { } else { //uiScript.stage.bgObjecttmp.transform.position = new Vector3(uiScript.stage.bgObjecttmp.transform.position.x + uiScript.stage.bgIncrement, uiScript.stage.bgObjecttmp.transform.position.y, uiScript.stage.bgObjecttmp.transform.position.z); heroRigid = hero.GetComponent <Rigidbody2D>(); heroRigid.velocity = new Vector2(0f, heroRigid.velocity.y); heroBeingMoved = false; enemyList.AddEnemyToScene(hero.transform.position); enemyList.AddEnemyToScene(hero.transform.position); enemyList.AddEnemyToScene(hero.transform.position); } } if (enemyList.enemies.Count != 0) { if (Input.GetMouseButtonUp(0)) { enemyList.DamageEnemies(DamageTypeEnum.DamageTypes.Single_RandomTarget_Damage); } } }