private IEnumerator UsingFacilityWait(float waitTime) { if (currentTarget is GameMachine) { GameMachine machine = (GameMachine)currentTarget; machine.IncreaseCurrentNumberOfPlayers(); this.GetComponent <Animator>().SetTrigger("Sit"); } currentTarget.OnUse(); customerTransform.LookAt(currentTarget.transform); customerTransform.position = currentTarget.GetUsePosition().position; yield return(new WaitForSeconds(waitTime / speedFactor)); if (currentTarget is GameMachine) { GameMachine machine = (GameMachine)currentTarget; machine.DecreaseCurrentNumberOfPlayers(); this.GetComponent <Animator>().SetTrigger("Get Up"); } currentTarget.InUse = false; currentState = CustomerStates.Idle; }
void Awake() { pather = GetComponent <Pather>(); customerTransform = GetComponent <Transform>(); staffManager = GameManager.Instance.ScriptHolderLink.GetComponent <StaffManager>(); bladderStat = new CustomerStat(CustomerStat.Stats.Bladder, 50.0f, 0.0f); happinessStat = new CustomerStat(CustomerStat.Stats.Happiness, 50.0f, 0.0f); hungerStat = new CustomerStat(CustomerStat.Stats.Hunger, 50.0f, 0.0f); tirednessStat = new CustomerStat(CustomerStat.Stats.Tiredness, 50.0f, 0.0f); queasinessStat = new CustomerStat(CustomerStat.Stats.Queasiness, 50.0f, 0.0f); customerStats = new List <CustomerStat>(); customerStats.Add(bladderStat); customerStats.Add(happinessStat); customerStats.Add(hungerStat); customerStats.Add(tirednessStat); customerStats.Add(queasinessStat); for (int i = 0; i < customerStats.Count; i++) { if (customerStats[i].GetStatType() == weakness) { customerStats[i].StatValue = 100.0f; customerStats[i].Susceptibility = 15.0f; weakStat = i; } } statCounter = 0.0f; currentState = CustomerStates.Idle; CustomerName = GameManager.Instance.GetComponent <NameGenerator>().GenerateName(); }
public CustomerInfo(int _key, GameObject _go, NavMeshAgent _agent, AnimationNavigationMatch _script, AisleID _currentAisle, CustomerStates _currentState) { key = _key; go = _go; agent = _agent; script = _script; currentAisle = _currentAisle; currentState = _currentState; }
void EnterLeavingState() { currentState = CustomerStates.Leaving; // Get Target destination to leave from. if (customerAI) { customerAI.SetDestination(new Vector3(-4.5f, 1.0f, 4.5f)); StartCoroutine("Leaving_Update"); } }
void EnterTiredState() { currentState = CustomerStates.Tired; Debug.Log("Entering tired state."); // Get concessions service from Arcade TargetConcession = arcade.GetConcessions(Fatigue); if (customerAI && TargetConcession) { customerAI.SetDestination(TargetConcession.ServicePosition()); StartCoroutine("Tired_Update"); } }
void EnterPlayingState() { Debug.Log("Entering playing state."); if (TargetGame != null) { TargetGame.Join(this); } currentState = CustomerStates.Playing; gameplayTime = Mathf.Floor(5 * (Skill / TargetGame.Difficulty)); Debug.Log("Gameplaytime: " + gameplayTime); StartCoroutine("Play_Update"); }
void EnterSeekingState() { Debug.Log("Entering seeking state."); currentState = CustomerStates.Seeking; if (GetTarget()) { StartCoroutine("Seek_Update"); } else { Debug.Log("Entering leaving state."); // Leave. } }
public void LeaveArcade() { if (currentState == CustomerStates.UsingFacility) { StopCoroutine(usingFacilityWait); } if (currentTarget) { currentTarget.InUse = false; } pather.SetTarget(spawnLocation); currentState = CustomerStates.Leaving; }
void changeState(CustomerInfo customer, CustomerStates newState) { customer.currentState = newState; //Debug.Log(customer.go.name + " has begun " + newState.ToString()); switch (newState) { case CustomerStates.Waiting: StartCoroutine(CustomerWaiting(customer.key)); break; case CustomerStates.Searching: AisleID nextAisle = sc_aisles.GetTravelAisle(customer.GetPosition(), customer.currentAisle, false); customer.currentAisle = nextAisle; customer.agent.destination = nextAisle.GetNearestNode(customer.GetPosition(), AisleSide.Left | AisleSide.Right); break; case CustomerStates.Perusing: Vector3 target = customer.currentAisle.GetFurthestAisleExit(customer.GetPosition()); customer.agent.destination = target; break; } }
public HasCustomerIdQueryHandler(CustomerStates archive) { _archive = archive ?? throw new System.ArgumentNullException(nameof(archive)); }
public CustomerRegisteredEventObserver(CustomerStates archive) { _archive = archive ?? throw new System.ArgumentNullException(nameof(archive)); }
//public void SetSpeedFactor(float speedFactor) { unitController.SpeedFactor = speedFactor; this.speedFactor = speedFactor; public void SetCurrentCustomerState(CustomerStates newState) { currentState = newState; }
public IsUsernameAvailableQueryHandler(CustomerStates archive) { _archive = archive ?? throw new System.ArgumentNullException(nameof(archive)); }
public GetAvailableCustomerIdQueryHandler(CustomerStates archive) { _archive = archive ?? throw new ArgumentNullException(nameof(archive)); }
public void GenerateCustomers(int amount) { nextUniqueKey = 0; foreach (CustomerInfo customer in spawnedCustomers) { customer.Destroy(); } spawnedCustomers.Clear(); ///make existing customers for (int i = 0; i < amount; i++) { float xRand = Random.Range(minBounds.x, maxBounds.x); float yRand = Random.Range(minBounds.y, maxBounds.y); float zRand = Random.Range(minBounds.z, maxBounds.z); Vector3 spawnAttempt = new Vector3(xRand, yRand, zRand); NavMeshHit nmh = new NavMeshHit(); if (NavMesh.SamplePosition(spawnAttempt, out nmh, maxNavDistance, NavMesh.AllAreas)) { //determine spawn position Vector3 position = new Vector3(nmh.position.x, yRand, nmh.position.z); //choose a prefab GameObject prefab = customerPrefabs[Random.Range(0, customerPrefabs.Length)]; //get aisle they will spawn in AisleID aID = sc_aisles.GetNearestAisleID(position); //set the customer state on start CustomerStates state = CustomerStates.Start; //Instantiate the GameObject GameObject g = (GameObject)Instantiate(prefab, position, Quaternion.identity, customerHolder.transform); //Get agent NavMeshAgent agent = g.GetComponent <NavMeshAgent>(); AnimationNavigationMatch script = g.GetComponent <AnimationNavigationMatch>(); script.SetManager(this); script.uniqueKey = nextUniqueKey; //Finally create a Customerinfo and add it to the list spawnedCustomers.Add(new CustomerInfo(nextUniqueKey, g, agent, script, aID, state)); Finished(nextUniqueKey); nextUniqueKey++; } else { Debug.LogError("No point found on the NavMesh close enoguh to the randomly chosen position: " + spawnAttempt.ToString()); i--; } } ///set off a coroutine to have more customers enter }