コード例 #1
0
 public void Set(CubeBlock block)
 {
     workObject = block;
     workObject.SetWorksite(this);
     GameMaster.colonyController.SendWorkers(START_WORKERS_COUNT, this);
     if (!worksitesList.Contains(this))
     {
         worksitesList.Add(this);
     }
     if (!subscribedToUpdate)
     {
         GameMaster.realMaster.labourUpdateEvent += WorkUpdate;
         subscribedToUpdate = true;
     }
 }
コード例 #2
0
    public void Set(CubeBlock block, bool work_is_dig)
    {
        workObject = block;
        workObject.SetWorksite(this);
        dig = work_is_dig;
        if (dig)
        {
            Block b = GameMaster.mainChunk.GetBlock(block.pos.x, block.pos.y + 1, block.pos.z);
            if (b != null && (b.type == BlockType.Surface & b.worksite == null))
            {
                CleanSite cs = b.gameObject.AddComponent <CleanSite>();
                TransferWorkers(this, cs);
                cs.Set(b as SurfaceBlock, true);
                if (showOnGUI)
                {
                    cs.ShowOnGUI();
                    showOnGUI = false;
                }
                StopWork();
                return;
            }
            sign = Instantiate(Resources.Load <GameObject> ("Prefs/DigSign")).GetComponent <WorksiteSign>();
        }
        else
        {
            sign = Instantiate(Resources.Load <GameObject>("Prefs/PourInSign")).GetComponent <WorksiteSign>();
        }
        sign.worksite           = this;
        sign.transform.position = workObject.transform.position + Vector3.up * Block.QUAD_SIZE;
        //FollowingCamera.main.cameraChangedEvent += SignCameraUpdate;

        mainResource = ResourceType.GetResourceTypeById(workObject.material_id);
        if (workersCount < START_WORKERS_COUNT)
        {
            GameMaster.colonyController.SendWorkers(START_WORKERS_COUNT, this);
        }
        if (!worksitesList.Contains(this))
        {
            worksitesList.Add(this);
        }
        if (!subscribedToUpdate)
        {
            GameMaster.realMaster.labourUpdateEvent += WorkUpdate;
            subscribedToUpdate = true;
        }
    }