I am making a farming game, and a mechanic i have is placing seeds on soils, but theres different types of soils and different types of seeds. I am trying to get the newly placed seed to access the soils soilQuality which is a double tat will directly affect the growth rate of the seed. The problem is there can be multiple plots of multiple soils, and the seed needs a different growth rate depending on which soils its on. All the soils are a subclass of Soil.
public class cornSeedTile extends Seeds
{
public double growthRate = 1;
public void act()
{
}
public void addedToWorld() {
Soils soil = (Soils)getOneIntersectingObject(Soils.class);
growthRate *= soil.getGrowthRate();
}
}public class basicSoilTile extends Soils
{
public double soilQuality = 2;
}
