Пример #1
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");
        }
    }