Пример #1
0
    private static Entity GetBuildingPrefab(Building b, BuildingTypeSpawner s)
    {
        switch (b.buildingType)
        {
        case e_BuildingTypes.Terran_Habitat:
            return(s.Terran_Habitat);

        case e_BuildingTypes.Terran_House:
            return(s.Terran_House);

        case e_BuildingTypes.Terran_Resident_Block:
            return(s.Terran_ResidentBlock);

        case e_BuildingTypes.Terran_Energy_Sphere:
            return(s.Terran_EnergySphere);

        case e_BuildingTypes.Terran_Aqua_Store:
            return(s.Terran_AquaStore);

        case e_BuildingTypes.Terran_Plasma_Cannon:
            return(s.Terran_PlasmaCannon);

        default:
            Debug.Log("No building type found");
            return(Entity.Null);
        }
    }
Пример #2
0
    private static Entity GetBuildingConstructionPrefab(Building b, BuildingTypeSpawner s)
    {
        switch (b.buildingType)
        {
        case e_BuildingTypes.Terran_Habitat:
            return(s.Terran_Habitat_Construction);

        case e_BuildingTypes.Terran_House:
            return(s.Terran_House_Construction);

        case e_BuildingTypes.Terran_Resident_Block:
            return(s.Terran_ResidentBlock_Construction);

        case e_BuildingTypes.Terran_Energy_Sphere:
            return(s.Terran_EnergySphere_Construction);

        case e_BuildingTypes.Terran_Aqua_Store:
            return(s.Terran_AquaStore_Construction);

        case e_BuildingTypes.Terran_Plasma_Cannon:
            return(s.Terran_PlasmaCannon_Construction);

        default:
            return(Entity.Null);
        }
    }
Пример #3
0
    // Lets you convert the editor data representation to the entity optimal runtime representation
    public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
    {
        var spawnerData = new BuildingTypeSpawner
        {
            Terran_Habitat       = conversionSystem.GetPrimaryEntity(Terran_Habitat),
            Terran_House         = conversionSystem.GetPrimaryEntity(Terran_House),
            Terran_ResidentBlock = conversionSystem.GetPrimaryEntity(Terran_ResidentBlock),
            Terran_EnergySphere  = conversionSystem.GetPrimaryEntity(Terran_EnergySphere),
            Terran_AquaStore     = conversionSystem.GetPrimaryEntity(Terran_AquaStore),
            Terran_PlasmaCannon  = conversionSystem.GetPrimaryEntity(Terran_PlasmaCannon),

            Terran_Habitat_Construction       = conversionSystem.GetPrimaryEntity(Terran_Habitat_Construction),
            Terran_House_Construction         = conversionSystem.GetPrimaryEntity(Terran_House_Construction),
            Terran_ResidentBlock_Construction = conversionSystem.GetPrimaryEntity(Terran_ResidentBlock_Construction),
            Terran_EnergySphere_Construction  = conversionSystem.GetPrimaryEntity(Terran_EnergySphere_Construction),
            Terran_AquaStore_Construction     = conversionSystem.GetPrimaryEntity(Terran_AquaStore_Construction),
            Terran_PlasmaCannon_Construction  = conversionSystem.GetPrimaryEntity(Terran_PlasmaCannon_Construction),

            Road = conversionSystem.GetPrimaryEntity(Road),
        };

        dstManager.AddComponentData(entity, spawnerData);
    }