Пример #1
0
        public override void Setup(GridObject gridObject, Direction dir, FactoryNeighbors customNeighbors = null)
        {
            base.Setup(gridObject, dir, customNeighbors);
            FactoryObject outputNeighbor = Neighbors.GetSide(OutputDirection);

            if (outputNeighbor != null)
            {
                FactoryBelt belt = outputNeighbor.GetComponent <FactoryBelt>();
                if (belt != null)
                {
                    _output = new BeltConnection(belt);
                }
                //FactoryAssembler assembler = outputNeighbor.GetComponent<FactoryAssembler>();
                //if (assembler != null) _output = new AssemblerConnection(assembler);
            }
            FactoryObject inputNeighbor = Neighbors.GetSide(InputDirection);

            if (inputNeighbor != null)
            {
                FactoryBelt belt = inputNeighbor.GetComponent <FactoryBelt>();
                if (belt != null)
                {
                    _input = new BeltConnection(belt);
                }
                FactoryCreativeOutput creativeOutput = inputNeighbor.GetComponent <FactoryCreativeOutput>();
                if (creativeOutput != null)
                {
                    _input = new CreativeOutputConnection(creativeOutput);
                }
                //FactoryAssembler assembler = inputNeighbor.GetComponent<FactoryAssembler>();
                //if (assembler != null) _input = new AssemblerConnection(assembler);
            }
        }
        public void SetFactoryObject(FactoryObject obj)
        {
            FactoryCreativeOutput creativeOutput = obj.GetComponent <FactoryCreativeOutput>();

            if (creativeOutput != null)
            {
                _creativeOutputMenu.gameObject.SetActive(true);
                _creativeOutputMenu.Setup(creativeOutput);
            }
        }
        public override void Setup(GridObject gridObject, Direction dir, FactoryNeighbors customNeighbors = null)
        {
            base.Setup(gridObject, dir, customNeighbors);
            FactoryObject northFactory = Neighbors.GetNeighbor(Direction.North);

            if (northFactory != null)
            {
                FactoryBelt belt = northFactory.GetComponent <FactoryBelt>();
                if (belt != null && belt.Dir == Direction.North)
                {
                    AddBelt(belt, Dir == Direction.North);
                }
            }
            FactoryObject eastFactory = Neighbors.GetNeighbor(Direction.East);

            if (eastFactory != null)
            {
                FactoryBelt belt = eastFactory.GetComponent <FactoryBelt>();
                if (belt != null && belt.Dir == Direction.East)
                {
                    AddBelt(belt, Dir == Direction.East);
                }
            }
            FactoryObject southFactory = Neighbors.GetNeighbor(Direction.South);

            if (southFactory != null)
            {
                FactoryBelt belt = southFactory.GetComponent <FactoryBelt>();
                if (belt != null && belt.Dir == Direction.South)
                {
                    AddBelt(belt, Dir == Direction.South);
                }
            }
            FactoryObject westFactory = Neighbors.GetNeighbor(Direction.West);

            if (westFactory != null)
            {
                FactoryBelt belt = westFactory.GetComponent <FactoryBelt>();
                if (belt != null && belt.Dir == Direction.West)
                {
                    AddBelt(belt, Dir == Direction.West);
                }
            }
        }