From 6835ba513c450ff604521718c1bd3d1947feec48 Mon Sep 17 00:00:00 2001 From: teascade Date: Thu, 23 Apr 2020 14:30:09 +0300 Subject: [PATCH 1/3] Fix StickSpawner bug --- Assets/Scripts/StickSpawner.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/StickSpawner.cs b/Assets/Scripts/StickSpawner.cs index a25164a..03c8376 100644 --- a/Assets/Scripts/StickSpawner.cs +++ b/Assets/Scripts/StickSpawner.cs @@ -52,11 +52,11 @@ public class StickSpawner : MonoBehaviour { LastSpawnedWasCasette = false; } CanSpawnNew = false; - var Stick = GameObject.Instantiate(SpawnedThing, transform.position + Vector3.up * 2, Random.rotation); + var Spawned = GameObject.Instantiate(SpawnedThing, transform.position + Vector3.up * 2, Random.rotation); if (LastSpawnedWasCasette) { - + SpawnedCasette = Spawned.GetComponent(); } else { - SpawnedStick = Stick.GetComponent(); + SpawnedStick = Spawned.GetComponent(); } } From f6e14e0ec4d7a36c26148d191257c7dd6f5f9773 Mon Sep 17 00:00:00 2001 From: Jens Pitkanen Date: Thu, 23 Apr 2020 14:30:36 +0300 Subject: [PATCH 2/3] Fix campfire bug --- Assets/Scripts/ItemGrabber.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Assets/Scripts/ItemGrabber.cs b/Assets/Scripts/ItemGrabber.cs index 1268b79..db4d8a7 100644 --- a/Assets/Scripts/ItemGrabber.cs +++ b/Assets/Scripts/ItemGrabber.cs @@ -133,9 +133,7 @@ public class ItemGrabber : MonoBehaviour { } } - PrimaryIndicator.alpha = Mathf.Lerp(PrimaryIndicator.alpha, - Casette != null || LookedAtItem != null || Campfire != null || ThrowableItem != null ? 1 : 0, - 10f * Time.deltaTime); + float PrimaryIndicatorTargetAlpha = 1; if (Casette != null) { PrimaryText.text = Casette.DisplayPrompt; } else if (Campfire != null && ThrowableItem != null) { @@ -144,12 +142,15 @@ public class ItemGrabber : MonoBehaviour { PrimaryText.text = $"Take {LookedAtItem.Quality.DisplayName}"; } else if (ThrowableItem != null) { PrimaryText.text = $"Throw {ThrowableItem.Quality.DisplayName}"; + } else { + PrimaryIndicatorTargetAlpha = 0; } + PrimaryIndicator.alpha = Mathf.Lerp(PrimaryIndicator.alpha, PrimaryIndicatorTargetAlpha, 10f * Time.deltaTime); - SecondaryIndicator.alpha = Mathf.Lerp(SecondaryIndicator.alpha, CanIgniteTorch ? 1 : 0, 10f * Time.deltaTime); if (CanIgniteTorch) { SecondaryText.text = $"Ignite {TorchableItem.Quality.DisplayName}"; } + SecondaryIndicator.alpha = Mathf.Lerp(SecondaryIndicator.alpha, CanIgniteTorch ? 1 : 0, 10f * Time.deltaTime); } private Item GetTorchableItem() { From d577b7ef9c8c04ad6970868cb9c60c01823df0bc Mon Sep 17 00:00:00 2001 From: Jens Pitkanen Date: Thu, 23 Apr 2020 14:37:07 +0300 Subject: [PATCH 3/3] Fix stick being thrown when picking up casette --- Assets/Scripts/ItemGrabber.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/ItemGrabber.cs b/Assets/Scripts/ItemGrabber.cs index db4d8a7..9e99531 100644 --- a/Assets/Scripts/ItemGrabber.cs +++ b/Assets/Scripts/ItemGrabber.cs @@ -67,10 +67,12 @@ public class ItemGrabber : MonoBehaviour { CanIgniteTorch |= Campfire != null && TorchableItem != null; } + bool JustPickedUpCasette = false; if (Casette != null && Input.GetButtonDown("Grab")) { Casette.Play(PreviousCasette); PreviousCasette = Casette; Casette = null; + JustPickedUpCasette = true; } else if (Campfire == null && LookedAtItem != null && Input.GetButtonDown("Grab")) { LookedAtItem.PickUp(HandTransform); GrabbedItems.Add(LookedAtItem); @@ -91,7 +93,7 @@ public class ItemGrabber : MonoBehaviour { } } - if (Input.GetButtonDown("Grab") && (LookedAtItem == null || Campfire != null) && ThrowableItem != null) { + if (Input.GetButtonDown("Grab") && (LookedAtItem == null || Campfire != null) && ThrowableItem != null && !JustPickedUpCasette) { Vector3 DropPosition; if (Campfire != null) { DropPosition = Campfire.transform.position + Vector3.up * 0.7f;