MrMcCommieJr

PartExtensions.cs

Jun 3rd, 2015
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.59 KB | None | 0 0
  1. using System.Collections.Generic;
  2. using UnityEngine;
  3.  
  4. namespace Mach.Extensions
  5. {
  6.     public static class PartExtensions
  7.     {
  8.         public static bool IsPrimary(this Part thisPart, List<Part> partsList, int moduleClassID)
  9.         {
  10.             foreach (Part part in partsList)
  11.             {
  12.                 if (part.Modules.Contains(moduleClassID))
  13.                 {
  14.                     if (part == thisPart)
  15.                         return true;
  16.                     else
  17.                         break;
  18.                 }
  19.             }
  20.  
  21.             return false;
  22.         }
  23.     }
  24. }
Add Comment
Please, Sign In to add comment