//For Customer void isCustomerDone() { //check for 70% timer or less. if (cust.dishWanted.Equals(readySalad)) { //check for 70%. if (cust.healthBar.transform.localScale.x > 0.6f) { cust.isCusthappy = true; cust.happyAtPlayer = this.PlayerID; } //update score. GameManager._scorePlayer1 += rightCombPoint; CustomerSpawner.DeleteCustomer(cust.ind); ClearChoppedVegeBoard(choppedVege); } else { // make customer Angry. cust.healthBar.GetComponentInChildren <SpriteRenderer>().color = Color.red; cust._rateOfDecresing = angryCustomerRate; cust.isCustAngry = true; cust.angryAtPlayer = this.PlayerID; } }
private void Awake() { customer_Dialouge = GetComponent <AudioSource>(); the_Customer_Spawner = FindObjectOfType <CustomerSpawner>(); customer_Point_Of_Interest = FindObjectOfType <CustomerPointOfInterest>(); customer_Anim = GetComponent <Animator>(); weapon_Drop_Point = GameObject.Find("BrokenWeaponSpawnPoint"); }
private new void Awake() { //get the customer spawner spawner = GetComponentInParent <CustomerSpawner>(); //initialize as a customer node base.Awake(); }
void DestroyCustomer() { CustomerSpawner customerSpawner = GameObject.Find("Customer Spawner").GetComponent <CustomerSpawner>(); // yield return new WaitForSeconds(2); customerSpawner.currCustNum--; // -1 from total no. of curr cust because this customer left Destroy(customer); }
public static void CreateCustomerSpawner() { CustomerSpawner spawner = CreateInstance <CustomerSpawner> (); AssetDatabase.CreateAsset(spawner, "Assets/NewCustomerSpawner.asset"); AssetDatabase.SaveAssets(); EditorUtility.FocusProjectWindow(); Selection.activeObject = spawner; }
private void Start() { Time.timeScale = 1; spawner = GetComponent <CustomerSpawner>(); maxScore = float.MinValue; _scorePlayer1 = 0f; _scorePlayer2 = 0f; _timePlayer1 = maxTime; _timePlayer2 = maxTime; }
// Use this for initialization void Start() { isOpen = false; spawner = GameObject.Find("Spawnpoint").GetComponent <CustomerSpawner>(); panel = GameObject.Find("StoreClosed"); panel.SetActive(false); timeStart = (int)Time.time; Time.timeScale = 7; weekText.text = "1"; monthText.text = "1"; yearText.text = "1"; }
private void Awake() { // Set instance for other Scripts to access Instance = this; // Initialise Queue customerDic = new Dictionary <int, Customer>(); // Initialise Transform points spawnPoint = transform.GetChild(0); queuePoint = transform.GetChild(1); }
public void SpawnCustomer(CustomerSpawner cs) { GameObject cust = (GameObject)Instantiate (customerPrefab); cust.GetComponent<CustomerScript>().InitializeCustomer("StreetNav"); cust.GetComponent<CustomerScript>().SetProperties(cs); if(cust.GetComponent<CustomerScript>().AIType == "Nazi"){ audioManager.PlayAudioDoorNazi(); } else{ audioManager.PlayAudioDoor(); } }
private CustomerSpawner customerSpawner; //script that spawns customer when anyone of them leaves #endregion #region UNITY_METHODS /// <summary> /// the start will find the CustomerSpawner script and select a random combination of 2 or 3 vegetables /// and it will display on the customer HUD so that the chef know what to serve whom. /// </summary> /// <returns></returns> void Start() { customerSpawner = FindObjectOfType <CustomerSpawner>(); for (int i = 0; i < vegetableOptions.Length / Random.Range(2, 4); i++) { int rand = Random.Range(0, 6); m_RequestedSalad.Add(vegetableOptions[rand]); int randTime = Random.Range(30, 36); // 10-16 m_WaitTime += randTime; } m_CustomerHud.text = string.Join(",\n", m_RequestedSalad); StartCoroutine(CountDownTimer()); }
public void Awake() { if (Instance == null) { Instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); return; } spawner = gameObject.GetComponent <CustomerSpawner>(); }
public World(Player player, int width = 200, int height = 200) { Debug.LogWarning("Using UnityEngine.Random.seed! Debug only!"); UnityEngine.Random.seed = 42; // Debug purpose only, same random values for testing performance this.player = player; this.width = width; this.height = height; InitTiles(width, height); List<Tile> buildableTiles = SetAndGetBuildableTiles(); InitTilePropertyValues(); InitBuildings(buildableTiles); this.customerSpawner = new CustomerSpawner(buildings); }
public override void OnInspectorGUI() { DrawDefaultInspector(); CustomerSpawner myScript = (CustomerSpawner)target; if (GUILayout.Button("Force Spawn")) { if (myScript.customer) { myScript.SpawnCustomer(myScript.customer); } else { Debug.Log("There is no customer set for force spawning."); } } }
// Start is called before the first frame update void Start() { player = GameObject.Find("EventSystem").GetComponent <Player>(); customerSpawner = GameObject.Find("Spawner").GetComponent <CustomerSpawner>(); specialFormsHandler = GameObject.Find("EventSystem").GetComponent <SpecialFormsHandler>(); orderPanelHandler = GameObject.Find("EventSystem").GetComponent <OrderPanelHandler>(); // setting onclick listeners to close panels closeOTC = otcPanel.transform.GetChild(0).GetComponent <Button>(); closeOTC.onClick.AddListener(() => OpenCloseOTC()); closePresc = prescPanel.transform.GetChild(0).GetComponent <Button>(); closePresc.onClick.AddListener(() => OpenClosePresc()); otcPotions = otcPanel.GetComponentsInChildren <Button>(); prescPotions = prescPanel.GetComponentsInChildren <Button>(); // assigning onclick listeners to each potion button foreach (Button b in otcPotions) { if (b.name.Equals("button_close")) { continue; } else { b.onClick.AddListener(() => CheckOTCPotion(b.name)); } } foreach (Button b in prescPotions) { if (b.name.Equals("button_close")) { continue; } else { b.onClick.AddListener(() => CheckPrescPotion(b.name)); } } }
private void Update() { if (!isGenerated && !isMoving) { GenerateRandomString(); currTime = timeToWait; } //updating Health and time to wait. if (!isMoving) { if (currTime > 0f) { UpdateHealthBar(healthBar); currTime -= _rateOfDecresing * Time.deltaTime; } } if (!isMoving && currTime <= 0f) { //reduce score for both players. Debug.Log("done"); if (!isCustAngry) { GameManager._scorePlayer1 += custDisappointed; GameManager._scorePlayer2 += custDisappointed; } else if (isCustAngry && angryAtPlayer == 1) { GameManager._scorePlayer1 += custDisappointed * 2; } else if (isCustAngry && angryAtPlayer == 2) { GameManager._scorePlayer2 += custDisappointed * 2; } //and destroy the customer. CustomerSpawner.DeleteCustomer(ind); } }
void Awake() { instance = this; }
public static CustomerSpawner SpawnCustomer(int day, int transactionNumber, Dictionary<string, int> memory, ArrayList usedWords) { CustomerSpawner output = new CustomerSpawner(); switch(day){ case 1: switch(transactionNumber){ case 1: output = MakeRandomCustomer (usedWords); break; case 2: output = MakeRandomCustomer (usedWords); break; case 3: output.convID = "homeless1"; output.isMale = true; output.goal = "any"; break; case 4: output = MakeRandomCustomer (usedWords); break; case 5: output = MakeRandomCustomer (usedWords); break; case 6: output.convID = "lawyer2"; output.isMale = true; break; case 7: output = MakeRandomCustomer (usedWords); break; } break; case 2: switch(transactionNumber){ case 1: output = MakeRandomCustomer (usedWords); break; case 2: output.convID = "gossip3"; output.isMale = false; break; case 3: output = MakeRandomCustomer (usedWords); break; case 4: output = MakeRandomCustomer (usedWords); break; case 5: output = MakeRandomCustomer (usedWords); break; case 6: output.convID = "homeless4"; output.isMale = true; output.goal = "any"; break; case 7: output = MakeRandomCustomer (usedWords); break; } break; case 3: switch(transactionNumber){ case 1: output.convID = "barkeep5"; output.isMale = true; break; case 2: output = MakeRandomCustomer (usedWords); break; case 3: output = MakeRandomCustomer (usedWords); break; case 4: output = MakeRandomCustomer (usedWords); break; case 5: output.convID = "lawyer6"; output.isMale = true; break; case 6: output = MakeRandomCustomer (usedWords); break; case 7: output = MakeRandomCustomer (usedWords); break; } break; case 4: switch(transactionNumber){ case 1: output = MakeRandomCustomer (usedWords); break; case 2: output = MakeRandomCustomer (usedWords); break; case 3: output.convID = "mother7"; output.money = 35f; output.willingMarkup = 35f; output.isMale = false; output.goal = "entree"; break; case 4: output = MakeRandomCustomer (usedWords); break; case 5: output = MakeRandomCustomer (usedWords); break; case 6: output = MakeRandomCustomer (usedWords); break; case 7: output.convID = "priest8"; output.isMale = true; break; } break; case 5: switch(transactionNumber){ case 1: output = MakeRandomCustomer (usedWords); break; case 2: output = MakeRandomCustomer (usedWords); break; case 3: output = MakeRandomCustomer (usedWords); break; case 4: output = MakeRandomCustomer (usedWords); break; case 5: output = MakeRandomCustomer (usedWords); break; case 6: output = MakeRandomCustomer (usedWords); break; case 7: output.convID = "gossip9"; output.isMale = false; break; } break; case 6: switch(transactionNumber){ case 1: output = MakeRandomCustomer (usedWords); break; case 2: output.convID = "butcher10"; output.isMale = true; break; case 3: output = MakeRandomCustomer (usedWords); break; case 4: output = MakeRandomCustomer (usedWords); break; case 5: output = MakeRandomCustomer (usedWords); break; case 6: output.convID = "lawyer11"; output.isMale = true; break; case 7: output = MakeRandomCustomer (usedWords); break; } break; case 7: switch(transactionNumber){ case 1: output = MakeRandomCustomer (usedWords); break; case 2: output = MakeRandomCustomer (usedWords); break; case 3: if(memory.ContainsKey("buyhomeless2") && memory["buyhomeless2"] == 0){ output.convID = "homeless12"; output.isMale = true; output.goal = "any"; } else{ output.convID = "barkeep12"; output.isMale = true; } break; case 4: output = MakeRandomCustomer (usedWords); break; case 5: output = MakeRandomCustomer (usedWords); break; case 6: output = MakeRandomCustomer (usedWords); break; case 7: output.convID = "gossip13"; output.isMale = false; break; } break; case 8: switch(transactionNumber){ case 1: output.convID = "soldier14"; output.isMale = true; break; case 2: output = MakeRandomCustomer (usedWords); break; case 3: output = MakeRandomCustomer (usedWords); break; case 4: output = MakeRandomCustomer (usedWords); break; case 5: if((memory.ContainsKey("buyhomeless2") && memory["buyhomeless2"] == 0) && !(memory.ContainsKey ("buyhomeless3") && memory["buyhomeless3"] == 0)){ output.convID = "priestalt15"; output.isMale = true; } else{ output.convID = "priest15"; output.isMale = true; } break; case 6: output = MakeRandomCustomer (usedWords); break; case 7: output = MakeRandomCustomer (usedWords); break; } break; case 9: switch(transactionNumber){ case 1: output = MakeRandomCustomer (usedWords); break; case 2: output.convID = "butcher16"; output.isMale = true; break; case 3: output = MakeRandomCustomer (usedWords); break; case 4: output = MakeRandomCustomer (usedWords); break; case 5: output = MakeRandomCustomer (usedWords); break; case 6: output = MakeRandomCustomer (usedWords); break; case 7: output.convID = "gossip17"; output.isMale = false; break; } break; case 10: switch(transactionNumber){ case 1: output = MakeRandomCustomer (usedWords); break; case 2: output = MakeRandomCustomer (usedWords); break; case 3: output = MakeRandomCustomer (usedWords); break; case 4: output = MakeRandomCustomer (usedWords); break; case 5: output = MakeRandomCustomer (usedWords); break; case 6: output.convID = "lawyer18"; output.isMale = true; break; case 7: output.convID = "gossip19"; output.isMale = false; break; } break; } return output; }
static CustomerSpawner MakeRandomCustomer(ArrayList usedWords) { CustomerSpawner output = new CustomerSpawner(); int r = (int)Random.Range (0, KeywordArray.Length); while(usedWords.Contains (KeywordArray[r])){ r = (int)Random.Range (0, KeywordArray.Length); } output.goal = KeywordArray[r]; usedWords.Add (KeywordArray[r]); r = (int)Random.Range (0, 5); switch(r){ case 0: output.convID = "rand1"; output.isMale = true; output.money = (Random.Range (9f,14f)); output.willingMarkup = 1.4f; output.markupLeniency = 0f; break; case 1: output.convID = "rand2"; output.isMale = true; output.money = (Random.Range (3f,6f)); output.willingMarkup = 1.2f; output.markupLeniency = 0f; break; case 2: output.convID = "rand3"; output.isMale = false; output.money = (Random.Range (2f,5f)); output.willingMarkup = 1.2f; output.markupLeniency = 0f; break; case 3: output.convID = "rand4"; output.isMale = false; output.money = (Random.Range (5f,9f)); output.willingMarkup = 1.15f; output.markupLeniency = 0f; break; case 4: output.convID = "rand5"; output.isMale = false; output.money = (Random.Range (9f,12f)); output.willingMarkup = 1f; output.markupLeniency = 0f; break; } return output; }
private void Start() { customerSpawner = GameObject.Find("Spawner").GetComponent <CustomerSpawner>(); }
public void SetProperties(CustomerSpawner cs) { money = cs.money; isMale = cs.isMale; convID = cs.convID; goal = cs.goal; willingMarkup = cs.willingMarkup; markupLeniency = cs.markupLeniency; }
private void Awake() { _schedule = GetComponent <CustomerSchedule>(); _spawner = GetComponent <CustomerSpawner>(); }