Esempio n. 1
0
        public void AttachResource(ResourceBlock rb, ObjectInfo objectInfo)
        {
            childResource = rb;
            carrierUnit   = objectInfo;
            //TODO: change for several materials


            resourceImage.material = stoneMaterial;
        }
Esempio n. 2
0
 // Update is called once per frame
 void Update()
 {
     if (nodeManager != null && heldResources.ContainsKey(nodeManager.resourceType))
     {
         ResourceBlock blockToUpdate = heldResources[nodeManager.resourceType];
         if ((blockToUpdate.amount == blockToUpdate.maxAmount || gatheringFrom == null) && isGathering)
         {
             //go back to drop-off point
             StopGathering();
         }
     }
 }
Esempio n. 3
0
        private void StartGathering(GameObject resourceGameObject)
        {
            gatheringFrom = resourceGameObject;
            nodeManager   = resourceGameObject.GetComponent <NodeManager>();
            isGathering   = true;
            if (!heldResources.ContainsKey(nodeManager.resourceType) || heldResources[nodeManager.resourceType].amount == 0)
            {
                ResourceBlock newBlock = new ResourceBlock();
                newBlock.amount    = 0;
                newBlock.maxAmount = maxHeldResourcePerBlock;
                newBlock.type      = nodeManager.resourceType;
                heldResources[nodeManager.resourceType] = newBlock;

                if (objectInfo.isSelected)
                {
                    FindObjectOfType <UnitUIManager>().InsertInventoryItem(this, nodeManager.resourceType, GetComponent <ObjectInfo>());
                }
            }
        }