-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0b5b010
commit 09d8e71
Showing
7 changed files
with
162 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using FieldDay; | ||
using FieldDay.Systems; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
namespace Zavala.Economy | ||
{ | ||
// Process after BlueprintOverlaySystem and BlueprintSystem | ||
[SysUpdate(GameLoopPhase.LateUpdate, 500)] | ||
public class BlueprintResetSystem : SharedStateSystemBehaviour<BlueprintState> | ||
{ | ||
public override void ProcessWork(float deltaTime) | ||
{ | ||
// Reset any triggers that were fired | ||
|
||
// Blueprint mode opened | ||
if (m_State.StartBlueprintMode) { m_State.StartBlueprintMode = false; } | ||
|
||
// Exited blueprint mode | ||
if (m_State.ExitedBlueprintMode) { m_State.ExitedBlueprintMode = false; } | ||
|
||
// Build clicked | ||
if (m_State.NewBuildConfirmed) { m_State.NewBuildConfirmed = false; } | ||
|
||
// Changed number of commits to process | ||
if (m_State.NumBuildCommitsChanged) { m_State.NumBuildCommitsChanged = false; } | ||
|
||
// Changed number of commits to process | ||
if (m_State.NumDestroyActionsChanged) { m_State.NumDestroyActionsChanged = false; } | ||
|
||
// Clicked the Undo button (in Build mode) | ||
if (m_State.UndoClickedBuild) { m_State.UndoClickedBuild = false; } | ||
|
||
// Clicked the Undo button (in Build mode) | ||
if (m_State.UndoClickedDestroy) { m_State.UndoClickedDestroy = false; } | ||
|
||
// Clicked the Destroy Mode button (from Build mode) | ||
if (m_State.DestroyModeClicked) { m_State.DestroyModeClicked = false; } | ||
|
||
// Destroy clicked | ||
if (m_State.NewDestroyConfirmed) { m_State.NewDestroyConfirmed = false; } | ||
|
||
// Clicked the Exit button (from Destroy mode) | ||
if (m_State.CanceledDestroyMode) { m_State.CanceledDestroyMode = false; } | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using FieldDay; | ||
using FieldDay.Systems; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
using Zavala.Building; | ||
using Zavala.Economy; | ||
using Zavala.Input; | ||
using Zavala.Sim; | ||
using Zavala.World; | ||
|
||
namespace Zavala.Rendering | ||
{ | ||
/// <summary> | ||
/// Controls an object that snaps to the tile under the mouse cursor | ||
/// </summary> | ||
[SysUpdate(GameLoopPhase.Update, 400)] | ||
public class BlueprintOverlaySystem : SharedStateSystemBehaviour<BlueprintState> | ||
{ | ||
public override void ProcessWork(float deltaTime) | ||
{ | ||
// Changed number of commits to process | ||
if (m_State.NumBuildCommitsChanged) | ||
{ | ||
RegenerateOverlayMesh(); | ||
return; | ||
} | ||
|
||
// Render destroy bulldozer when in destroy mode | ||
if (m_State.IsActive && m_State.CommandState == ActionType.Build) | ||
{ | ||
if (m_State.OverlayMesh == null) | ||
{ | ||
// Generate new mesh | ||
RegenerateOverlayMesh(); | ||
return; | ||
} | ||
} | ||
else if (m_State.OverlayMesh != null) | ||
{ | ||
// Remove the old mesh | ||
DestroyOverlayMesh(); | ||
} | ||
} | ||
|
||
private void RegenerateOverlayMesh() | ||
{ | ||
m_State.OverlayMesh = new Mesh(); | ||
} | ||
|
||
private void DestroyOverlayMesh() | ||
{ | ||
m_State.OverlayMesh = null; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters