Exemple #1
0
 public void AddCargoOnStartSlot(Entities.CargoEntity cargoEntity)
 {
     if (StartSlotFilled)
     {
         return;
     }
     cargoEntity.CargoTransform.position = startPointTransform.position;
     cargoEntity.CargoTransform.rotation = startPointTransform.rotation;
     cargosOnBelt.Add(cargoEntity);
     StartSlotFilled = true;
 }
 public bool InteractionPut(Entities.CargoEntity cargoEntity)
 {
     if (Physics.Raycast(transform.position + characterChestOffsetPosition, transform.forward, out var hitInfo, 1f, interactionLayer))
     {
         var conveyorInteractionTrigger = hitInfo.transform.GetComponent <IConveyorInteractionTrigger>();
         var direction = (transform.position - hitInfo.transform.position);
         direction.y = 0f;
         direction.Normalize();
         var dotProduct = Mathf.Abs(Vector3.Dot(hitInfo.transform.forward, direction));
         if (dotProduct > 0f && dotProduct < 0.6f)
         {
             var conveyorReceiver = conveyorInteractionTrigger.Conveyor;
             if (conveyorInteractionTrigger.CurrentConveyorType == ConveyorType.Receiver)
             {
                 if (!conveyorReceiver.ConveyorBelt.StartPointFilled && (conveyorReceiver.CurrentState == Conveyor.ConveyorState.Working || conveyorReceiver.CurrentState == Conveyor.ConveyorState.TimeRunsOut))
                 {
                     conveyorReceiver.ConveyorBelt.AddCargoOnStartPoint(cargoEntity);
                     return(true);
                 }
             }
         }
     }
     return(false);
 }