예제 #1
0
    //*************************************************************************************************Go NEXT //to next Mine or home
    private static void GoNext(Transform mytransform, Vector3 target, Func <string, bool> retf)
    {
        Commanded com = mytransform.gameObject.GetComponent <Commanded>();

        if (com.Loaded <= com.Capacity)
        {
            Vector3 nextTarget = MineInspector.GetNextBase(target);
            com.Command("Go!", com.currentTarget, nextTarget);
        }
        else
        {
            com.Command("ToStorage", com.currentTarget, target);
        }
    }
예제 #2
0
    private void Upnloading(Collider col)
    {
        if (col.gameObject.layer == LayerMask.NameToLayer("Worker"))
        {
            Commanded worker = col.gameObject.GetComponent <Commanded>();

            if (worker.Loaded > 0)
            {
                worker.Command("UnLoading", name, transform.position);
            }
            else
            {
                worker.Command("Away!", "", Random.insideUnitSphere * 20);
            }
        }
    }
예제 #3
0
파일: Mine.cs 프로젝트: Ramazoid/SevCraft
 private void Mining(Collider col)
 {
     if (col.gameObject.layer == LayerMask.NameToLayer("Worker"))
     {
         Commanded worker = col.gameObject.GetComponent <Commanded>();
         if (WWorkersOnBoard < WorkersCapacity && ResourceCapacity > 0)
         {
             WWorkersOnBoard++;
             worker.Command("Mining", name, transform.position);
         }
         else
         {
             worker.Command("Away!", "", Random.insideUnitSphere * 20);
         }
     }
 }
예제 #4
0
    //**********************************************************************************************GToStorage
    private static void ToStorage(Transform mytransform, Vector3 target, Func <string, bool> retf)
    {
        Vector3 dir = mytransform.position - target;

        target = mytransform.position + dir * Settings.GetOffDistance;
        Commanded com = mytransform.gameObject.GetComponent <Commanded>();

        com.Command("Away!", "", target);
        retf("wellDone");
    }
예제 #5
0
    private void BurnWorker(int i)
    {
        GameObject worker = Instantiate(workerPrefab);

        worker.name = "Worker_" + i;
        worker.transform.position = transform.position + Random.insideUnitSphere * 5;
        Vector3 v = transform.position + Random.insideUnitSphere * 5;

        worker.transform.position = new Vector3(v.x, 1.05f, v.z);
        Commanded com = worker.GetComponent <Commanded>();

        com.homeBase = transform.position;
        com.Command("GetOFF", "", transform.position);
    }
예제 #6
0
    }//*************************************************************************************************MINE ME

    private static void MineMe(Transform mytransform, Vector3 target, Func <string, bool> retf)
    {
        Commanded com          = mytransform.gameObject.GetComponent <Commanded>();
        float     randomfactor = Random.Range(0f, 1f);

        mytransform.RotateAround(target, Random.insideUnitSphere, 2 * randomfactor);

        if (com.ActionTime-- > 0)
        {
            retf("dd");
        }
        else
        {
            if (MineInspector.Spend(com.currentTarget))
            {
                com.Loaded++;
                com.Command("Mining", com.currentTarget, target);
            }
            else
            {
                com.Command("GetOFF", com.currentTarget, target);
            }
        }
    }//*************************************************************************************************Unloading