diff --git a/SSLR/Assets/Scripts/NPCMovementRework.cs b/SSLR/Assets/Scripts/NPCMovementRework.cs
index ddefd6b..bd52798 100644
--- a/SSLR/Assets/Scripts/NPCMovementRework.cs
+++ b/SSLR/Assets/Scripts/NPCMovementRework.cs
@@ -58,6 +58,10 @@ public class NpcMovementRework : MonoBehaviour
public void Wait()
{
Debug.Log("walking");
+ if (animator.GetBool(IsSitting))
+ {
+ animator.SetBool(IsSitting,false);
+ }
agent.SetDestination(roamingPoint);
}
@@ -79,8 +83,8 @@ public class NpcMovementRework : MonoBehaviour
if (dist <0.5)
{
agent.SetDestination(gameObject.transform.position);
- gameObject.transform.position=sittingPosition;
gameObject.transform.rotation = pos.transform.rotation;
+ gameObject.transform.position=sittingPosition;
animator.SetBool(IsSitting,true);
yield break;
}
@@ -88,7 +92,11 @@ public class NpcMovementRework : MonoBehaviour
yield return new WaitForEndOfFrame();
}
}
-
+ public void Despawn()
+ {
+ var random= Random.Range(0, NpcManager.instance.despawnPoints.Length);
+ agent.SetDestination(NpcManager.instance.despawnPoints[random].position);
+ }
diff --git a/SSLR/Assets/Scripts/NpcManager.cs b/SSLR/Assets/Scripts/NpcManager.cs
index b346b8b..e5a0e2e 100644
--- a/SSLR/Assets/Scripts/NpcManager.cs
+++ b/SSLR/Assets/Scripts/NpcManager.cs
@@ -50,8 +50,15 @@ public class NpcManager : MonoBehaviour
/// collection of all exiting npcs
///
public GameObject[] currentNpcs;
-
+
+ ///
+ /// a collection of positions for the chairs to sit for the npcs
+ ///
public GameObject[] chairPositions;
+ ///
+ /// a collection of positions for the npcs to despawn
+ ///
+ public Transform[] despawnPoints;
public void spawnNpc(bool isFemale, Transform spawnPoint)
{