Пример #1
0
    public void SpawnStructure(string structureName, Vector3 buildPoint, UnitController builder, Rect playingArea)
    {
        GameObject structureToSpawn = (GameObject)Instantiate(GameManager.activeInstance.GetStructurePrefab(structureName),
            buildPoint, new Quaternion());

        constructionSite = structureToSpawn.GetComponent<StructureController>();
        if (constructionSite != null)
        {
            constructor = builder;
            isSettingConstructionPoint = true;
            constructionSite.SetTransparencyMaterial(notAllowedMaterial, true);
            constructionSite.SetColliders(false);
            constructionSite.playingArea = playingArea;
        }
        else
        {
            Destroy(structureToSpawn);
        }
    }