private bool CanHarvest(JunklingSensor resource)
 {
     targetResource = resource.GetTileCollider().GetComponent<ResourceController>();
     string type = targetResource.GetTileType();
     if(type==TileTypes.ROCK && !canHarvestRock) return false;
     if(targetResource.IsSpawned())
     {
         StartHarvest();
         return true;
     }
     return false;
 }
    private bool CanHarvest(JunklingSensor resource)
    {
        targetResource = resource.GetTileCollider().GetComponent <ResourceController>();
        string type = targetResource.GetTileType();

        if (type == TileTypes.ROCK && !canHarvestRock)
        {
            return(false);
        }
        if (targetResource.IsSpawned())
        {
            StartHarvest();
            return(true);
        }
        return(false);
    }
    private bool CheckDeposit()
    {
        if (resourceCarried == TileTypes.NONE)
        {
            return(false);
        }
        DepotControllerContainer con = new DepotControllerContainer();

        if (TileTypes.IsDepot(right.GetTileType()))
        {
            right.GetTileCollider().gameObject.SendMessage("GetDepotController", con);
            targetDepot = con.controller;
            if (targetDepot.AcceptsResource(resourceCarried))
            {
                StartDeposit();
                return(true);
            }
        }
        if (TileTypes.IsDepot(left.GetTileType()))
        {
            left.GetTileCollider().gameObject.SendMessage("GetDepotController", con);
            targetDepot = con.controller;
            if (targetDepot.AcceptsResource(resourceCarried))
            {
                StartDeposit();
                return(true);
            }
        }
        if (TileTypes.IsDepot(forward.GetTileType()))
        {
            forward.GetTileCollider().gameObject.SendMessage("GetDepotController", con);
            targetDepot = con.controller;
            if (targetDepot.AcceptsResource(resourceCarried))
            {
                StartDeposit();
                return(true);
            }
        }

        return(false);
    }
    private void RemoveItem()
    {
        Collider c = sensor.GetTileCollider();

        if (c)
        {
            GameObject g = c.gameObject;
            if (g.tag == TileTypes.FORGE_IN || g.tag == TileTypes.FORGE_OUT)
            {
                g = g.transform.parent.gameObject;
            }
            else if (g.tag == TileTypes.PATH)
            {
                g = g.transform.parent.gameObject;
            }
            else if (TileTypes.IsResource(g.tag))
            {
                return;
            }
            Destroy(g);
        }
    }