void Start()
 {
     pathFollowSystem     = FindObjectOfType <PathFollowSystem>();
     dayCycleSystem       = FindObjectOfType <DayCycleSystem>();
     followCursorSystem   = FindObjectOfType <FollowCursorSystem>();
     growthSystem         = FindObjectOfType <GrowthSystem>();
     motionSystem         = FindObjectOfType <MotionSystem>();
     randomMovementSystem = FindObjectOfType <RandomMovementSystem>();
     rotationSystem       = FindObjectOfType <RotationSystem>();
 }
Example #2
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>();
        }