static BonusListOverlay() { g_bonusBoxEntry = new Curve(); g_bonusBoxEntry.Keys.Add(new CurveKey(0, 0)); g_bonusBoxEntry.Keys.Add(new CurveKey(0.3f, 1)); g_bonusBoxEntry.Keys.Add(new CurveKey(0.9f, 1)); g_bonusBoxEntry.Keys.Add(new CurveKey(2.0f, 1)); g_bonusBoxEntry.ComputeTangents(CurveTangent.Smooth); g_bonusBoxEntry.PostLoop = CurveLoopType.Constant; g_bonusBoxExit = new Curve(); g_bonusBoxExit.Keys.Add(new CurveKey(0, 1)); g_bonusBoxExit.Keys.Add(new CurveKey(0.4f, 0.2f)); g_bonusBoxExit.Keys.Add(new CurveKey(1.0f, 0)); g_bonusBoxExit.ComputeTangents(CurveTangent.Smooth); g_bonusBoxExit.PostLoop = CurveLoopType.Constant; g_bonusBoxAvoid = new Curve(); g_bonusBoxAvoid.Keys.Add(new CurveKey(0, 0)); g_bonusBoxAvoid.Keys.Add(new CurveKey(0.2f, 0.8f)); g_bonusBoxAvoid.Keys.Add(new CurveKey(0.5f, 1)); g_bonusBoxAvoid.Keys.Add(new CurveKey(1.0f, 1)); g_bonusBoxAvoid.ComputeTangents(CurveTangent.Smooth); g_bonusBoxAvoid.PostLoop = CurveLoopType.Constant; g_bonusBoxClose = new Curve(); g_bonusBoxClose.Keys.Add(new CurveKey(0, 1)); g_bonusBoxClose.Keys.Add(new CurveKey(0.4f, 0.8f)); g_bonusBoxClose.Keys.Add(new CurveKey(1.0f, 0)); g_bonusBoxClose.ComputeTangents(CurveTangent.Smooth); g_bonusBoxClose.PostLoop = CurveLoopType.Constant; }
static MovementCurve() { SLOW_FAST_SLOW_CURVE = new Curve(); SLOW_FAST_SLOW_CURVE.Keys.Add(new CurveKey(0, 0, 0, 0, CurveContinuity.Smooth)); SLOW_FAST_SLOW_CURVE.Keys.Add(new CurveKey(0.37f, 0.18f, 0.481587321f, 0.338412672f, CurveContinuity.Smooth)); SLOW_FAST_SLOW_CURVE.Keys.Add(new CurveKey(0.63f, 0.82f, 0.338412672f, 0.481587321f, CurveContinuity.Smooth)); SLOW_FAST_SLOW_CURVE.Keys.Add(new CurveKey(1, 1, 0, 0, CurveContinuity.Smooth)); SLOW_FAST_SLOW_CURVE.PreLoop = SLOW_FAST_SLOW_CURVE.PostLoop = CurveLoopType.Constant; SLOW_FAST_CURVE = new Curve(); SLOW_FAST_CURVE.Keys.Add(new CurveKey(0, 0, 0, 0, CurveContinuity.Smooth)); SLOW_FAST_CURVE.Keys.Add(new CurveKey(0.468407154f, 0.0652343f, 0.201716289f, 0.121062361f, CurveContinuity.Smooth)); SLOW_FAST_CURVE.Keys.Add(new CurveKey(0.749527067f, 0.322778642f, 0.494328052f, 0.440437645f, CurveContinuity.Smooth)); SLOW_FAST_CURVE.Keys.Add(new CurveKey(1, 1, 0.677221358f, 0, CurveContinuity.Smooth)); SLOW_FAST_CURVE.PreLoop = SLOW_FAST_CURVE.PostLoop = CurveLoopType.Constant; FAST_SLOW_CURVE = new Curve(); FAST_SLOW_CURVE.Keys.Add(new CurveKey(0, 0, 0, 0.677221358f, CurveContinuity.Smooth)); FAST_SLOW_CURVE.Keys.Add(new CurveKey(0.250472933f, 0.677221358f, 0.440437645f, 0.494328052f, CurveContinuity.Smooth)); FAST_SLOW_CURVE.Keys.Add(new CurveKey(0.531592867f, 0.9347657f, 0.121062361f, 0.201716289f, CurveContinuity.Smooth)); FAST_SLOW_CURVE.Keys.Add(new CurveKey(1, 1, 0, 0, CurveContinuity.Smooth)); FAST_SLOW_CURVE.PreLoop = FAST_SLOW_CURVE.PostLoop = CurveLoopType.Constant; LINEAR_CURVE = new Curve(); LINEAR_CURVE.Keys.Add(new CurveKey(0, 0)); LINEAR_CURVE.Keys.Add(new CurveKey(1, 1)); LINEAR_CURVE.ComputeTangents(CurveTangent.Linear); LINEAR_CURVE.PreLoop = LINEAR_CURVE.PostLoop = CurveLoopType.Constant; ALMOST_LINEAR_CURVE = new Curve(); ALMOST_LINEAR_CURVE.Keys.Add(new CurveKey(0, 0, 0, 0.25f, CurveContinuity.Smooth)); ALMOST_LINEAR_CURVE.Keys.Add(new CurveKey(1, 1, 0.25f, 0, CurveContinuity.Smooth)); ALMOST_LINEAR_CURVE.PreLoop = LINEAR_CURVE.PostLoop = CurveLoopType.Constant; }
static Player() { g_shakeCurve = new Curve(); g_shakeCurve.PreLoop = CurveLoopType.Constant; g_shakeCurve.PostLoop = CurveLoopType.Constant; g_shakeCurve.Keys.Add(new CurveKey(0, 0)); g_shakeCurve.Keys.Add(new CurveKey(0.15f, 0.0f * MathHelper.PiOver4)); g_shakeCurve.Keys.Add(new CurveKey(0.3f, 0.4f * MathHelper.PiOver4)); g_shakeCurve.Keys.Add(new CurveKey(0.6f, 0.6f * MathHelper.PiOver4)); g_shakeCurve.Keys.Add(new CurveKey(1, MathHelper.PiOver4)); g_shakeCurve.ComputeTangents(CurveTangent.Linear); g_shakeAttenuationCurve = new Curve(); g_shakeAttenuationCurve.PreLoop = CurveLoopType.Constant; g_shakeAttenuationCurve.PostLoop = CurveLoopType.Linear; g_shakeAttenuationCurve.Keys.Add(new CurveKey(0, 0)); g_shakeAttenuationCurve.Keys.Add(new CurveKey(0.05f, 0.01f)); g_shakeAttenuationCurve.Keys.Add(new CurveKey(1.0f, 1)); g_shakeAttenuationCurve.ComputeTangents(CurveTangent.Linear); g_shakeAttenuationInverseCurve = new Curve(); g_shakeAttenuationInverseCurve.PreLoop = CurveLoopType.Constant; g_shakeAttenuationInverseCurve.PostLoop = CurveLoopType.Linear; foreach (var key in g_shakeAttenuationCurve.Keys) g_shakeAttenuationInverseCurve.Keys.Add(new CurveKey(key.Value, key.Position)); g_shakeAttenuationInverseCurve.ComputeTangents(CurveTangent.Linear); }
public void ComputeTangent() { var key1 = new CurveKey(-0.5f, 1.5f); var key2 = new CurveKey(1.1f, 2.3f); var key3 = new CurveKey(2.25f, 4.4f); var curve1 = new Curve(); curve1.Keys.Add(key1); curve1.Keys.Add(key2); curve1.Keys.Add(key3); curve1.ComputeTangent(0, CurveTangent.Smooth); curve1.ComputeTangent(1, CurveTangent.Smooth); curve1.ComputeTangent(2, CurveTangent.Smooth); Assert.AreEqual(0.0f, curve1.Keys[0].TangentIn); Assert.AreEqual(0.799999952f, curve1.Keys[0].TangentOut); Assert.AreEqual(1.68727279f, curve1.Keys[1].TangentIn); Assert.AreEqual(1.21272731f, curve1.Keys[1].TangentOut); Assert.AreEqual(2.10000014f, curve1.Keys[2].TangentIn); Assert.AreEqual(0.0f, curve1.Keys[2].TangentOut); var curve2 = new Curve(); curve2.Keys.Add(key1); curve2.Keys.Add(key2); curve2.Keys.Add(key3); curve2.ComputeTangent(0, CurveTangent.Flat); curve2.ComputeTangent(1, CurveTangent.Flat); curve2.ComputeTangent(2, CurveTangent.Flat); Assert.AreEqual(0.0f, curve2.Keys[0].TangentIn); Assert.AreEqual(0.0f, curve2.Keys[0].TangentOut); Assert.AreEqual(0.0f, curve2.Keys[1].TangentIn); Assert.AreEqual(0.0f, curve2.Keys[1].TangentOut); Assert.AreEqual(0.0f, curve2.Keys[2].TangentIn); Assert.AreEqual(0.0f, curve2.Keys[2].TangentOut); var curve3 = new Curve(); curve3.Keys.Add(key1); curve3.Keys.Add(key2); curve3.Keys.Add(key3); curve3.ComputeTangent(0, CurveTangent.Linear); curve3.ComputeTangent(1, CurveTangent.Linear); curve3.ComputeTangent(2, CurveTangent.Linear); Assert.AreEqual(0.0f, curve3.Keys[0].TangentIn); Assert.AreEqual(0.799999952f, curve3.Keys[0].TangentOut); Assert.AreEqual(0.799999952f, curve3.Keys[1].TangentIn); Assert.AreEqual(2.10000014f, curve3.Keys[1].TangentOut); Assert.AreEqual(2.10000014f, curve3.Keys[2].TangentIn); Assert.AreEqual(0.0f, curve3.Keys[2].TangentOut); }
private void Init() { timer.Interval = 10; map = new Map(pic.Width, pic.Height, 1000, 20, TypeCellDistribution.Hexagon); g = pic.CreateGraphics(); //--- float distanceMax = 100; curveDistance = new Curve(); //---> Donut //curveDistance.Keys.Add(new CurveKey(0 * distanceMax, 0.25f)); //curveDistance.Keys.Add(new CurveKey(0.5f * distanceMax, 0.25f)); //curveDistance.Keys.Add(new CurveKey(0.75f * distanceMax, 0.7f)); //curveDistance.Keys.Add(new CurveKey(1f * distanceMax, 0f)); curveDistance.Keys.Add(new CurveKey(0 * distanceMax, 1f)); curveDistance.Keys.Add(new CurveKey(1f * distanceMax, 0f)); //--- //--- timeMax = 500f; curveTime = new Curve(); curveTime.Keys.Add(new CurveKey(0 * timeMax, 0.05f)); curveTime.Keys.Add(new CurveKey(0.7f * timeMax, 1f)); curveTime.Keys.Add(new CurveKey(1f * timeMax, 0f)); //--- }
public static Func<float, float> FromCurve(Curve c) { return (f) => { return c.Evaluate(f); }; }
/// <summary> /// Constructor /// </summary> public AbstractForceController() : base(ControllerType.AbstractForceController) { Enabled = true; Strength = 1.0f; Position = new Vector2(0, 0); MaximumSpeed = 100.0f; TimingMode = TimingModes.Switched; ImpulseTime = 0.0f; ImpulseLength = 1.0f; Triggered = false; StrengthCurve = new Curve(); Variation = 0.0f; Randomize = new System.Random(1234); DecayMode = DecayModes.None; DecayCurve = new Curve(); DecayStart = 0.0f; DecayEnd = 0.0f; StrengthCurve.Keys.Add(new CurveKey(0, 5)); StrengthCurve.Keys.Add(new CurveKey(0.1f, 5)); StrengthCurve.Keys.Add(new CurveKey(0.2f, -4)); StrengthCurve.Keys.Add(new CurveKey(1f, 0)); }
public PlayerChat(AssaultWing game, int updateOrder) : base(game, updateOrder) { g_cursorBlinkCurve = new Curve(); g_cursorBlinkCurve.Keys.Add(new CurveKey(0, 1)); g_cursorBlinkCurve.Keys.Add(new CurveKey(0.5f, 0)); g_cursorBlinkCurve.Keys.Add(new CurveKey(1, 1)); g_cursorBlinkCurve.PreLoop = CurveLoopType.Cycle; g_cursorBlinkCurve.PostLoop = CurveLoopType.Cycle; g_scrollArrowBlinkCurve = new Curve(); g_scrollArrowBlinkCurve.Keys.Add(new CurveKey(0, 1)); g_scrollArrowBlinkCurve.Keys.Add(new CurveKey(0.75f, 0)); g_scrollArrowBlinkCurve.Keys.Add(new CurveKey(1.5f, 1)); g_scrollArrowBlinkCurve.PreLoop = CurveLoopType.Cycle; g_scrollArrowBlinkCurve.PostLoop = CurveLoopType.Cycle; _game = game; _chatSendControl = new KeyboardKey(Keys.Enter); _escapeControl = new KeyboardKey(Keys.Escape); _scrollUpControl = new KeyboardKey(Keys.Up); _scrollDownControl = new KeyboardKey(Keys.Down); _cursorBlinkStartTime = _game.GameTime.TotalRealTime; _scrollArrowGlowStartTime = _game.GameTime.TotalRealTime; _messageBeeper = new MessageBeeper(game, "PlayerMessage", () => Messages.FirstOrDefault()); }
public Curve Clone() { Curve curve = new Curve(Keys.Clone()); curve.PreLoop = PreLoop; curve.PostLoop = PostLoop; return curve; }
/// <summary> /// Adds the curve to the TreeView and also the CurveEditorControl. /// </summary> internal void AddCurve(string name, Curve curve) { // Check if the curve is already added. var container = FindContainerLeaf(Root, curve); if (container != null) { container.IsSelected = true; container.IsVisible = true; return; } // Add to tree var path = name.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries); var node = Root; for (var i = 0; i < path.Length - 1; i++) { CurveTreeNode child; if ((child = GetChildNode(node, path[i])) == null) { child = new CurveTreeNode(path[i], node); node.Children.Add(child); } node = child; } // Add to control var curveName = path[path.Length - 1]; var wrapper = new CurveWrapper(curve, curveName, Control, GetColor(curveName)); Control.Curves.Add(wrapper); // Add to tree node.Children.Add(new CurveTreeLeaf(node, wrapper)); //for (int i = 0; i < 20; i++) //{ // wrapper.AddKey(new CurveKey((float)random.NextDouble(), (float)random.NextDouble())); //} }
//Crete a movable object public MovableObject(Vector2 StartPos) { positionCurrent = StartPos; curveX = new Curve(); curveY = new Curve(); }
public void EvaluateNoKeys() { var curve = new Curve(); var result = curve.Evaluate(1.25f); Assert.AreEqual(0f, result); }
//See CurveLoopType - https://msdn.microsoft.com/en-us/library/microsoft.xna.framework.curvelooptype.aspx public Curve1D(CurveLoopType curveLookType) { this.curveLookType = curveLookType; this.curve = new Curve(); this.curve.PreLoop = curveLookType; this.curve.PostLoop = curveLookType; }
protected override void ProcessCurve(Curve curve, float duration, float deltaTime, Particle[] particles, int begin, int end) { for (int i = begin; i < end; ++i) { float t = NormalizeCurveTime ? particles[i].m_age / particles[i].m_life * duration : particles[i].m_age; particles[i].m_rotation = CurveObject.Evaluate(t) * CurveScale + CurveBias; } }
static CombatLogOverlay() { g_messageFadeoutCurve = new Curve(); g_messageFadeoutCurve.Keys.Add(new CurveKey(0, 1)); g_messageFadeoutCurve.Keys.Add(new CurveKey(3.5f, 1)); g_messageFadeoutCurve.Keys.Add(new CurveKey(5.2f, 0)); g_messageFadeoutCurve.ComputeTangents(CurveTangent.Linear); }
static ChatTab() { g_cursorBlinkCurve = new Curve(); g_cursorBlinkCurve.Keys.Add(new CurveKey(0, 1)); g_cursorBlinkCurve.Keys.Add(new CurveKey(0.5f, 0)); g_cursorBlinkCurve.Keys.Add(new CurveKey(1, 1)); g_cursorBlinkCurve.PreLoop = CurveLoopType.Cycle; g_cursorBlinkCurve.PostLoop = CurveLoopType.Cycle; }
void editButton_Click(object sender, RoutedEventArgs e) { var curve = TreeNode.Property as Curve; if (curve == null) { curve = new Curve(); } GearsetResources.Console.AddCurve(TreeNode.Name, curve); GearsetResources.Console.Bender.Window.Show(); GearsetResources.Console.Bender.Window.Focus(); }
public void EvaluateOneKey() { var curve = new Curve(); curve.Keys.Add(new CurveKey(1, -1)); var result = curve.Evaluate(1.25f); Assert.AreEqual(-1f, result); }
private static MemoryStream Serialize(Curve curve) { var stream = new MemoryStream(); var writer = XmlWriter.Create(stream, new XmlWriterSettings { Indent = true }); Serialization.SerializeXml(writer, "curve", curve, null); writer.Close(); stream.Seek(0, SeekOrigin.Begin); return stream; }
static EquipTab() { g_nameInfoMove = new Curve(); g_nameInfoMove.Keys.Add(new CurveKey(0f, 0)); g_nameInfoMove.Keys.Add(new CurveKey(0.6f, 15)); g_nameInfoMove.Keys.Add(new CurveKey(1.2f, 0)); g_nameInfoMove.PreLoop = CurveLoopType.Cycle; g_nameInfoMove.PostLoop = CurveLoopType.Cycle; }
public override void Startup() { var font = new Graphics.TextRenderer.FontDescriptor("Constantia", 20, System.Drawing.FontStyle.Bold); FormatOptions = new Graphics.TextRenderer.FormatOptions(font) { Alignment = Graphics.TextRenderer.Alignment.CenterMiddle }; var drawOptions = Graphics.TextRenderer.DrawOptions.Default; drawOptions.ColorScaling = Vector4.One; DrawOptions = drawOptions; MoveCurve = GameApp.Service<Services.ResourceManager>().Acquire<Curve>("Curves/DamageIndicatorFloat"); FadeCurve = GameApp.Service<Services.ResourceManager>().Acquire<Curve>("Curves/DamageIndicatorFade"); }
/// <summary> /// Only for serialization. /// </summary> public RadialFlow() { _flowSpeed = new Curve(); _flowSpeed.PreLoop = CurveLoopType.Constant; _flowSpeed.PostLoop = CurveLoopType.Constant; _flowSpeed.Keys.Add(new CurveKey(0, 6000, 0, 0, CurveContinuity.Smooth)); _flowSpeed.Keys.Add(new CurveKey(300, 0, -1.5f, -1.5f, CurveContinuity.Smooth)); _flowTime = 0.5f; _dragMagnitude = 0.003f; }
public Curve Clone() { Curve curve = new Curve(); curve.keys = this.keys.Clone(); curve.preLoop = this.preLoop; curve.postLoop = this.postLoop; return curve; }
/// <summary> /// Builds an XNA curve object from the control points. /// </summary> /// <returns></returns> private Curve BuildXNACurve() { Curve curve = new Curve(); for(int i = 0; i < this._keys.Count; i++) { curve.Keys.Add(this._keys[i]); } return curve; }
public void Evaluate() { var curve = new Curve(); curve.Keys.Add(new CurveKey(1, -1)); curve.Keys.Add(new CurveKey(2, 2)); curve.Keys.Add(new CurveKey(3, 4)); var result = curve.Evaluate(1.25f); Assert.AreEqual(-0.53125f, result); }
public EditCurve(string name, System.Drawing.Color curveColor, CommandHistory commandHistory) { originalCurve = new Curve(); this.color = curveColor; keys = new EditCurveKeyCollection(this); state.Name = name; state.PreLoop = OriginalCurve.PreLoop; state.PostLoop = OriginalCurve.PostLoop; this.commandHistory = commandHistory; }
public void TestSetup() { curve1 = new Curve(); curve2 = new Curve(); curve2.PostLoop = CurveLoopType.CycleOffset; curve2.PreLoop = CurveLoopType.Oscillate; curve2.Keys.Add(new CurveKey(1.5f, 2.5f, 3.0f, -0.3333f, CurveContinuity.Smooth)); curve2.Keys.Add(new CurveKey(5.5f, 2.5f, 3.0f, -1.3333f, CurveContinuity.Step)); curve2.Keys.Add(new CurveKey(9.5f, 2.5f, 6.0f, -0.9333f, CurveContinuity.Smooth)); curve2.Keys.Add(new CurveKey(17.5f, 4.5f, 3.0f, -0.13f, CurveContinuity.Step)); }
/// <summary> /// This constructor is only for serialisation. /// </summary> public Explosion() { _inflictDamage = new Curve(); _inflictDamage.PreLoop = CurveLoopType.Constant; _inflictDamage.PostLoop = CurveLoopType.Constant; _inflictDamage.Keys.Add(new CurveKey(0, 200, 0, 0, CurveContinuity.Smooth)); _inflictDamage.Keys.Add(new CurveKey(300, 0, -3, -3, CurveContinuity.Smooth)); _radialFlow = new RadialFlow(); _impactHoleRadius = 100; _particleEngineNames = new[] { (CanonicalString)"dummypeng" }; _sound = "Explosion"; }
static MenuEngineImpl() { g_cursorFade = new Curve(); g_cursorFade.Keys.Add(new CurveKey(0, 1, 0, 0, CurveContinuity.Step)); g_cursorFade.Keys.Add(new CurveKey(0.5f, 0, 0, 0, CurveContinuity.Step)); g_cursorFade.Keys.Add(new CurveKey(1, 1, 0, 0, CurveContinuity.Step)); g_cursorFade.PreLoop = CurveLoopType.Cycle; g_cursorFade.PostLoop = CurveLoopType.Cycle; g_loggedInPilot = new Curve(); g_loggedInPilot.Keys.Add(new CurveKey(0, 0, 0, 0, CurveContinuity.Smooth)); g_loggedInPilot.Keys.Add(new CurveKey(1.7f, 1, 0, 0, CurveContinuity.Smooth)); }
private Vector2 _pos; // position of the component's background texture in menu system coordinates #endregion Fields #region Constructors public ArenaMenuComponent(MenuEngineImpl menuEngine) : base(menuEngine) { _pos = new Vector2(1220, 698); _cursorFade = new Curve(); _cursorFade.Keys.Add(new CurveKey(0, 1, 0, 0, CurveContinuity.Step)); _cursorFade.Keys.Add(new CurveKey(0.5f, 0, 0, 0, CurveContinuity.Step)); _cursorFade.Keys.Add(new CurveKey(1, 1, 0, 0, CurveContinuity.Step)); _cursorFade.PreLoop = CurveLoopType.Cycle; _cursorFade.PostLoop = CurveLoopType.Cycle; _currentArena = new ScrollableList(MENU_ITEM_COUNT, () => ArenaInfos.Length); InitializeControlCallbacks(); }