public override void Initialise(INamedDataProvider?initialisationData)
        {
            _damage.Value = initialisationData?.GetValue(PropertyNames.DamageSphereAmount) ?? 50000;
            _range.Value  = initialisationData?.GetValue(PropertyNames.DamageSphereRange) ?? (float)Math.Sqrt(_damage.Value);

            base.Initialise(initialisationData);
        }
Esempio n. 2
0
        /// <summary>
        /// Given a wall section and a stamp, convert it into a brush which will apply the stamp to the wall
        /// </summary>
        /// <param name="section"></param>
        /// <param name="stamp"></param>
        /// <param name="material"></param>
        /// <param name="geometry"></param>
        /// <param name="hierarchicalParameters"></param>
        /// <returns></returns>
        private static ICsgShape ConvertStampToBrush(Section section, Stamp stamp, string material, ICsgFactory geometry, INamedDataProvider hierarchicalParameters)
        {
            Contract.Requires(geometry != null);
            Contract.Requires(hierarchicalParameters != null);

            material = material ?? hierarchicalParameters.GetValue(new TypedName <string>("material"));

            //Establish basis vectors
            var vOut  = Vector2.Normalize(section.Normal);
            var vLeft = vOut.Perpendicular();

            //Calculate absolute thickness of stamp
            var thickness = (stamp.EndDepth - stamp.StartDepth) * section.Thickness;

            //Zero thickness stamp does nothing, early exit with null
            if (Math.Abs(thickness - 0) < 0.01f)
            {
                return(null);
            }

            //Create a transform matrix to place the brush into the plane of the facade
            var basis = Matrix4x4.Identity;

            basis = basis.Forward(vOut.X_Y(0));
            basis = basis.Left(vLeft.X_Y(0));
            basis = basis.Up(Vector3.UnitY);

            //Calculate transform from prism lying flat in plane to vertically aligned in plane of facade
            var transform = Matrix4x4.CreateTranslation(0, -(section.Thickness - thickness) / 2 + stamp.StartDepth * section.Thickness, 0) *
                            Matrix4x4.CreateRotationX(-MathHelper.PiOver2) *
                            basis;

            //create brush
            return(geometry.CreatePrism(material, stamp.Shape.Clockwise().ToArray(), Math.Abs(thickness)).Transform(transform));
        }
Esempio n. 3
0
            public override void Initialise(INamedDataProvider initialisationData)
            {
                base.Initialise(initialisationData);

                _output = initialisationData.GetValue(new TypedName<string>("output"), false);
            }
 public override void Initialise(INamedDataProvider?initialisationData)
 {
     _life.Value = initialisationData?.GetValue(PropertyNames.Lifetime) ?? _life.Value;
 }