protected virtual void MoveAlongConveyor() { if (MoveWithConveyor && !isLaunching) { rb.velocity = new Vector2(ConveyorSpeed.GetSpeed(), rb.velocity.y); } }
private void SpawnPotatoIfNeeded() { if (potatoesLeft > 0 && TimeKeeper.GetTime() > nextPotato) { animator.SetTrigger("Spawn"); SoundEvents.Play("ItemDrop"); var newPotato = Instantiate(potatoes[3 - potatoesLeft], GetSpawnPosition(), spawnTransform.rotation); newPotato.velocity = new Vector2(ConveyorSpeed.GetSpeed(), 0); newPotato.angularVelocity = UnityEngine.Random.Range(40, 180); potatoesLeft--; nextPotato = TimeKeeper.GetTime() + timeBetweenPotatoes; } }
private void FixedUpdate() { rb.velocity = new Vector2(ConveyorSpeed.GetSpeed(), 0); }