static float CalculateG(PathfindingObject curObject)
    {
        float newG;

        if (!curObject.HasFakeParent())           // gridCell.ultimateParent

        {
            print("problems!!!");
            return(-999);

            // if there is a parent
        }
        else
        {
            // check if connection is straight or diagonal (ID's because of performance issues)
            newG = (HORIZONTAL_VERTICAL_COST * curObject.GetGCostMultiplier()) + curObject.GetFakeParent().GetGCost();

            curObject.SetGCost(newG);
            return(newG);
        }
    }