//private KitchenEnteranceCheck kitchenCheck; //private float waitTime { get; set; } //public float startWaitTime; // 2. Each (as defind in GameStarter script) seconds 1 customer enters the store, moves to a pre defined free random point and stops // need to control points // Start is called every time the script is enabled and before the first frame update // Construct the list of move points void Start() { // waitTime = startWaitTime; ListOfMovePoints = new List <NewPoint>(); ListOfCustomersWandering = new List <NewCustomer>(); SingleKitchenDoorPoint = new List <NewPoint>(); CustomerEnteringKitchen = new List <NewCustomer>(); startingPoint = new NewPoint(doorSpawnPoint); // because the point was not made the best way we need to initialize the points this way ListOfMovePoints.Add(new NewPoint(movePoint01)); ListOfMovePoints.Add(new NewPoint(movePoint02)); ListOfMovePoints.Add(new NewPoint(movePoint03)); ListOfMovePoints.Add(new NewPoint(movePoint04)); ListOfMovePoints.Add(new NewPoint(movePoint05)); ListOfMovePoints.Add(new NewPoint(movePoint06)); ListOfMovePoints.Add(new NewPoint(movePoint07)); ListOfMovePoints.Add(new NewPoint(movePoint08)); ListOfMovePoints.Add(new NewPoint(movePoint09)); ListOfMovePoints.Add(new NewPoint(movePoint10)); SingleKitchenDoorPoint.Add(new NewPoint(kitchenDoorPoint)); kitchen = kitchenGameObject.GetComponentInChildren <Kitchen>(); counterQueue = counterGameObject.GetComponentInChildren <CounterQueue>(); // Check to see is CounterQueue can add a new customer InvokeRepeating("SendIdleCustomerToQueue", counterQueue.IntervalBetweenCustomerMovingToQueue, counterQueue.IntervalBetweenCustomerMovingToQueue); }
public void AddToKitchenDoor(NewCustomer customer) { CustomerEnteringKitchen.Add(customer); NewPoint point = SingleKitchenDoorPoint[0]; customer.MoveTo(point); }
// Update is called once per frame void Update() { foreach (NewCustomer c in ListOfCustomersWandering) { if (c.IsMoving) { c.Move(); } else { NewPoint oldTarget = c.Target; // infinante cycle if you have >= customers wandering to movepoints bool freePointFound = false; while (!freePointFound) { NewPoint point = ListOfKitchenMovePoints[Random.Range(0, 10)]; if (point.Free) { c.MoveTo(point); point.Free = false; freePointFound = true; } } SuspicionBarScript.suspicion += kitchenNoise; oldTarget.Free = true; } } }
//private float waitTime { get; set; } //public float startWaitTime; // 2. Each (as defind in GameStarter script) seconds 1 customer enters the store, moves to a pre defined free random point and stops // need to control points // Start is called every time the script is enabled and before the first frame update // Construct the list of move points void Start() { CustomerDeathEvent.RegisterListener(OnCustomerDied); gs = gameStarterGameObject.GetComponentInChildren <GameStarter>(); // waitTime = startWaitTime; ListOfKitchenMovePoints = new List <NewPoint>(); ListOfCustomersWandering = new List <NewCustomer>(); startingPoint = new NewPoint(kitchenDoorSpawnPoint); // because the point was not made the best way we need to initialize the points this way ListOfKitchenMovePoints.Add(new NewPoint(kitchenMovePoint01)); ListOfKitchenMovePoints.Add(new NewPoint(kitchenMovePoint02)); ListOfKitchenMovePoints.Add(new NewPoint(kitchenMovePoint03)); ListOfKitchenMovePoints.Add(new NewPoint(kitchenMovePoint04)); ListOfKitchenMovePoints.Add(new NewPoint(kitchenMovePoint05)); ListOfKitchenMovePoints.Add(new NewPoint(kitchenMovePoint06)); ListOfKitchenMovePoints.Add(new NewPoint(kitchenMovePoint07)); ListOfKitchenMovePoints.Add(new NewPoint(kitchenMovePoint08)); ListOfKitchenMovePoints.Add(new NewPoint(kitchenMovePoint09)); ListOfKitchenMovePoints.Add(new NewPoint(kitchenMovePoint10)); customerIsOnTheTour = false; }
// 2. Each x seconds (as defind in GameStarter script) 1 customer enters the kitchen, moves to a pre defined free random point and stops public void AddCustomer(NewCustomer customer) { ListOfCustomersWandering.Add(customer); bool freePointFound = false; while (!freePointFound) { NewPoint point = ListOfKitchenMovePoints[Random.Range(0, 10)]; if (point.Free) { customer.MoveTo(point); point.Free = false; freePointFound = true; } } }
// Update is called once per frame void Update() { foreach (NewCustomer c in ListOfCustomersWandering) { if (c.IsMoving) { c.Move(); } else { NewPoint oldTarget = c.Target; // infinante cycle if you have >= customers wandering to movepoints bool freePointFound = false; while (!freePointFound) { NewPoint point = ListOfMovePoints[Random.Range(0, 10)]; if (point.Free) { c.MoveTo(point); point.Free = false; freePointFound = true; } } oldTarget.Free = true; } } // move customer from first in line to the kitchen door foreach (NewCustomer cek in CustomerEnteringKitchen) { if (cek.IsMoving) { cek.Move(); } else { MoveInsideKitchen(); break; } } }