// Custom distance (for mouse dashing) public void Dash(float horiz, float vert, float dist) { if (isDashing || numMoveDashes <= 0) { return; } float _dist; float _speed; if (dist > moveDashDist) { _dist = moveDashDist; _speed = moveDashSpeed; } else { _dist = dist; _speed = (moveDashDist * moveDashSpeed) / dist; } StartDash(horiz, vert, _dist, _speed); lastDashType = DashType.Move; playerAnim.StartMoveDash(); }
//<< Fields protected override void Serialize(IDictionary <string, object> json) { //>> Serialization if (Color.HasValue()) { json["color"] = Color; } if (DashType.HasValue()) { json["dashType"] = DashType; } if (Opacity.HasValue) { json["opacity"] = Opacity; } if (Width.HasValue) { json["width"] = Width; } //<< Serialization }
public void Attack() { atkDir = lastAimDir; if (isGrounded && IsTouchingBall()) { HitBall(); } else if (atkDashCounter < maxAtkDashes) { if (isDashing) { EndDash(); } atkDashDist = maxAtkDashDist / (1.5f * (atkDashCounter + 1)); atkDashSpeed = minAtkDashSpeed * (1.5f * (atkDashCounter + 1)); lastDashType = DashType.Attack; StartDash(lastAimDir.x, lastAimDir.y, atkDashDist, atkDashSpeed); } else if (IsTouchingBall()) { HitBall(); } }
public static bool HasModifier(this DashType type) { switch (type) { case DashType.Angled: return(true); default: return(false); } }
private void CreateLineStyles() { // Create custom line styles for (int j = 1; j <= 5; ++j) { for (int i = 1; i <= 10; ++i) { string name = string.Empty; IColorStyle colorStyle = null; DashType dashType = DashType.Solid; switch (j) { case 1: name = styleNameVeryPoor; colorStyle = project.Design.ColorStyles.Gray; dashType = DashType.Dot; break; case 2: name = styleNamePoor; colorStyle = project.Design.ColorStyles.Gray; dashType = DashType.Dash; break; case 3: name = styleNameNormal; colorStyle = project.Design.ColorStyles.Black; dashType = DashType.Solid; break; case 4: name = styleNameGood; colorStyle = project.Design.ColorStyles.Black; dashType = DashType.Solid; break; case 5: name = styleNameExcellent; colorStyle = project.Design.ColorStyles.Black; dashType = DashType.Solid; break; default: Debug.Fail(""); break; } LineStyle lineStyle = new LineStyle(string.Format("{0} {1}0%", name, i)); lineStyle.LineWidth = Math.Max(1, j / 2); lineStyle.ColorStyle = colorStyle; lineStyle.DashType = dashType; // Add the new line style to the current design (make it usable in shapes) project.Design.AddStyle(lineStyle); // Add the new line style to the repository (otherwise it won't be saved) project.Repository.Insert(project.Design, lineStyle); } } }
public override void WriteXml(XmlWriter writer) { base.WriteXml(writer); writer.WriteAttributeString("LineType", LineType.ToString()); writer.WriteAttributeString("DashType", DashType.ToString()); writer.WriteAttributeString("Type", CapType.ToString()); writer.WriteAttributeDouble("StrokeThickness", StrokeThickness); writer.WriteAttributeString("R", StrokeColor.R.ToString()); writer.WriteAttributeString("G", StrokeColor.G.ToString()); writer.WriteAttributeString("B", StrokeColor.B.ToString()); }
// Same distance every time (for controller dashing) public void Dash(float horiz, float vert) { if (isDashing || numMoveDashes <= 0) { return; } StartDash(horiz, vert, moveDashDist, moveDashSpeed); lastDashType = DashType.Move; playerAnim.StartMoveDash(); }
public override void OnEnter() { nextState = ""; cooldownTimer = cooldownDuration; dashTimer = dashDuration; if (animator.GetFloat("Speed") <= 0.01) { dashType = DashType.backstep; } else { dashType = DashType.dash; } Dash(); }
public override void HandlePacket(BinaryReader reader, int whoAmI) { MessageType id = (MessageType)reader.ReadByte(); byte player; switch (id) { case MessageType.ProjectileData: gProj.ReceiveProjectileData(reader, whoAmI); break; case MessageType.Dodge: player = reader.ReadByte(); byte type = reader.ReadByte(); if (Main.netMode == 2) { ModPacket packet = GetPacket(MessageType.Dodge, 2); packet.Write(player); packet.Write(type); packet.Send(-1, whoAmI); } if (type == 1) { Items.Glyphs.VeilGlyph.Block(Main.player[player]); } else { ErrorLogger.Log("SpiritMod: Unknown message (2:" + type + ")"); } break; case MessageType.Dash: player = reader.ReadByte(); DashType dash = (DashType)reader.ReadByte(); sbyte dir = reader.ReadSByte(); if (Main.netMode == 2) { ModPacket packet = GetPacket(MessageType.Dash, 3); packet.Write(player); packet.Write((byte)dash); packet.Write(dir); packet.Send(-1, whoAmI); } Main.player[player].GetModPlayer <MyPlayer>().PerformDash(dash, dir, false); break; case MessageType.PlayerGlyph: player = reader.ReadByte(); GlyphType glyph = (GlyphType)reader.ReadByte(); if (Main.netMode == 2) { ModPacket packet = GetPacket(MessageType.PlayerGlyph, 2); packet.Write(player); packet.Write((byte)glyph); packet.Send(-1, whoAmI); } if (player == Main.myPlayer) { break; } Main.player[player].GetModPlayer <MyPlayer>().glyph = glyph; break; default: ErrorLogger.Log("SpiritMod: Unknown message (" + id + ")"); break; } }
private static Dash[,] GetDashesByType(DashType type) { return(type == DashType.Vertical ? vertDashes : horDashes); }
public void SetDashType(DashType dashType) { Properties.DashType = dashType; }
public override void ReadFromBinary(IBinaryReader reader) { Type = (DashType)reader.ReadInt(); }
protected void SetValue(DashType type) { Type = type; }
public EdgeType(CgmFile container, DashType type) : this(container) { SetValue(type); }