private void toggleBuildMode()
    {
        if (!canToggleBuildMode())
        {
            return;
        }

        BuildMode oldMode = buildMode;

        string announceText = string.Empty;

        if (buildModeFlag == BuildModeFlags.FREE)
        {
            buildMode     = new PointBuild();
            buildModeFlag = BuildModeFlags.POINTBASED;
            announceText  = "POINTBASED";
        }
        else if (buildModeFlag == BuildModeFlags.POINTBASED)
        {
            buildMode     = new FreeBuild();
            buildModeFlag = BuildModeFlags.FREE;
            announceText  = "FREE";
        }

        UIHandler.Instance.announceEvent("BUILDMODE: " + announceText);

        oldMode.resetSpawnedObject();
        buildMode.setSpawnedObj(oldMode.getSpawnedObj());
        buildMode.prepare();
        prepareBuildMode();
    }
    private void setBuildMode(GameObject prefab)
    {
        prefabObj = prefab;
        if (FlagHelper.IsSet(prefab.GetComponent <BuildItem>().buildModeFlags, BuildModeFlags.FREE))
        {
            buildMode     = new FreeBuild();
            buildModeFlag = BuildModeFlags.FREE;
        }
        else if (FlagHelper.IsSet(prefab.GetComponent <BuildItem>().buildModeFlags, BuildModeFlags.POINTBASED))
        {
            buildMode     = new PointBuild();
            buildModeFlag = BuildModeFlags.POINTBASED;
        }

        prepareBuildMode();
    }