コード例 #1
0
    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();
    }
コード例 #2
0
        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();
        }