private void SetUpPlayer() { var playerTransform = player.transform; var previousPosition = playerTransform.position; playerTransform.position = Currentlevel.playerPosition; player.StartLevel(Currentlevel.time, _retryQuantity); _camera.OnTargetObjectWarped(player.transform, Currentlevel.playerPosition - (Vector2)previousPosition); }
private void IterateThroughColliders(Vector2 position, Vector2 destination, int size) { for (int i = 0; i < size; i++) { var damageReceiver = _hits[i].collider.GetComponent <DamageReceiver>(); if (damageReceiver != null) { damageReceiver.ReceiveDamage(damage, position); } else { HitWall(_hits[i].point); return; } } _camera.OnTargetObjectWarped(transform, destination - _rigidBody.position); _rigidBody.position = destination; // _rigidBody.velocity = Vector2.zero; }