示例#1
0
    private void InfoCollectJob(Vector3 point, float radius)
    {
        if (area != 0 && !position.Equals(Vector3.zero))
        {
            var colliders = Physics.OverlapSphere(point, radius);

            for (int i = 0; i < colliders.Length; i++)
            {
                WoodTree woodTree;
                if ((woodTree = colliders[i].gameObject.GetComponent <WoodTree>()) != null)
                {
                    Job moveJob = new Job(Job.JobType.MOVE);
                    moveJob.position = woodTree.transform.position;

                    Job    examineJob    = new Job(Job.JobType.ACTION);
                    Action actionAddTree = new Action(() => {
                        woodTrees.Add(woodTree);
                    });
                    examineJob.extra0 = actionAddTree;

                    cheif.AddJob(moveJob);
                    cheif.AddJob(examineJob);
                }
            }
            Job    actionJob = new Job(Job.JobType.ACTION);
            Action action    = new Action(() =>
            {
                status = HarvestWoodWorkStatus.WORKING;
            });
            actionJob.extra0 = action;
            cheif.AddJob(actionJob);
        }
    }
示例#2
0
    private void HarvestWoodWork_onAreaChanged(HarvestWoodWork work, Vector3 point, float radius)
    {
        woodTrees.Clear();

        status = HarvestWoodWorkStatus.INFO_COLLECT;
        if (cheif != null)
        {
            InfoCollectJob(point, radius);
        }
    }
示例#3
0
    private void HarvestWoodWork_onCheifChanged(NPCLogic currentCheif)
    {
        woodTrees.Clear();

        status = HarvestWoodWorkStatus.INFO_COLLECT;
        if (cheif != null)
        {
            InfoCollectJob(position.position, area);
        }
    }