コード例 #1
0
ファイル: HangarGateway.cs プロジェクト: pjslauta/hangar
 protected override void early_setup(StartState state)
 {
     base.early_setup(state);
     entrance = part.GetPassage();
     //get docking space
     if(DockingSpace != string.Empty)
         docking_space = part.FindModelComponent<MeshFilter>(DockingSpace);
     //get spawn transform
     if(SpawnTransform != string.Empty)
         spawn_transform = part.FindModelTransform(SpawnTransform);
     if(spawn_transform == null) spawn_transform = part.transform;
     //add check transform
     var launch_empty = new GameObject();
     launch_empty.transform.SetParent(spawn_transform);
     check_transform = launch_empty.transform;
 }
コード例 #2
0
 public override void OnStart(StartState state)
 {
     base.OnStart(state);
     entrance = part.GetPassage();
     if(entrance == null) return;
     passage_checklist = part.AllModulesOfType<HangarPassage>();
     resource = this.GetResourceDef(OutputResource);
     if(resource == null) return;
     pump = new ResourcePump(part, resource.id);
     StartCoroutine(delayed_update_state());
 }
コード例 #3
0
ファイル: ProceduralAdapter.cs プロジェクト: pjslauta/hangar
 void get_part_components()
 {
     passage = part.GetModule<HangarPassage>();
     try
     {
         //get transforms and meshes
         Transform bodyT = part.FindModelTransform(BodyName);
         if(bodyT == null)
             this.Log("'{0}' transform does not exists in the {1}",
                 BodyName, part.name);
         Transform colliderT = part.FindModelTransform(ColliderName);
         if(colliderT == null)
             this.Log("'{0}' 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("'{0}' does not have MeshFilter component", BodyName);
         body_mesh = body_mesh_filter.mesh;
         body_collider = colliderT.GetComponent<MeshCollider>();
         if(body_collider == null)
             this.Log("'{0}' does not have MeshCollider component", ColliderName);
     }
     catch(Exception ex)
     {
         Debug.LogException(ex);
         isEnabled = enabled = false;
     }
 }