protected override void ThrowIfComponentIsNotValidForThisVehicleType(Component i_Component)
        {
            eComponentType typeToAdd = i_Component.Type;

            if (typeToAdd != eComponentType.ColorComponent && typeToAdd != eComponentType.DoorsComponent)
            {
                throw new ArgumentException("You can only add color or doors to a car");
            }
        }
Exemple #2
0
        protected override void ThrowIfComponentIsNotValidForThisVehicleType(Component i_Component)
        {
            eComponentType typeToAdd = i_Component.Type;

            if (typeToAdd != eComponentType.WeightComponent && typeToAdd != eComponentType.HazardousComponent)
            {
                throw new ArgumentException("You can only add weight and hazardous components to a truck.");
            }
        }
        protected override void ThrowIfComponentIsNotValidForThisVehicleType(Component i_Component)
        {
            eComponentType typeToAdd = i_Component.Type;

            if (typeToAdd != eComponentType.LicenceComponent && typeToAdd != eComponentType.CapacityComponent)
            {
                throw new ArgumentException("You can only add licence and engine capacity components to a motorcycle.");
            }
        }
Exemple #4
0
        private void throwIfComponentAlreadyExists(Component i_Component)
        {
            eComponentType typeToAdd = i_Component.Type;

            foreach (Component component in m_Components)
            {
                if (component.Type.Equals(typeToAdd))
                {
                    throw new ArgumentException("This component type already exists in this vehicle.");
                }
            }
        }
        public static DirectionalComponent GetComponentInDirection(this Frame frame, eComponentType componentType, eDirection direction)
        {
            switch (componentType)
              {
            case eComponentType.Light:
              return frame.LightSection.GetComponentSectionInDirection(direction);

            case eComponentType.Fan:
              return frame.FanSection.GetComponentSectionInDirection(direction);

            case eComponentType.Rumble:
              return frame.RumbleSection.GetComponentSectionInDirection(direction);

            default:
              throw new ArgumentException("Unexpected Component Type");
              }
        }
 public DirectionalComponent(eComponentType componentType)
 {
     ComponentType = componentType;
 }
 public DirectionalComponent(eComponentType componentType, eDirection direction)
     : this(componentType)
 {
     Direction = direction;
 }
 public bool AreEnabledForComponent(eComponentType componentType)
 {
     return EnabledDirectionalComponents
     .Any(c => HasComponentType(c, componentType));
 }