Example #1
0
    public override void doWork(AIWorker worker)
    {
        FinishJob();
        if (pointValue == 0)
        {
            pointValue = PointObjectManager.worldTree.GetValueAt(cubePoint);
        }
        if (pointValue == 3)
        {
            if (excavationTimer >= 0.4f)
            {
                FinishJob();
            }
        }
        else if (pointValue == 2)
        {
            if (excavationTimer >= 2.0f)
            {
                FinishJob();
            }
        }
        if (pointValue == 1 || pointValue >= 4)
        {
            WorkManager.RemoveWorkFromQueue(this);

            Erase();
        }
        excavationTimer += Time.deltaTime;
    }
Example #2
0
    public static Work FindClosestWork(AIWorker worker)
    {
        if (manager.workQueue != null)
        {

            float sqrDistance = float.MaxValue;
            Work tempWork = null;
            for (int i = 0; i < manager.workQueue.Count; i++)
            {
                if (manager.workQueue[i].assignedWorker == null && worker.typeData.IsValidWork(manager.workQueue[i].workType.workTypeID))
                {

                    float tempSQRDistance = manager.GetDistanceToWork(worker,manager.workQueue[i]);

                    if (tempSQRDistance <= sqrDistance)
                    {
                        sqrDistance = tempSQRDistance;
                        tempWork = manager.workQueue[i];

                    }
                }
                else
                {
                    //DebugOutput.Shout("failed work check! " + (manager.workQueue[i].assignedWorker == null).ToString() + "   " + worker.typeData.IsValidWork(manager.workQueue[i].workType.workTypeID).ToString());

                }
            }

            return tempWork;
        }
        return null;
    }
Example #3
0
 public override void Dispose()
 {
     if (AIWorker != null)
     {
         AIWorker.Abort();
         AIWorker = null;
     }
 }
Example #4
0
 public override void doWork(AIWorker worker)
 {
     if (surveyProject == null)
     {
         surveyProject = SurveyManager.CreateProject();
         surveyProject.StartWork(cubePoint);
     }
     if (surveyProject.IsComplete())
     {
         FinishJob();
     }
     //base.doWork(worker);
 }
Example #5
0
 public float GetDistanceToWork(AIWorker worker, Work work)
 {
     //need A*Star pathfinding.
     return (worker.transform.position - work.cubePoint).sqrMagnitude;
 }
Example #6
0
 public override void doWork(AIWorker worker)
 {
     if (workTimer <= 0.0f)
     {
         FinishJob();
     }
     else
     {
         workTimer -= Time.deltaTime;
     }
 }