예제 #1
0
        public bool CanTransferTo(PackedVessel vsl, HangarPassage other, PassageNode requesting_node = null)
        {
            if (!enabled)
            {
                return(false);
            }
            if (this == other)
            {
                return(CanHold(vsl));
            }
            var  this_node    = requesting_node?.OtherNode;
            bool can_transfer = false;

            foreach (var pn in Nodes.Values)
            {
                if (pn == this_node)
                {
                    continue;
                }
                var other_passage = pn.CanPassThrough(vsl);
                if (other_passage != null)
                {
                    can_transfer = other_passage.CanTransferTo(vsl, other, pn);
                }
                if (can_transfer)
                {
                    break;
                }
            }
            return(can_transfer);
        }
예제 #2
0
 public override void OnStart(StartState state)
 {
     base.OnStart(state);
     entrance = part.GetPassage();
     if (entrance == null)
     {
         return;
     }
     passage_checklist = part.AllModulesOfType <HangarPassage>();
     StartCoroutine(delayed_update_state());
 }
예제 #3
0
 void get_part_components()
 {
     passage = part.Modules.GetModule <HangarPassage>();
     try
     {
         //get transforms and meshes
         Transform bodyT = part.FindModelTransform(BodyName);
         if (bodyT == null)
         {
             this.Log("'{}' transform does not exists in the {1}",
                      BodyName, part.name);
         }
         Transform colliderT = part.FindModelTransform(ColliderName);
         if (colliderT == null)
         {
             this.Log("'{}' transform does not exists in the {1}",
                      ColliderName, part.name);
         }
         //The mesh method unshares any shared meshes
         MeshFilter body_mesh_filter = bodyT.GetComponent <MeshFilter>();
         if (body_mesh_filter == null)
         {
             this.Log("'{}' does not have MeshFilter component", BodyName);
         }
         body_mesh     = body_mesh_filter.mesh;
         body_collider = colliderT.GetComponent <MeshCollider>();
         if (body_collider == null)
         {
             this.Log("'{}' does not have MeshCollider component", ColliderName);
         }
     }
     catch (Exception ex)
     {
         Debug.LogException(ex);
         isEnabled = enabled = false;
     }
 }
예제 #4
0
 protected override void early_setup(StartState state)
 {
     base.early_setup(state);
     entrance = part.GetPassage();
 }