From efcb3d445e7adff550ace63f42eedc2dbf027fd2 Mon Sep 17 00:00:00 2001 From: Taliayaya Date: Sun, 17 Sep 2023 17:32:57 +0200 Subject: [PATCH] prepare scavenger respawn system --- Assets/Scripts/Gameplay/ScavengerController.cs | 8 +++++++- Assets/Scripts/Gameplay/ScavengerMaster.cs | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/Gameplay/ScavengerController.cs b/Assets/Scripts/Gameplay/ScavengerController.cs index 7d100522..c7fc3073 100644 --- a/Assets/Scripts/Gameplay/ScavengerController.cs +++ b/Assets/Scripts/Gameplay/ScavengerController.cs @@ -153,8 +153,14 @@ public void GoTo(Vector3 dest) private void Follow() { + if (!master) + { + State = ScavengerState.Idle; + return; + } + var distance = Vector3.Distance(transform.position, master.transform.position); - if (!master || distance < followDistance) + if (distance < followDistance) { State = ScavengerState.Idle; return; diff --git a/Assets/Scripts/Gameplay/ScavengerMaster.cs b/Assets/Scripts/Gameplay/ScavengerMaster.cs index 0f93926e..13c7b6ad 100644 --- a/Assets/Scripts/Gameplay/ScavengerMaster.cs +++ b/Assets/Scripts/Gameplay/ScavengerMaster.cs @@ -22,6 +22,7 @@ public class ScavengerMaster : MonoBehaviour [SerializeField] private float spawnDistance = 8; [SerializeField] private float maxRaycastDistance = 4000; [SerializeField] private LayerMask raycastLayerMask; + [SerializeField] private bool respawnScavengerOnDeath = true; [Header("References")] [SerializeField]