Skip to content

Commit

Permalink
Hide once a remote creature has been shown for the first time (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
daniellochner committed Jul 4, 2023
1 parent 7acedfa commit 2a8ce0f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,8 @@ public override void Setup()
base.Setup();
Selectable.Setup();

if (!Loader.IsHidden)
{
Loader.ShowToMe();
}
else
{
Loader.OnHide();
}
Loader.OnShow += OnFirstTimeShown;
Loader.ShowToMe();
}

public override void OnDie(DamageReason reason, string inflicter)
Expand Down Expand Up @@ -81,6 +75,15 @@ public override void OnHide()
Collider.enabled = false;
Animator.enabled = false;
}

private void OnFirstTimeShown()
{
if (Loader.IsHidden)
{
Loader.OnHide();
}
Loader.OnShow -= OnFirstTimeShown;
}
#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,8 @@ public override void Setup()
Selectable.Setup();
Namer.Setup();

if (!Loader.IsHidden)
{
Loader.ShowToMe();
}
else
{
Loader.OnHide();
}
Loader.OnShow += OnFirstTimeShown;
Loader.ShowToMe();
}

public override void OnDie(DamageReason reason, string inflicter)
Expand Down Expand Up @@ -84,6 +78,15 @@ public override void OnHide()

Namer.enabled = false;
}

private void OnFirstTimeShown()
{
if (Loader.IsHidden)
{
Loader.OnHide();
}
Loader.OnShow -= OnFirstTimeShown;
}
#endregion
}
}

0 comments on commit 2a8ce0f

Please sign in to comment.