public void SpawnMeat(NpcCharacterBehaviour corpseInstance) { Quaternion meatRotation = Quaternion.identity; meatRotation.eulerAngles = new Vector3(0f, corpseInstance.mainRigidbody.transform.rotation.eulerAngles.y, 0f); for (int i = 0; i < meatsNum; i++) { MeatBehaviour newMeatBehaviour = Instantiate(meatPrefabBehaviour, corpseInstance.mainRigidbody.transform.position, meatRotation); GameManager.Instance.Player.Inventory.Meats.Add(newMeatBehaviour.meat); } }
public void CustomerBuy(NpcCharacterBehaviour customer, MeatData meatDataBought) { if (meatDataBought) { MeatBehaviour spawnedMeatBehaviourBought = spawnedMeats.Find(meatBehaviour => meatBehaviour.meat.Data == meatDataBought); spawnedMeats.Remove(spawnedMeatBehaviourBought); GameManager.Instance.Player.Inventory.Meats.Remove(spawnedMeatBehaviourBought.meat); MeatPopularity boughtMeatPopularity = customer.CurrentCityRegion.meatsPopularity.List.Find(meatPopularity => meatPopularity.meatData == meatDataBought); boughtMeatPopularity.DecreasePopularityAfterBuy(); spawnedMeatBehaviourBought.JumpTo(customer.mainRigidbody.position, true, () => Destroy(spawnedMeatBehaviourBought.gameObject), true); int cashValueEarned = boughtMeatPopularity.GetMeatFinalValue(); for (int i = 0; i < cashValueEarned; i++) { spawnedEarnedCash.Add(Instantiate(cashTable.CashValues[1], customer.mainRigidbody.position, Quaternion.identity, transform)); } GameManager.Instance.Player.Inventory.Cash += cashValueEarned; } }