Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
Binary file modified Assets/Materials/sphereMap.mat
Binary file not shown.
Binary file modified Assets/Materials/sphereMapActivity.mat
Binary file not shown.
Binary file modified Assets/Materials/sphereMapOverlay.mat
Binary file not shown.
Binary file modified Assets/Materials/sphereMapOverlayDrainage.mat
Binary file not shown.
8 changes: 8 additions & 0 deletions Assets/Resources.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Assets/Resources/BillingMode.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"androidStore":"GooglePlay"}
7 changes: 7 additions & 0 deletions Assets/Resources/BillingMode.json.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 14 additions & 27 deletions Assets/Scripts/2D/GuiManagerScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1985,15 +1985,22 @@ private bool TryCompleteGroupSelectionRequest(
private void ClickOp_SelectPopulationPlacement(Vector2 mapPosition)
{
int population = AddPopulationDialogScript.Population;
int longitude = (int)mapPosition.x;
int latitude = (int)mapPosition.y;

if (AddPopulationGroupAtPosition(mapPosition, population))
if (Manager.CanAddPopulationGroupAtPosition(longitude, latitude))
{
Manager.GenerateHumanGroup(longitude, latitude, population);
UninterruptSimAndShowHiddenInterPanels();

DisplayTip_MapScroll();

_mapLeftClickOp -= ClickOp_SelectPopulationPlacement;
}
// else {
//TODO: have some sort of visual feedback:
// 1. use the tooltip panel to display "Invalid cell for initial population."
// 2. highlight the cell with red (go back to normal color once pointer is not over the cell)
// }

}

public void SelectPopulationPlacement()
Expand All @@ -2004,39 +2011,19 @@ public void SelectPopulationPlacement()

SetStartingSpeed(AddPopulationDialogScript.StartSpeedLevelIndex);

Debug.Log(string.Format("Player chose to select cell for population placement of {0}...", population));
Debug.LogFormat("Player chose to select cell for population placement of {0}...", population);

if (population <= 0)
{
Debug.LogWarningFormat("Obtained a negative population value from AddPopulationDialogScript: {0}", population);
return;
}

DisplayTip_InitialPopulationPlacement();

_mapLeftClickOp += ClickOp_SelectPopulationPlacement;
}

private bool AddPopulationGroupAtPosition(Vector2 mapPosition, int population)
{
World world = Manager.CurrentWorld;

int longitude = (int)mapPosition.x;
int latitude = (int)mapPosition.y;

if ((longitude < 0) || (longitude >= world.Width))
return false;

if ((latitude < 0) || (latitude >= world.Height))
return false;

TerrainCell cell = world.GetCell(longitude, latitude);

if (cell.IsLiquidSea)
return false;

Manager.GenerateHumanGroup(longitude, latitude, population);

return true;
}

private void DisplayTip_InitialPopulationPlacement()
{
if (_displayedTip_initialPopulation)
Expand Down
16 changes: 16 additions & 0 deletions Assets/Scripts/WorldEngine/Manager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1315,6 +1315,22 @@ private static void AddHoveredCellsToHighlight(
UpdatedCells.UnionWith(cells);
}

public static bool CanAddPopulationGroupAtPosition(int longitude, int latitude)
{
if ((longitude < 0) || (longitude >= CurrentWorld.Width))
return false;

if ((latitude < 0) || (latitude >= CurrentWorld.Height))
return false;

TerrainCell cell = CurrentWorld.GetCell(longitude, latitude);

if (cell.IsLiquidSea || cell.Survivability < World.MinSurvivabilityForUserGroupPlacement)
return false;

return true;
}

public static void GenerateRandomHumanGroup(int initialPopulation)
{
World world = _manager._currentWorld;
Expand Down
1 change: 1 addition & 0 deletions Assets/Scripts/WorldEngine/World.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public class World : ISynchronizable, IWorldDateGetter
public const int MaxStartingPopulation = 100000;

public const float MinSurvivabilityForRandomGroupPlacement = 0.15f;
public const float MinSurvivabilityForUserGroupPlacement = 0.15f;

public const float TerrainGenerationSteps = 9;

Expand Down
76 changes: 73 additions & 3 deletions Assets/Sprites/min_max.png.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions Logs/Packages-Update.log
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,20 @@ Update Mode: updateDependencies
The following packages were updated:
com.unity.ide.vscode from version 1.2.0 to 1.2.1
com.unity.test-framework from version 1.1.13 to 1.1.14

=== Sun Oct 2 22:41:16 2022

Packages were changed.
Update Mode: updateDependencies

The following packages were added:
com.unity.ide.visualstudio@2.0.16
The following packages were updated:
com.unity.analytics from version 3.3.5 to 3.6.12
com.unity.collab-proxy from version 1.2.16 to 1.17.2
com.unity.ext.nunit from version 1.0.0 to 1.0.6
com.unity.ide.rider from version 1.1.4 to 3.0.15
com.unity.ide.vscode from version 1.2.1 to 1.2.5
com.unity.purchasing from version 2.0.6 to 4.4.1
com.unity.test-framework from version 1.1.14 to 1.1.31
com.unity.timeline from version 1.2.6 to 1.6.4
17 changes: 9 additions & 8 deletions Packages/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
"dependencies": {
"com.unity.2d.sprite": "1.0.0",
"com.unity.2d.tilemap": "1.0.0",
"com.unity.analytics": "3.3.5",
"com.unity.collab-proxy": "1.2.16",
"com.unity.ext.nunit": "1.0.0",
"com.unity.ide.rider": "1.1.4",
"com.unity.ide.vscode": "1.2.1",
"com.unity.purchasing": "2.0.6",
"com.unity.test-framework": "1.1.14",
"com.unity.timeline": "1.2.6",
"com.unity.analytics": "3.6.12",
"com.unity.collab-proxy": "1.17.2",
"com.unity.ext.nunit": "1.0.6",
"com.unity.ide.rider": "3.0.15",
"com.unity.ide.visualstudio": "2.0.16",
"com.unity.ide.vscode": "1.2.5",
"com.unity.purchasing": "4.4.1",
"com.unity.test-framework": "1.1.31",
"com.unity.timeline": "1.6.4",
"com.unity.ugui": "1.0.0",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0",
Expand Down
Loading