Ejemplo n.º 1
0
        void Start()
        {
            List <PathComponent> tmpPathComponents      = new List <PathComponent>();
            List <Transform>     tmpTransformComponents = new List <Transform>();

            List <GameObject> tmpEntities = GetEntities();

            foreach (GameObject e in tmpEntities)
            {
                if (e.GetComponent <PathComponent>() != null)
                {
                    tmpPathComponents.Add(e.GetComponent <PathComponent>());
                    tmpTransformComponents.Add(e.GetComponent <Transform>());
                }
            }

            pathComponents      = tmpPathComponents.ToArray();
            transformComponents = tmpTransformComponents.ToArray();

            aStarSystem = FindObjectOfType <AstarSystem>();
        }
Ejemplo n.º 2
0
        void Start()
        {
            List <PathComponent> tmpPathComponents = new List <PathComponent>();
            List <DwellingSlotIndexComponent> tmpDwellingSlotIndexComponents = new List <DwellingSlotIndexComponent>();
            List <WorkingSlotIndexComponent>  tmpWorkingSlotIndexComponents  = new List <WorkingSlotIndexComponent>();
            List <Transform>          tmpTransformComponents = new List <Transform>();
            List <InventoryComponent> tmpInventoryComponents = new List <InventoryComponent>();

            List <GameObject> tmpEntities = GetEntities();

            foreach (GameObject e in tmpEntities)
            {
                if (e.GetComponent <PathComponent>() != null &&
                    e.GetComponent <DwellingSlotIndexComponent>() != null &&
                    e.GetComponent <WorkingSlotIndexComponent>() != null)
                {
                    tmpPathComponents.Add(e.GetComponent <PathComponent>());
                    tmpDwellingSlotIndexComponents.Add(e.GetComponent <DwellingSlotIndexComponent>());
                    tmpWorkingSlotIndexComponents.Add(e.GetComponent <WorkingSlotIndexComponent>());
                    tmpTransformComponents.Add(e.GetComponent <Transform>());
                    if (e.GetComponent <InventoryComponent>())
                    {
                        tmpInventoryComponents.Add(e.GetComponent <InventoryComponent>());
                    }
                    else
                    {
                        tmpInventoryComponents.Add(null);
                    }
                }
            }

            pathComponents = tmpPathComponents.ToArray();
            dwellingSlotIndexComponents = tmpDwellingSlotIndexComponents.ToArray();
            workingSlotIndexComponents  = tmpWorkingSlotIndexComponents.ToArray();
            dwarfsTransformComponents   = tmpTransformComponents.ToArray();
            inventoryComponents         = tmpInventoryComponents.ToArray();

            aStarSystem = FindObjectOfType <AstarSystem>();
        }
Ejemplo n.º 3
0
        void Start()
        {
            //Dwarfs
            List <PathComponent>      tmpPathComponents            = new List <PathComponent>();
            List <Transform>          tmpDwarfsTransformComponents = new List <Transform>();
            List <InventoryComponent> tmpDwarfsInventoryComponents = new List <InventoryComponent>();

            //Giver
            List <DwarfsSlots>    tmpGiverDwarfsSlotsComponents         = new List <DwarfsSlots>();
            List <Transform>      tmpGiverBuildingsTransformsComponents = new List <Transform>();
            List <GiverComponent> tmpGiverComponents = new List <GiverComponent>();

            //Receiver
            List <DwarfsSlots>       tmpReceiverDwarfsSlotsComponents         = new List <DwarfsSlots>();
            List <Transform>         tmpReceiverBuildingsTransformsComponents = new List <Transform>();
            List <ReceiverComponent> tmpReceiverComponents = new List <ReceiverComponent>();

            //Storage
            List <DwarfsSlots> tmpPassiveInventoryDwarfsSlotsComponents    = new List <DwarfsSlots>();
            List <Transform>   tmpPassiveInventoryTransformsComponents     = new List <Transform>();
            List <PassiveInventoryComponent> tmpPassiveInventoryComponents = new List <PassiveInventoryComponent>();

            List <GameObject> tmpEntities = GetEntities();

            foreach (GameObject e in tmpEntities)
            {
                if (e.GetComponent <PathComponent>() && e.GetComponent <InventoryComponent>())
                {
                    tmpPathComponents.Add(e.GetComponent <PathComponent>());
                    tmpDwarfsTransformComponents.Add(e.GetComponent <Transform>());
                    tmpDwarfsInventoryComponents.Add((e.GetComponent <InventoryComponent>()));
                }
                else if (e.GetComponent <DwarfsSlots>() &&
                         e.GetComponent <GiverComponent>())
                {
                    tmpGiverDwarfsSlotsComponents.Add(e.GetComponent <DwarfsSlots>());
                    tmpGiverComponents.Add(e.GetComponent <GiverComponent>());
                    tmpGiverBuildingsTransformsComponents.Add(e.GetComponent <Transform>());
                }
                else if (e.GetComponent <DwarfsSlots>() &&
                         e.GetComponent <ReceiverComponent>())
                {
                    tmpReceiverDwarfsSlotsComponents.Add(e.GetComponent <DwarfsSlots>());
                    tmpReceiverComponents.Add(e.GetComponent <ReceiverComponent>());
                    tmpReceiverBuildingsTransformsComponents.Add(e.GetComponent <Transform>());
                }
                else if (e.GetComponent <PassiveInventoryComponent>() &&
                         e.GetComponent <DwarfsSlots>())
                {
                    foreach (PassiveInventoryComponent passiveInventoryComponent in e.GetComponents <PassiveInventoryComponent>())
                    {
                        tmpPassiveInventoryComponents.Add(passiveInventoryComponent);
                        tmpPassiveInventoryDwarfsSlotsComponents.Add(e.GetComponent <DwarfsSlots>());
                        tmpPassiveInventoryTransformsComponents.Add(e.GetComponent <Transform>());
                    }
                }
            }

            //Dwarfs
            pathComponents            = tmpPathComponents.ToArray();
            dwarfsTransformComponents = tmpDwarfsTransformComponents.ToArray();
            dwarfsInventoryComponents = tmpDwarfsInventoryComponents.ToArray();

            //Giver
            giverDwarfsSlotComponents = tmpGiverDwarfsSlotsComponents.ToArray();
            giverComponents           = tmpGiverComponents.ToArray();
            giverTransformComponents  = tmpGiverBuildingsTransformsComponents.ToArray();

            //Receiver
            receiverDwarfsSlotComponents = tmpReceiverDwarfsSlotsComponents.ToArray();
            receiverComponents           = tmpReceiverComponents.ToArray();
            receiverTransformComponents  = tmpReceiverBuildingsTransformsComponents.ToArray();

            //Storage
            passiveInventoryDwarfsSlotsComponents = tmpPassiveInventoryDwarfsSlotsComponents.ToArray();
            passiveInventoryTransformsComponents  = tmpPassiveInventoryTransformsComponents.ToArray();
            passiveInventoryComponents            = tmpPassiveInventoryComponents.ToArray();

            aStarSystem    = FindObjectOfType <AstarSystem>();
            dayCycleSystem = FindObjectOfType <DayCycleSystem>();
        }