Пример #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);
            }
        }
Пример #2
0
        public override void Setup(GridObject gridObject, Direction dir, FactoryNeighbors customNeighbors = null)
        {
            base.Setup(gridObject, dir, customNeighbors);
            FactoryBelt frontBelt = Neighbors.GetSide(OutputDirection)?.GetComponent <FactoryBelt>();

            if (frontBelt != null && MatchesIO(frontBelt.InputDirection, frontBelt.Dir, OutputDirection))
            {
                //Fix weird cases
                if (Vector3.Distance(LeftOutputSlot.transform.position, frontBelt.LeftInputSlot.transform.position) < 1)
                {
                    LeftOutputSlot.NextPosition = frontBelt.LeftInputSlot;
                    frontBelt.LeftInputSlot.PreviousPosition = LeftOutputSlot;
                }
                if (Vector3.Distance(RightOutputSlot.transform.position, frontBelt.RightInputSlot.transform.position) < 1)
                {
                    RightOutputSlot.NextPosition = frontBelt.RightInputSlot;
                    frontBelt.RightInputSlot.PreviousPosition = RightOutputSlot;
                }
            }
            FactoryBelt backBelt = Neighbors.GetSide(InputDirection)?.GetComponent <FactoryBelt>();

            if (backBelt != null && MatchesIO(backBelt.OutputDirection, backBelt.Dir, InputDirection))
            {
                //Fix weird cases
                if (Vector3.Distance(backBelt.LeftOutputSlot.transform.position, LeftInputSlot.transform.position) < 1)
                {
                    backBelt.LeftOutputSlot.NextPosition = LeftInputSlot;
                    LeftInputSlot.PreviousPosition       = backBelt.LeftOutputSlot;
                }
                if (Vector3.Distance(backBelt.RightOutputSlot.transform.position, RightInputSlot.transform.position) < 1)
                {
                    backBelt.RightOutputSlot.NextPosition = RightInputSlot;
                    RightInputSlot.PreviousPosition       = backBelt.RightOutputSlot;
                }
            }
            FactoryCreativeOutput creativeOutput = Neighbors.GetSide(InputDirection)?.GetComponent <FactoryCreativeOutput>();

            if (creativeOutput != null)
            {
                creativeOutput.AddBelt(this);
            }
            FactoryAssembler assembler = Neighbors.GetSide(InputDirection)?.GetComponent <FactoryAssembler>();

            if (assembler != null)
            {
                if (Dir == assembler.Dir)
                {
                    assembler.AddBelt(this, true);
                }
            }
            assembler = Neighbors.GetSide(OutputDirection)?.GetComponent <FactoryAssembler>();
            if (assembler != null)
            {
                assembler.AddBelt(this, false);
            }
        }
Пример #3
0
 public CreativeOutputConnection(FactoryCreativeOutput creativeOutput)
 {
     _item = creativeOutput.Item;
 }