public IEnumerator Plant(Responsible responsible) { var ground = GroundUtil.FindGround(responsible.gameObject.transform.position); if (ground != null) { if (!ground.occupied) { responsible.Target = ground.gameObject; yield return(StartCoroutine(responsible.Walk(ground.gameObject.transform.position))); } else { Debug.Log("Ground is occupied!"); responsible.FinishJob(true); yield return(null); } } responsible.animator.SetTrigger("plant"); yield return(Util.WaitForSeconds(responsible.GetCurrentJob(), 6f)); if (ground != null) { ground.occupied = true; } responsible.animator.ResetTrigger("plant"); responsible.Inventory.Remove(gameObject); var newProduct = Instantiate(_product, new Vector3(ground.gameObject.transform.position.x, _product.transform.position.y, ground.gameObject.transform.position.z), _product.transform.rotation); newProduct.GetComponent <Plant>().SetHarvestable(false); Destroy(gameObject, 1f); responsible.FinishJob(); }
public IEnumerator Sleep(Responsible responsible) { yield return(StartCoroutine(responsible.Walk(interactionPoint.transform.position))); yield return(Util.WaitForSeconds(responsible.GetCurrentJob(), sleepDuration)); responsible.FinishJob(); }
public IEnumerator Walk(Responsible responsible) { yield return(StartCoroutine(responsible.Walk(interactionPoint.transform.position))); responsible.FinishJob(); Debug.Log("Finished walking!"); yield break; }
public IEnumerator Shower(Responsible responsible) { yield return(StartCoroutine(responsible.Walk(interactionPoint.transform.position))); responsible.GetCurrentJob().SetProgressDuration(10); yield return(new WaitForSeconds(10)); responsible.FinishJob(); }
public IEnumerator Eat(Responsible responsible) { yield return(StartCoroutine(responsible.Walk(interactionPoint.transform.position))); yield return(Util.WaitForSeconds(responsible.GetCurrentJob(), eatDuration)); responsible.Heal(20); Destroy(gameObject, 0.5f); responsible.FinishJob(); }
public virtual IEnumerator Pick(Responsible responsible) { yield return(StartCoroutine(responsible.Walk(interactionPoint.transform.position))); yield return(Util.WaitForSeconds(responsible.GetCurrentJob(), _pickDuration)); responsible.Inventory.Add(this.gameObject); SetPicked(true); responsible.FinishJob(); }
public IEnumerator Chop(Responsible responsible) { yield return(StartCoroutine(responsible.Walk(interactionPoint.transform.position))); yield return(Util.WaitForSeconds(responsible.GetCurrentJob(), SkillManager.GetSkillBonusForDuration(responsible, chopDuration))); GroundUtil.Clear(gameObject.transform.position); responsible.Inventory.Add(CreateProduct()); Destroy(gameObject); responsible.FinishJob(); }
public IEnumerator Mine(Responsible responsible) { yield return(StartCoroutine(responsible.Walk(interactionPoint.transform.position))); yield return(Util.WaitForSeconds(responsible.GetCurrentJob(), mineDuration)); GroundUtil.Clear(gameObject.transform.position); responsible.Inventory.Add(CreateStone()); Destroy(gameObject, 0.5f); responsible.FinishJob(); }
public IEnumerator Harvest(Responsible responsible) { yield return(StartCoroutine(responsible.Walk(interactionPoint.transform.position))); responsible.animator.SetBool("isHarvesting", true); yield return(Util.WaitForSeconds(responsible.GetCurrentJob(), harvestDuration)); responsible.animator.SetBool("isHarvesting", false); GroundUtil.Clear(gameObject.transform.position); responsible.Inventory.Add(CreateProduct()); Destroy(gameObject, 0.5f); responsible.FinishJob(); }
public IEnumerator Eat(Responsible responsible) { if (!picked) { yield return(StartCoroutine(responsible.Walk(interactionPoint.transform.position))); } yield return(Util.WaitForSeconds(responsible.GetCurrentJob(), eatDuration)); if (picked) { responsible.Inventory.Remove(GetGroupName()); } Destroy(this.gameObject, 0.1f); responsible.FinishJob(); }
public virtual IEnumerator Equip(Responsible responsible) { if (picked) { yield return(Util.WaitForSeconds(responsible.GetCurrentJob(), _equipDuration)); } else { yield return(StartCoroutine(responsible.Walk(interactionPoint.transform.position))); responsible.Inventory.Add(this.gameObject); yield return(Util.WaitForSeconds(responsible.GetCurrentJob(), _equipDuration)); } responsible.Equipment.Equip(gameObject); UIManager.Instance.SetInventory(responsible); responsible.FinishJob(); }
public IEnumerator Craft(Responsible responsible) { yield return(StartCoroutine(responsible.Walk(interactionPoint.transform.position))); RecipeManager.Instance.OpenCraftingMenu(recipes, responsible); yield return(new WaitUntil(() => recipeSet)); yield return(currentRecipe.Craft(responsible)); foreach (var quest in responsible.quests) { quest.Progress(ActivityType.Craft, currentRecipe.Name); } var product = RecipeManager.Instance.CreateProduct(currentRecipe, gameObject); product.GetComponent <Pickable>().SetPicked(true); responsible.Inventory.Add(product); responsible.FinishJob(); ResetRecipe(); }
public IEnumerator Eat(Responsible responsible) { if (_harvestable) { yield return(StartCoroutine(responsible.Walk(interactionPoint.transform.position))); } yield return(Util.WaitForSeconds(responsible.GetCurrentJob(), eatDuration)); if (_harvestable) { GroundUtil.Clear(gameObject.transform.position); } else { responsible.Inventory.Remove(gameObject); } responsible.Inventory.Add(CreateSeed()); responsible.Heal(20); Destroy(gameObject, 0.5f); responsible.FinishJob(); }
public IEnumerator Walk(Responsible responsible) { yield return(StartCoroutine(responsible.Walk(interactionPoint.transform.position))); responsible.FinishJob(); }