void Awake() { m_pathFinder = GetComponent <Pathfinder>(); if (m_instance == null) { m_instance = this; } m_customerAmount = DefaulCustomerAmount; }
//State machine public void ChangeState(CustomerAIState newState) { switch (newState) { case CustomerAIState.Shopping: if (m_targetShop != null) { if (m_shoppingList.Contains(m_targetShop) && m_targetShop.ShoppingAmount < 0.0f) { m_shoppingList.Remove(m_targetShop); PickNextShop(); } else { RequestShopPath(m_targetShop.ShopObject); } } else { PickNextShop(); } Speed = 5.0f; break; case CustomerAIState.Hungry: m_targetShop = new ShopData(); m_targetShop.ShopObject = OverSeer.GetShop(Shop.ShopEnum.Cafe); m_targetShop.ShoppingAmount = Hunger; RequestShopPath(m_targetShop.ShopObject); Speed = 5.0f; break; case CustomerAIState.Pissed: m_targetShop = new ShopData(); m_targetShop.ShopObject = OverSeer.GetShop(Shop.ShopEnum.WC, Random.Range(1, 3)); m_targetShop.ShoppingAmount = Bladder; RequestShopPath(m_targetShop.ShopObject); Speed = 7.5f; break; case CustomerAIState.Running: RequestExitPath(); Speed = 10; break; case CustomerAIState.Satisfied: RequestExitPath(); Speed = 5.0f; break; default: break; } CustomerState = newState; }
void Awake() { m_grid = GetComponent <Grid>(); m_overSeer = GetComponent <OverSeer>(); }
private void RequestExitPath() { OverSeer.RequestPath(gameObject.transform.position, OverSeer.Instance.Entrance.transform.position, OnPathFound); }
private void RequestShopPath(Shop targetShop) { OverSeer.RequestPath(gameObject.transform.position, targetShop.Entrance.transform.position, OnPathFound); }
private void PickNextShop() { m_targetShop = m_shoppingList[Random.Range(0, m_shoppingList.Count)]; RequestShopPath(OverSeer.GetShop(Shop.ShopEnum.Shop, m_targetShop.ShopObject.ShopID)); }
public void Start() { OverSeer.RequestPath(OverSeer.Instance.Entrance.transform.position, OverSeer.GetShop(Shop.ShopEnum.WC).transform.position, OnPathFound); }