Exemple #1
0
 void AddToGroundPlatformList(Ground groundPlatform)
 {
     if (npc)
     {
         WorkerNPC npcScript = GetComponent <WorkerNPC>();
         if (!groundPlatform.workers.Contains(npcScript))
         {
             groundPlatform.ResetResourceFetching();
             groundPlatform.workers.Add(npcScript);
         }
     }
     else if (structure)
     {
         GroundStructure groundStructureScript = GetComponent <GroundStructure>();
         groundStructureScript.Landed();
         if (!groundPlatform.structures.Contains(groundStructureScript))
         {
             groundPlatform.ResetResourceFetching();
             groundPlatform.structures.Add(groundStructureScript);
         }
     }
     else if (resource)
     {
         ProcessedResource processedResourceScript = GetComponent <ProcessedResource>();
         if (!groundPlatform.resources.Contains(processedResourceScript))
         {
             groundPlatform.ResetResourceFetching();
             groundPlatform.resources.Add(processedResourceScript);
         }
     }
 }
Exemple #2
0
    IEnumerator BuildChannel(WorkerNPC npc)
    {
        yield return(new WaitForSeconds(workTime));

        Debug.Log("Raise the channel");
        transform.position = new Vector3(fallingScript.groundPlatform.struts[0].transform.position.x, transform.position.y + heightIncrease, transform.position.z);
        Build(npc);
    }
Exemple #3
0
    IEnumerator BuildStrut(WorkerNPC npc)
    {
        yield return(new WaitForSeconds(workTime));

        Debug.Log("Built the strut");
        transform.position = new Vector3(transform.position.x, transform.position.y + heightIncrease, transform.position.z);
        if (!groundStructureScript.groundPlatform.struts.Contains(this))
        {
            groundStructureScript.groundPlatform.struts.Add(this);
        }
        npc.hasResource = false;
        npc.FetchResource();
    }
Exemple #4
0
    // my classes

    public void TakeAction(WorkerNPC npc)
    {
        Debug.Log("Perform Action... custom to each ");
        workerScript = npc;
        if (tree)
        {
            Debug.Log("Chop the tree");
            treeScript.Chop();
        }
        else if (strut)
        {
            Debug.Log("Build the strut");
            if (npc.hasResource)
            {
                strutScript.Build(npc);
            }
            else
            {
                npc.FetchResource();
            }
        }
        else if (channelBuilder)
        {
            Debug.Log("Construct the channel");
            if (npc.hasResource)
            {
                channelBuilderScript.Build(npc);
            }
            else
            {
                npc.FetchResource();
            }
        }
        else if (channel)
        {
            Debug.Log("Build the channel");
            // no resources needed to erect a channel
            channelScript.Build(npc);
        }
        else if (windmill)
        {
            Debug.Log("Build the windmill");
        }
        else if (waterWheel)
        {
            Debug.Log("Build the waterWheel");
        }
    }
    IEnumerator ConstructChannel(WorkerNPC npc)
    {
        yield return(new WaitForSeconds(workTime));

        amountPaid++;
        Debug.Log("Built section of the channel");
        npc.hasResource = false;
        if (amountPaid >= cost)
        {
            Debug.Log("Completed a channel");
            amountPaid = 0;
            GameObject builtChannel = (GameObject)Instantiate(channelPrefab, transform.position, Quaternion.identity);
            groundStructureScript.groundPlatform.structures.Add(builtChannel.GetComponent <GroundStructure>());
        }
        else
        {
            Debug.Log("Still building a channel");
        }
        npc.FetchResource();
    }
Exemple #6
0
 public void Build(WorkerNPC npc)
 {
     Debug.Log("Building the channel");
     StartCoroutine(BuildChannel(npc));
 }
Exemple #7
0
 public void Build(WorkerNPC npc)
 {
     Debug.Log("Building the strut");
     StartCoroutine(BuildStrut(npc));
 }