public override void Draw() { if (effectTimer.IsDone) { return; } float f = 1 - TKMath.Exp(effectTimer.PercentageDone, 5); for (int i = 0; i < 4; i++) { spikeMesh.Reset(); spikeMesh.Translate(position); spikeMesh.RotateZ(rotation + 90 * i); spikeMesh.Scale(1 + 1 * f, 1 - f); spikeMesh.Translate(f * 2, 0); spikeMesh.Draw(); } lineMesh.Reset(); lineMesh.Translate(position); lineMesh.RotateZ(lineRotation); lineMesh.Scale(1 - f, 1 + 1.3f * f); lineMesh.Scale(4f); lineMesh.Draw(); }
public override void Draw() { if (ringTimer.IsDone) { return; } float r = 1 - TKMath.Exp(ringTimer.PercentageDone, 8), r2 = 1 - TKMath.Exp(ringTimer.PercentageDone, 6); GL.Enable(EnableCap.StencilTest); //MASK GL.StencilMask(0xFF); GL.Clear(ClearBufferMask.StencilBufferBit); GL.StencilFunc(StencilFunction.Never, 1, 0xFF); GL.StencilOp(StencilOp.Replace, StencilOp.Replace, StencilOp.Replace); sprite.Draw(position, r2 * diameter, 0f); //RING GL.StencilMask(0x00); GL.StencilFunc(StencilFunction.Notequal, 1, 0xFF); sprite.Draw(position, r * diameter, 0f); GL.Disable(EnableCap.StencilTest); }
public virtual void Draw() { if (pressEffectTimer.IsDone) { buttonMesh.Color = Color; } else { buttonMesh.Color = Color.Blend(Color, Color.White, TKMath.Exp(pressEffectTimer.PercentageDone, 6f)); } buttonMesh.Reset(); buttonMesh.Translate(Position); buttonMesh.Scale(size); if (!hoveredEffectTimer.IsDone) { buttonMesh.RotateZ(10f * TKMath.Exp(hoveredEffectTimer.PercentageDone, 6f)); } buttonMesh.Draw(); Mesh m = textBox.Mesh; m.Reset(); m.Translate(Position); if (!hoveredEffectTimer.IsDone) { m.RotateZ(10f * TKMath.Exp(hoveredEffectTimer.PercentageDone, 6f)); } m.Draw(); }
public override void Draw() { if (effectTimer.IsDone) { return; } color.A = 1 - effectTimer.PercentageDone; skullSprite.Color = color; spikeMesh.Color = color; float f = TKMath.Exp(effectTimer.PercentageDone); for (int i = 0; i < 4; i++) { spikeMesh.Reset(); spikeMesh.Translate(position); spikeMesh.RotateZ(rotation + 90 * i); spikeMesh.Scale(1 + 2 * f, 2 - 2 * f); spikeMesh.Translate(f * 2, 0); spikeMesh.Draw(); } float pos = TKMath.Exp(effectTimer.PercentageDone) * 3f, rot = 20 * effectTimer.PercentageDone; skullSprite.Draw(position + new Vector2(0, pos), 3f, rotation + rot); }
public virtual void Draw() { menuMesh.Color = new TKTools.Color(0, 0, 0, 0.7f * (1f - TKMath.Exp(alphaTimer.PercentageDone, 5f))); menuMesh.Reset(); menuMesh.Scale(10f * Game.AspectRatio - 1f, 9f); menuMesh.Draw(); foreach (Button b in buttonList) { b.Draw(); } }
public void DashStep() { dashTarget.timeTraveled += Game.delta; Vector2 direction = dashTarget.Direction; float speedFactor = TKMath.Exp(Math.Max(0, 0.4f - dashTarget.timeTraveled * 10), 2f, 20); Vector2 stepSize = direction * speedFactor * stats.DashVelocity * Game.delta; if (stepSize.Length > (dashTarget.endPosition - Position).Length) { DashEnd(); return; } Vector2 stepTarget = Position + stepSize; //Check for players List <Actor> actorCol = Map.RayTraceActor <Actor>(Position, stepTarget, Size * 1.8f, this); if (actorCol.Count > 0) { foreach (Actor a in actorCol) { if (a is Player) { Player p = a as Player; if (p.IsDashing) { DashEnd((Player)actorCol[0]); ((Player)actorCol[0]).DashEnd(this); SendDashCollisionToPlayer((Player)actorCol[0], Map.playerList); return; } else if (!p.IsDodging && !AlliedWith(p)) { a.Hit(p.MaxHealth, TKMath.GetAngle(direction), this); } } else { a.Hit(a.MaxHealth, TKMath.GetAngle(direction), this); } } } Position += stepSize; }
public void DodgeStep() { dodgeTarget.timeTraveled += Game.delta; Vector2 dir = dodgeTarget.DirectionVector; float speedFactor = TKMath.Exp(Math.Max(0, 0.4f - dodgeTarget.timeTraveled * 5), 2f, 30); Vector2 step = dir * stats.DodgeVelocity * speedFactor * Game.delta; //Stepping if ((dodgeTarget.direction == Direction.Right || dodgeTarget.direction == Direction.Left) && Map.GetCollision(this, step)) { float stepSizeFactor = stats.StepSize * step.Length; if (!Map.GetCollision(this, step + new Vector2(0, stepSizeFactor))) { int accuracy = 16; float currentStep = 0; float testStepSize = stepSizeFactor / accuracy; for (int i = 0; i < accuracy; i++) { if (Map.GetCollision(this, step + new Vector2(0, currentStep))) { currentStep += testStepSize; } else { break; } } step.Y += currentStep; } } Vector2 collisionPosition; bool collision = Map.RayTraceCollision(Position, Position + step, Size, out collisionPosition, this); step = collisionPosition - Position; dodgeTarget.stepLength = speedFactor; dodgeTarget.stepAngle = TKMath.GetAngle(step); Position = collisionPosition; if (dodgeTarget.TargetReached(Position) || collision) { DodgeEnd(); } }
public override void Draw() { mesh.Reset(); Vector2 lenVector = target - origin; float w = TKMath.Exp(effectTimer.PercentageDone, 5); mesh.Translate(origin); mesh.RotateZ(TKMath.GetAngle(lenVector)); mesh.Scale(new Vector2(lenVector.Length, w)); mesh.Draw(); }
public override void Draw() { float f = TKMath.Exp(effectTimer.PercentageDone); for (int i = 0; i < 4; i++) { spikeMesh.Reset(); spikeMesh.Translate(position); spikeMesh.RotateZ(rotation + 90f * i); spikeMesh.Translate(-0.3f + 2 * f * size, 0); spikeMesh.Scale(size); spikeMesh.Scale(1.2f - f * 0.7f, 1f - f); spikeMesh.Draw(); } }
public override void Draw() { float f = 1f - TKMath.Exp(effectTimer.PercentageDone, 8f); scrapSprite.Color = Color.Blend(Color, Color.White, 0.6f) * new Color(1f, 1f, 1f, 1f - effectTimer.PercentageDone); scrapSprite.Draw(position + new Vector2(-0.1f, 1f * f), Size * 0.8f, scrapRotation); Mesh m = amountBox.Mesh; m.Color = Color * new Color(1f, 1f, 1f, 1f - effectTimer.PercentageDone); m.Reset(); m.Translate(position); m.Translate(0f, 0.1f + 1f * f); m.Scale(Size); m.Draw(); }
public override void Logic() { if (effectTimer.IsDone) { Remove(); } float w = TKMath.Exp(effectTimer.PercentageDone, 5); mesh.Reset(); mesh.Translate(a); mesh.RotateZ(TKMath.GetAngle(a, b)); mesh.Scale((b - a).Length, w); effectTimer.Logic(); base.Logic(); }
public override void Logic() { if (effectTimer.IsDone) { Remove(); } effectTimer.Logic(); float w = TKMath.Exp(effectTimer.PercentageDone, 5); mesh.Vertices2 = new Vector2[] { new Vector2(-0.5f, -0.5f * startWidth * w), new Vector2(-0.5f, 0.5f * startWidth * w), new Vector2(0.5f, -0.5f * endWidth * w), new Vector2(0.5f, 0.5f * endWidth * w) }; }
public void DashStep() { dashTarget.timeTraveled += Game.delta; Vector2 direction = (dashTarget.endPosition - position).Normalized(); float speedFactor = TKMath.Exp(Math.Max(0, 0.4f - dashTarget.timeTraveled * 10), 2f, 20); Vector2 stepSize = direction * speedFactor * stats.DashVelocity * Game.delta; if (stepSize.Length > (dashTarget.endPosition - position).Length) { DashEnd(); return; } Vector2 stepTarget = position + stepSize; position = stepTarget; dashTarget.lastStep = speedFactor; }
public void Draw() { if (!player.DodgeCooldown.IsDone) { dodgeBar.Draw(player.Position, player.Color); } if (!player.DashCooldown.IsDone) { dashBar.Draw(player.Position, player.Color); } #region Health healthBar.Draw(player.Position, new Color(1f, 0f, 0f, healthAlpha)); #endregion #region Ammo if (player.Weapon != null) { int maxAmmo = player.MaxAmmo; float dir = 90f / (maxAmmo - 1); if (ammoAlpha > 0f && player.Weapon.ReloadProgress == -1) { ammoMesh.Color = new Color(1f, 1f, 1f, ammoAlpha); for (int i = 0; i < player.MaxAmmo; i++) { float d = 90 + 45 - dir * i; if (!ammoGainTimer.IsDone) { float f = TKMath.Exp(ammoGainTimer.PercentageDone); Color c = new Color(1f, 1f, 1f, f); ammoMesh.Color = c; ammoMesh.Reset(); ammoMesh.Translate(player.Position); ammoMesh.RotateZ(d); ammoMesh.Translate(f * 2f, 0); ammoMesh.Scale(0.4f, 0.15f); ammoMesh.Draw(); } else { ammoMesh.Color = new Color(1f, 1f, 1f, (i < player.Ammo ? 1f : 0.2f) * ammoAlpha); ammoMesh.Reset(); ammoMesh.Translate(player.Position); ammoMesh.RotateZ(d); ammoMesh.Translate(2f, 0f); ammoMesh.Scale(0.4f, 0.15f); ammoMesh.Draw(); } } } if (player.Weapon.ReloadProgress != -1) { reloadBar.Draw(player.Position, Color.White); } if (player.Weapon.RearmProgress != -1 && player.Weapon.FireType == WeaponStats.FireType.SingleTimed) { rearmBar.Draw(player.Position, Color.White); } if (player.Weapon.Charge != 0 && player.Weapon.FireType == WeaponStats.FireType.Charge) { rearmBar.Draw(player.Position, Color.White); } if (!ammoUseTimer.IsDone) { float d = 90 + 45 - dir * ammoUseIndex; float f = 1f - TKMath.Exp(ammoUseTimer.PercentageDone, 10); Color c = new Color(1f, 1f, 1f, 1f - f); ammoMesh.Color = c; ammoMesh.Reset(); ammoMesh.Translate(player.Position); ammoMesh.RotateZ(d); ammoMesh.Translate(2f, 0); ammoMesh.Scale(0.4f, 0.15f); ammoMesh.Scale(1 + f * 2f); ammoMesh.Draw(); } } #endregion }