コード例 #1
0
    private bool CheckHarvest()
    {
        if (resourceCarried != TileTypes.NONE)
        {
            return(false);
        }

        if (TileTypes.IsResource(right.GetTileType()))
        {
            if (CanHarvest(right))
            {
                return(true);
            }
        }
        if (TileTypes.IsResource(left.GetTileType()))
        {
            if (CanHarvest(left))
            {
                return(true);
            }
        }
        if (TileTypes.IsResource(forward.GetTileType()))
        {
            if (CanHarvest(forward))
            {
                return(true);
            }
        }

        return(false);
    }
コード例 #2
0
    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);
        }
    }