private void Initialize()
    {
        for (int i = 0; i < basicEconomyValues.Length; i++)
        {
            EconomyBuilding eB = BasicValues.AddComponent <EconomyBuilding> ();           //new EconomyBuilding ();

            basicEconomyValues [i] = eB;
        }
    }
예제 #2
0
    private void CopyBasicValues(EconomyBuilding basicValuesEB)
    {
        //EconomyBuilding myEconomyParams = new EconomyBuilding();

        EconomyBuilding[] EBArray = EconomyBuildings.GetComponentsInChildren <EconomyBuilding>();

        bool buildingRegistered = false;

        if (EBArray.Length != 0)
        {
            foreach (EconomyBuilding eb in EBArray)
            {
                if (eb.structureIndex == structureIndex)
                {
                    eb.structureIndex = structureIndex;
                    eb.ProdPerHour    = basicValuesEB.ProdPerHour;
                    eb.StoreCap       = basicValuesEB.StoreCap;
                    eb.StructureType  = structureType;
                    eb.ProdType       = basicValuesEB.ProdType;
                    eb.StoreType      = basicValuesEB.StoreType;
                    eb.StoreResource  = basicValuesEB.StoreResource;

                    ResourceGenerator.InstanceResourceGenerator.index++;
                    productionListIndex = ResourceGenerator.InstanceResourceGenerator.index;
                    ResourceGenerator.InstanceResourceGenerator.existingEconomyBuildings.Add(eb);
                    RegisterNotification();

                    buildingRegistered = true;
                }
            }
        }

        if (!buildingRegistered)
        {
            EconomyBuilding eb = EconomyBuildings.AddComponent <EconomyBuilding> ();

            eb.structureIndex = structureIndex;
            eb.ProdPerHour    = basicValuesEB.ProdPerHour;
            eb.StoreCap       = basicValuesEB.StoreCap;
            eb.StructureType  = structureType;
            eb.ProdType       = basicValuesEB.ProdType;
            eb.StoreType      = basicValuesEB.StoreType;
            eb.StoreResource  = basicValuesEB.StoreResource;

            ResourceGenerator.InstanceResourceGenerator.index++;
            productionListIndex = ResourceGenerator.InstanceResourceGenerator.index;
            ResourceGenerator.InstanceResourceGenerator.existingEconomyBuildings.Add(eb);

            RegisterNotification();
        }
    }