-
Notifications
You must be signed in to change notification settings - Fork 8
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
Showing
9 changed files
with
88 additions
and
3 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,34 @@ | ||
using SCHIZO.Helpers; | ||
using Story; | ||
|
||
namespace SCHIZO.Items.Components; | ||
partial class DestroyOnStoryGoal : IStoryGoalListener | ||
{ | ||
private string storyGoal; | ||
public void Start() | ||
{ | ||
storyGoal = RetargetHelpers.Pick(storyGoalSN, storyGoalBZ); | ||
StoryGoalManager.main.AddListener(this); | ||
UpdateActive(); | ||
} | ||
|
||
private void OnDestroy() | ||
{ | ||
StoryGoalManager.main.RemoveListener(this); | ||
} | ||
|
||
public void NotifyGoalComplete(string key) => UpdateActive(key); | ||
|
||
public void NotifyGoalReset(string key) => UpdateActive(key); | ||
|
||
public void NotifyGoalsDeserialized() => UpdateActive(); | ||
|
||
private void UpdateActive(string key = null) | ||
{ | ||
if (key is { } && !StoryGoalHelpers.Matches(key, storyGoal)) | ||
return; | ||
|
||
if (StoryGoalHelpers.IsCompleted(storyGoal)) | ||
Destroy(GetComponentInParent<PrefabIdentifier>().gameObject); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...tures/Components/DisableUntilStoryGoal.cs → ...Items/Components/DisableUntilStoryGoal.cs
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
13 changes: 13 additions & 0 deletions
13
Unity/Assets/Scripts/SCHIZO/Items/Components/DestroyOnStoryGoal.cs
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,13 @@ | ||
using TriInspector; | ||
using UnityEngine; | ||
|
||
namespace SCHIZO.Items.Components | ||
{ | ||
public sealed partial class DestroyOnStoryGoal : MonoBehaviour | ||
{ | ||
[LabelText("Story Goal (SN)")] | ||
public string storyGoalSN; | ||
[LabelText("Story Goal (BZ)")] | ||
public string storyGoalBZ; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Unity/Assets/Scripts/SCHIZO/Items/Components/DestroyOnStoryGoal.cs.meta
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
File renamed without changes.
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,9 @@ | ||
using SCHIZO.TriInspector.Attributes; | ||
using TriInspector; | ||
using UnityEngine; | ||
|
||
[DeclareComponentReferencesGroup] | ||
public class DestroyDuplicates : MonoBehaviour | ||
{ | ||
[ComponentReferencesGroup, Required] public PrefabIdentifier identifier; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.