nomoney4u
nomoney4u
Explore posts from servers
JCHJava Community | Help. Code. Learn.
Created by nomoney4u on 1/9/2025 in #java-help
Configuring Eclipse to use explode war with Tomcat for debugging
I'm a bit new to the Java world and am trying to configure my local environment for a new job. I was able to load my project into IntelliJ Ultimate (IJU) and am trying to replicate the same configuration but in Eclipse because it seems that the Web module/plugin for IJU is not available for IJ CE. Can anyone or @dan1st | Daniel help me configure my Eclipse for this project? Goal: Able to add breakpoint and/or hot-reload Java codes for debugging and development without having to constantly compile and deploy the war file. Thank you in advance.
307 replies
CC#
Created by nomoney4u on 2/19/2024 in #help
Trying to understand this abstract code (and use it elsewhere)
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public abstract class AbstractDungeonGenerator : MonoBehaviour
{
[SerializeField]
protected TilemapVisualizer tilemapVisualizer = null;
[SerializeField]
protected Vector2Int startPosition = Vector2Int.zero;

public void GenerateDungeon() {
tilemapVisualizer.Clear();
RunProceduralGeneration();
}

protected abstract void RunProceduralGeneration();
}
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public abstract class AbstractDungeonGenerator : MonoBehaviour
{
[SerializeField]
protected TilemapVisualizer tilemapVisualizer = null;
[SerializeField]
protected Vector2Int startPosition = Vector2Int.zero;

public void GenerateDungeon() {
tilemapVisualizer.Clear();
RunProceduralGeneration();
}

protected abstract void RunProceduralGeneration();
}
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using Random = UnityEngine.Random;

public class SimpleRandomWalkDungeonGenerator : AbstractDungeonGenerator
{
[SerializeField]
private int iterations = 10;
[SerializeField]
public int walkLength = 10;
[SerializeField]
public bool startRandomlyEachIteration = true;

protected override void RunProceduralGeneration()
{
HashSet<Vector2Int> floorPositions = RunRandomWalk();
tilemapVisualizer.Clear();
tilemapVisualizer.PaintFloorTiles(floorPositions);
}

protected HashSet<Vector2Int> RunRandomWalk()
{
var currentPosition = startPosition;
HashSet<Vector2Int> floorPositions = new HashSet<Vector2Int>();
for (int i = 0; i < iterations; i++)
{
var path = ProceduralGenerationAlg.SimpleRandomWalk(currentPosition, walkLength);
floorPositions.UnionWith(path);
if (startRandomlyEachIteration)
currentPosition = floorPositions.ElementAt(Random.Range(0, floorPositions.Count));
}
return floorPositions;
}
}
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using Random = UnityEngine.Random;

public class SimpleRandomWalkDungeonGenerator : AbstractDungeonGenerator
{
[SerializeField]
private int iterations = 10;
[SerializeField]
public int walkLength = 10;
[SerializeField]
public bool startRandomlyEachIteration = true;

protected override void RunProceduralGeneration()
{
HashSet<Vector2Int> floorPositions = RunRandomWalk();
tilemapVisualizer.Clear();
tilemapVisualizer.PaintFloorTiles(floorPositions);
}

protected HashSet<Vector2Int> RunRandomWalk()
{
var currentPosition = startPosition;
HashSet<Vector2Int> floorPositions = new HashSet<Vector2Int>();
for (int i = 0; i < iterations; i++)
{
var path = ProceduralGenerationAlg.SimpleRandomWalk(currentPosition, walkLength);
floorPositions.UnionWith(path);
if (startRandomlyEachIteration)
currentPosition = floorPositions.ElementAt(Random.Range(0, floorPositions.Count));
}
return floorPositions;
}
}
I am trying to get access to SimpleRandomWalkDungeonGenerator.RunProceduralGeneration from another class but I understand that it is protected. I'm not sure how get access to that function without removing abstract from AbstractDungeonGenerator (stuffs will break). Does anyone have any suggestions?
12 replies