protected override void SolveInstance(IGH_DataAccess DA) { GH_Program ghProgram = null; double length = 0; int mechanicalGroup = 0; if (!DA.GetData(0, ref ghProgram)) { return; } if (!DA.GetData(1, ref length)) { return; } if (!DA.GetData(2, ref mechanicalGroup)) { return; } if (ghProgram.Value != program) { program = ghProgram.Value; trail = new SimpleTrail(program, length, mechanicalGroup); } if (trail != null) { trail.Length = length; trail.Update(); if (trail.Polyline.Count >= 2) { DA.SetData(0, new GH_Curve(trail.Polyline.ToNurbsCurve())); } } }
public override void OnSpawn() { _trail = new SimpleTrail(target: projectile, length: 16 * 6, width: (progress) => 18, color: (progress) => Color.Lerp(new Color(198, 61, 255), new Color(107, 61, 255), progress) * (1 - progress)); _trail.SetMaxPoints(15); _trail.SetEffectTexture(OrchidHelper.GetExtraTexture(4)); PrimitiveTrailSystem.NewTrail(_trail); projectile.friendly = false; this.IsGreen = false; }
public override void _Ready() { var size = GetViewportRect().Size; var attractor1 = new Attractor() { Position = new Vector2(size.x / 4, size.y / 2) }; AddChild(attractor1); var attractor2 = new Attractor() { Position = new Vector2(size.x / 2, size.y / 2) }; AddChild(attractor2); var attractor3 = new Attractor() { Position = new Vector2(size.x - (size.x / 4), size.y / 2) }; AddChild(attractor3); foreach (var _ in Enumerable.Range(0, 10)) { var mover = new SimpleMover(SimpleMover.WrapModeEnum.Bounce); var bodySize = (float)GD.RandRange(20, 40); var xPos = (float)GD.RandRange(bodySize, size.x - bodySize); var yPos = (float)GD.RandRange(bodySize, size.y - bodySize); mover.MeshSize = new Vector2(bodySize, bodySize); mover.Mass = bodySize; mover.Position = new Vector2(xPos, yPos); var trail = new SimpleTrail() { Target = mover }; AddChild(trail); AddChild(mover); } }