Esempio n. 1
0
            /// <summary>
            /// Gets the MechBodyPart of the given MechBodyPartType (Returns null if the given Character does not have that body type)
            /// </summary>
            /// <param name="character"></param>
            /// <param name="type"></param>
            /// <returns></returns>
            public static MechBodyPart GetBodyPartOfType(Character character, MechBodyPartType type)
            {
                List <MechBodyPart> bodyParts = character.GetAllBodyParts();

                for (int i = 0; i < bodyParts.Count; i++)
                {
                    if (bodyParts[i].PartType == type)
                    {
                        return(bodyParts[i]);
                    }
                }

                return(null);
            }
Esempio n. 2
0
        /// <summary>
        /// Gets all <see cref="BaseBodyPart"/>s of the given <see cref="MechBodyPartType"/>
        /// </summary>
        /// <param name="character"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public static List <BaseBodyPart> GetBaseBodyParts(this Character character, MechBodyPartType type)
        {
            List <BaseBodyPart> bodyParts = new List <BaseBodyPart>();

            for (int i = 0; i < character.GetAllBaseBodyParts().Count; i++)
            {
                if (character.GetAllBaseBodyParts()[i].PartType == type)
                {
                    bodyParts.Add(character.GetAllBaseBodyParts()[i]);
                }
            }

            return(bodyParts);
        }
Esempio n. 3
0
        /// <summary>
        /// Gets all <see cref="MechBodyPart"/>s of the given <see cref="MechBodyPartType"/>
        /// </summary>
        /// <param name="character"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public static List <MechBodyPart> GetBodyParts(this Character character, MechBodyPartType type)
        {
            List <BaseBodyPart> baseBodyParts = character.GetBaseBodyParts(type);
            List <MechBodyPart> mechBodyParts = new List <MechBodyPart>();

            foreach (BaseBodyPart baseBodyPart in baseBodyParts)
            {
                if (baseBodyPart is MechBodyPart mechBodyPart)
                {
                    mechBodyParts.Add(mechBodyPart);
                }
            }

            return(mechBodyParts);
        }
Esempio n. 4
0
 /// <summary>
 /// Gets the first found <see cref="MindSpaceBodyPart"/> of the given <see cref="MechBodyPartType"/> (Returns <see langword="null"/> if the given <see cref="Character"/> does not have the specified <see cref="MechBodyPartType"/>)
 /// </summary>
 /// <param name="character"></param>
 /// <param name="type"></param>
 /// <returns></returns>
 public static MindSpaceBodyPart GetMindSpaceBodyPart(this Character character, MechBodyPartType type)
 {
     return(character.GetBaseBodyPart(type) as MindSpaceBodyPart);
 }