Ejemplo n.º 1
0
        public void MakeMove()
        {
            if (!CanMove() && CustomerPath.Count <= 1)
            {
                this.CustomerPath = GeneratePath(this.CustomerPath[0]);
            }
            Coordinates actual   = CustomerPath[0];
            Coordinates nextMove = CustomerPath[1];

            if (actual == nextMove)
            {
                CustomerPath.RemoveAt(1);
                nextMove = CustomerPath[1];
            }
            if (CellDictionary[nextMove].Client == null && CellDictionary[nextMove].TypeOfCell.StateOfCell != CellState.TypeOfCell.EXIT)
            {
                RemoveProductFromListIfPossible(nextMove);
                CellDictionary[nextMove].Client = this;
                CellDictionary[actual].Client   = null;
                CustomerPath.RemoveAt(0);
            }
            else if (CellDictionary[nextMove].Client == null)
            {
                CellDictionary[nextMove].Client = this;
                CellDictionary[actual].Client   = null;
            }
        }
 // Start is called before the first frame update
 void Start()
 {
     path = GetComponent<CustomerPath>();
     customerDirector = FindObjectOfType<CustomerDirector>();
     customerTimer = GetComponent<CustomerTimer>();
     unclaimedItems = customerDirector.unclaimedItems;
     IsLeavingChange += IsLeavingHandler;
     customerStartTime = Time.timeSinceLevelLoad;
     layerMask = LayerMask.GetMask("Interactable", "Walls", "Player");
     Bulletin.gameObject.SetActive(false);
     pathIndex = 0;
     SetUpCustomerProfile();
     customerID = Guid.NewGuid().ToString();
     customerDirector.WaitingCustomers.Add(customerID, this);
     customerTimer.StartWaitingTimer();
 }