hiding place sctipts and player interaction
This commit is contained in:
23
Assets/Scripts/HidingPlaceManager.cs
Normal file
23
Assets/Scripts/HidingPlaceManager.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
public class HidingPlaceManager : MonoBehaviour
|
||||
{
|
||||
public static HidingPlaceManager Instance { get; private set; }
|
||||
|
||||
// Az összes pályán lévő rejtekhely
|
||||
private HidingSpot[] allHidingSpots;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Instance = this;
|
||||
allHidingSpots = FindObjectsOfType<HidingSpot>();
|
||||
}
|
||||
|
||||
// A rendőrök ezt hívják meg, amikor bejönnek
|
||||
public List<HidingSpot> GetSpotsForPoliceToCheck()
|
||||
{
|
||||
return allHidingSpots.OrderBy(x => Random.value).Take(Mathf.Max(1, allHidingSpots.Length / 3)).ToList();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user