private void HandleMovement() { if (isMoving) { transform.position = Vector3.MoveTowards(transform.position, TargetPosition, _movementSpeed * Time.deltaTime); if ((Vector2)transform.position == TargetPosition) { isMoving = false; LastPosition = TargetPosition; StaticTile.GetStaticTile(LastPosition)?.Interact(this); GameEvents.Emit("PlayerEndStep"); } } }
private void CreateHazards() { for (int i = 0; i < Map.GetLength(0); i++) { for (int j = 0; j < Map.GetLength(1); j++) { Tile t = GetTile(new Vector2(i, j)); if (t != null && t.hasNoBorders && t.hasNoInsets) { if (StaticTile.GetStaticTile(new Vector2(i, j)) == null) { if (Random.value < 0.1) { Instantiate(spikes, new Vector3(i, j, 0), spikes.transform.rotation, transform); } if (Random.value < 0.05f) { Instantiate(enemy, new Vector3(i, j, 0), enemy.transform.rotation, transform); } } } } } }