private void DirModeRight(Object sender, EventArgs e) { ModeDirection = DirectionMode.Right; this.UpdateMessage(); this.ExpireSolution(true); }
internal string GetOpenHtmlTagPattern(DirectionMode directionMode) { var attributeFormatPattern = directionMode == DirectionMode.HtmlToBB ? "(?<{0}>.*?)" : "${{{0}}}"; if ((Attributes == null || Attributes.Count == 0) && !SelfAttributed) { return(OpeningHtmlTag); } var result = OpeningHtmlTag; if (SelfAttributed) { var regex = new Regex(string.Format(@"\{{{0}}}", BbTag)); result = regex.Replace(result, string.Format(attributeFormatPattern, BbTag)); } if (Attributes != null && Attributes.Count > 0) { foreach (var attribute in Attributes) { var regex = new Regex(string.Format(@"\{{{0}}}", attribute.Key)); result = regex.Replace(result, string.Format(attributeFormatPattern, attribute.Key)); } } return(result); }
public override bool Read(GH_IReader reader) { ModeDirection = (DirectionMode)reader.GetInt32("Direction"); this.UpdateMessage(); return(base.Read(reader)); }
/// <summary> /// MyProgressBar Constructor /// </summary> public BlockedProgressBar() { InitializeComponent(); _blockList = new BlockList(); _direction = DirectionMode.Horizontal; SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw | ControlStyles.DoubleBuffer, true); }
/// <summary> /// Returns trip information for the specified trip. /// The resulting TripInfo object contains a list of all the stops /// on the specified trip with predicted arrival or departure times. /// </summary> /// <param name="tripID">Trip ID (can be obtained from an ActualInfo object)</param> /// <param name="mode">Determines whether departure or arrival times are obtained</param> /// <returns></returns> public static async Task <TripInfo> GetTripInfoAsync(long tripID, DirectionMode mode) { var buster = ((long)DateTime.Now.ToUniversalTime().Subtract(new DateTime(1970, 1, 1)).TotalSeconds) * 1000; var content = new StringContent("tripId=" + tripID + "&mode=" + mode + "&cacheBuster=" + buster); var response = await _client.PostAsync(new Uri(_tripInfoUrl), content); return(await DeserializeAsync <TripInfo>(response)); }
public ArrowDirectional(Matrix3d matrix, DirectionMode mode, double angle = 0d) { this.BlockTableRecordId = ObjectId.Null; this.Origin = new Point3d(0, 0, 0); this.Matrix = matrix; this.Mode = mode; this.BlockName = "_DrawAnchorDeviations_" + this.Mode.ToString(); this.DynTransient = new display.DynamicTransient(); }
/// <summary> /// 设置移动的模式 /// </summary> /// <param name="luaState"></param> /// <returns></returns> public static int SetEnemyWanderMode(ILuaState luaState) { EnemyBase enemy = luaState.ToUserData(-3) as EnemyBase; InterpolationMode moveMode = (InterpolationMode)luaState.ToInteger(-2); DirectionMode dirMode = (DirectionMode)luaState.ToInteger(-1); enemy.SetWanderMode(moveMode, dirMode); return(0); }
public bool Delete(T value, DirectionMode direction, out BinaryNode <T> node) { if (!Find(value, out node)) { return(false); } DeleteNode(node, direction); return(true); }
public ArrowDirectional2(Matrix3d matrix, DirectionMode mode, double angle = 0d) : base() { this.BlockTableRecordId = ObjectId.Null; this.Origin = new Point3d(0, 0, 0); this.UcsMatrix = matrix; this.Mode = mode; this.BlockName = "_DrawAnchorDeviations_" + this.Mode.ToString(); this.DynTransient = new Helpers.Display.DynamicTransient(); _entities = new List <Entity>(); _blockTransform = Matrix3d.Identity; }
public string Parse(string input, DirectionMode directionMode) { if (string.IsNullOrWhiteSpace(input)) return input; if (replacements != null) foreach (var replacement in replacements) input = input.Replace( directionMode == DirectionMode.BBToHtml ? replacement.Key : replacement.Value, directionMode == DirectionMode.BBToHtml ? replacement.Value : replacement.Key); return directionMode == DirectionMode.HtmlToBB ? ParseToBBCode(input) : ParseToHtml(input); }
private void RightButtons(DirectionMode mode, GUILayoutOption height, GUILayoutOption width) { EditorGUILayout.BeginVertical(GUILayout.Height(135f)); GUILayout.FlexibleSpace(); //if (mode == DirectionMode.SixteenWay) //{ // var buttonContent = new GUIContent("ENE", "East-Northeast"); // var buttonStyle = GetButtonStyle(CardinalDirection.ENE); // buttonStyle.margin = new RectOffset(15, 7, 0, 0); // if (GUILayout.Button(buttonContent, buttonStyle, height, width)) // { // stateDirection = CardinalDirection.ENE; // directionSelector.SetSelected(CardinalDirection.ENE); // } //} if (mode == DirectionMode.TwoWay || mode == DirectionMode.FourWay) // || mode == DirectionMode.EightWay || mode == DirectionMode.SixteenWay) { var buttonContent = new GUIContent("E", "East"); var buttonStyle = GetButtonStyle(CardinalDirection.E); buttonStyle.margin = new RectOffset(22, 0, 5, 5); if (GUILayout.Button(buttonContent, buttonStyle, height, width)) { stateDirection = CardinalDirection.E; directionSelector.SetSelected(CardinalDirection.E); } } //if (mode == DirectionMode.SixteenWay) //{ // var buttonContent = new GUIContent("ESE", "East-Southeast"); // var buttonStyle = GetButtonStyle(CardinalDirection.ESE); // buttonStyle.margin = new RectOffset(15, 7, 0, 0); // if(GUILayout.Button(buttonContent, buttonStyle, height, width)) // { // stateDirection = CardinalDirection.ESE; // directionSelector.SetSelected(CardinalDirection.ESE); // } //} GUILayout.FlexibleSpace(); EditorGUILayout.EndVertical(); }
/// <summary> /// Determines if the given value represents a valid state of this property. /// </summary> /// <param name="value">The state that should be used.</param> /// <returns>True if the state is valid, otherwise false.</returns> protected override Boolean IsValid(CSSValue value) { if (value.Is(Keywords.Ltr)) { _mode = DirectionMode.Ltr; } else if (value.Is(Keywords.Rtl)) { _mode = DirectionMode.Rtl; } else { return(false); } return(true); }
private void NavMode_Click(object sender, RoutedEventArgs e) { #region Setting background / foreground / mode SolidColorBrush bg; if (Mode != DirectionMode.walking) { bg = WalkBTN.Foreground as SolidColorBrush; } else { bg = DriveBTN.Foreground as SolidColorBrush; } WalkBTN.Foreground = bg; DriveBTN.Foreground = bg; TransitBTN.Foreground = bg; var c = (Color)Resources["SystemControlBackgroundAccentBrush"]; (sender as Button).Foreground = new SolidColorBrush(c); switch ((sender as Button).Name) { case "WalkBTN": Mode = DirectionMode.walking; break; case "DriveBTN": Mode = DirectionMode.driving; break; case "TransitBTN": Mode = DirectionMode.transit; break; default: break; } #endregion foreach (var item in MapView.MapControl.MapElements) { if (item.GetType() == typeof(MapPolyline)) { MapView.MapControl.MapElements.Remove(item); DirectionFinder(); return; } } }
private void _okButton_Click(object sender, EventArgs e) { if (_allRadioButton.Checked) { FirstPageNumber = 1; LastPageNumber = PageCount; } else if (_selectedRadioButton.Checked) { FirstPageNumber = SelectedPageNumber; LastPageNumber = SelectedPageNumber; } Direction = (DirectionMode)_directionComboBox.SelectedIndex; EventOdd = (EvenOddMode)_evenOddComboBox.SelectedIndex; Orientation = (OrientationMode)_orientationComboBox.SelectedIndex; }
protected override Boolean IsValid(CSSValue value) { if (value.Is("ltr")) { _mode = DirectionMode.Ltr; } else if (value.Is("rtl")) { _mode = DirectionMode.Rtl; } else if (value != CSSValue.Inherit) { return(false); } return(true); }
internal string GetOpenBbTagPattern(DirectionMode directionMode) { var attributeFormatPattern = directionMode == DirectionMode.BBToHtml ? "(?<{0}>.*?)" : "${{{0}}}"; return(string.Format(@"{0}[{1}{2}]", directionMode == DirectionMode.BBToHtml ? @"\" : string.Empty, SelfAttributed ? string.Format("{0}=\"{1}\"", BbTag, string.Format(attributeFormatPattern, BbTag)) : BbTag, Attributes == null || Attributes.Count == 0 ? string.Empty : string.Format(" {0}", string.Join(" ", Attributes.Select(k => string.Format("{0}=\"{1}\"", k.Key, string.Format(attributeFormatPattern, k.Key))))))); }
internal string GetOpenBbTagPattern(DirectionMode directionMode) { var attributeFormatPattern = directionMode == DirectionMode.BBToHtml ? "(?<{0}>.*?)" : "${{{0}}}"; return string.Format(@"{0}[{1}{2}]", directionMode == DirectionMode.BBToHtml ? @"\" : string.Empty, SelfAttributed ? string.Format("{0}=\"{1}\"", BbTag, string.Format(attributeFormatPattern, BbTag)) : BbTag, Attributes == null || Attributes.Count == 0 ? string.Empty : string.Format(" {0}", string.Join(" ", Attributes.Select(k => string.Format("{0}=\"{1}\"", k.Key, string.Format(attributeFormatPattern, k.Key)))))); }
public void CopyFrom(Watermark watermark) { if (watermark == null) { return; } DisposeGdiResources(); text = watermark.Text; showBehind = watermark.ShowBehind; pageRange = watermark.PageRange; transparency = watermark.TextTransparency; imageTransparency = watermark.ImageTransparency; imageTiling = watermark.ImageTiling; foreColor = watermark.ForeColor; imageViewMode = watermark.ImageViewMode; textDirection = watermark.TextDirection; imageAlign = watermark.ImageAlign; font = (Font)watermark.Font.Clone(); image = CloneImage(watermark.Image); }
public LinePos GetRowLinePos(int rowIdx, DirectionMode dir = DirectionMode.BOTTOM_OR_RIGHT) { RectangleF rect = GetOriginalCellRect(rowIdx, 0); LinePos linePos = new LinePos(); PointF start, end; if (dir == DirectionMode.UP_OR_LEFT) { start = new PointF(rect.Left, rect.Top); end = new PointF(rect.Left + tbWidth, rect.Top); } else { start = new PointF(rect.Left, rect.Bottom); end = new PointF(rect.Left + tbWidth, rect.Bottom); } linePos.start = start; linePos.end = end; return(linePos); }
public LinePos GetColLinePos(int colIdx, DirectionMode dir = DirectionMode.BOTTOM_OR_RIGHT) { RectangleF rect = GetOriginalCellRect(0, colIdx); LinePos linePos = new LinePos(); PointF start, end; if (dir == DirectionMode.UP_OR_LEFT) { start = new PointF(rect.Left, rect.Top); end = new PointF(rect.Left, rect.Top + tbHeight); } else { start = new PointF(rect.Right, rect.Top); end = new PointF(rect.Right, rect.Top + tbHeight); } linePos.start = start; linePos.end = end; return(linePos); }
private void NavMode_Click(object sender, RoutedEventArgs e) { #region Setting background / foreground / mode SolidColorBrush bg; if (Mode != DirectionMode.walking) { bg = WalkBTN.Foreground as SolidColorBrush; } else { bg = DriveBTN.Foreground as SolidColorBrush; } WalkBTN.Foreground = bg; DriveBTN.Foreground = bg; TransitBTN.Foreground = bg; var c = (Color)Resources["SystemControlBackgroundAccentBrush"]; (sender as Button).Foreground = new SolidColorBrush(c); switch ((sender as Button).Name) { case "WalkBTN": Mode = DirectionMode.walking; break; case "DriveBTN": Mode = DirectionMode.driving; break; case "TransitBTN": Mode = DirectionMode.transit; break; default: break; } #endregion DirectionFinder(); }
public CustomSandwichLava(EntityData data, Vector2 offset) { startX = data.Position.X + offset.X; Direction = data.Enum("direction", DirectionMode.CoreModeBased); Speed = data.Float("speed", 20f); // vanilla is 160. so, setting sandwichGap to 120 requires each side to be shifted by 20 pixels towards the other ((160 - 120) / 2). sandwichDisplacement = (160f - data.Float("sandwichGap", 160f)) / 2; Depth = -1000000; Collider = new ColliderList(new Hitbox(340f, 120f, 0f, -sandwichDisplacement), new Hitbox(340f, 120f, 0f, -280f + sandwichDisplacement)); Visible = false; Add(loopSfx = new SoundSource()); Add(new PlayerCollider(OnPlayer)); Add(new CoreModeListener(OnChangeMode)); Add(bottomRect = new LavaRect(400f, 200f, 4)); bottomRect.Position = new Vector2(-40f, 0f); bottomRect.OnlyMode = LavaRect.OnlyModes.OnlyTop; bottomRect.SmallWaveAmplitude = 2f; Add(topRect = new LavaRect(400f, 200f, 4)); topRect.Position = new Vector2(-40f, -360f); topRect.OnlyMode = LavaRect.OnlyModes.OnlyBottom; topRect.SmallWaveAmplitude = 2f; topRect.BigWaveAmplitude = (bottomRect.BigWaveAmplitude = 2f); topRect.CurveAmplitude = (bottomRect.CurveAmplitude = 4f); Add(new TransitionListener { OnOutBegin = () => { // save the Y positions transitionStartY = Y; transitionStartTopRectY = topRect.Position.Y; transitionStartBottomRectY = bottomRect.Position.Y; if (persistent && Scene != null && Scene.Entities.FindAll <CustomSandwichLava>().Count <= 1) { // no lava in the next room: leave Leave(); } else { // look up for all lava blocker triggers in the next room. lavaBlockerTriggers = Scene.Entities.OfType <LavaBlockerTrigger>().ToList(); } }, OnOut = progress => { if (Scene != null) { X = (Scene as Level).Camera.X; if (!leaving) { // make the lava elements transition smoothly to their expected positions. Y = MathHelper.Lerp(transitionStartY, centerY, progress); topRect.Position.Y = MathHelper.Lerp(transitionStartTopRectY, TopOffset - topRect.Height + sandwichDisplacement, progress); bottomRect.Position.Y = MathHelper.Lerp(transitionStartBottomRectY, -sandwichDisplacement, progress); } } if ((progress > 0.95f) && leaving) { // lava is leaving, transition is over soon => remove it RemoveSelf(); } }, OnInEnd = () => { if (entering) { // transition is over. grab the camera position now since it's done moving. Y = centerY; entering = false; } } }); }
/// <summary> /// Gets a RealTimeDepartureInfo object containing information about /// future arrivals or departures of vehicles. /// </summary> /// <param name="stopShortName">Stop short name</param> /// <param name="mode">Direction mode</param> /// <returns>RealTimeDepartureInfo</returns> public async static Task <RealTimeDepartureInfo> GetRealTimeDepartureInfoAsync(int stopShortName, DirectionMode mode) { var response = await _client.GetAsync(new Uri(_realtimeInfoUrl + "?stop=" + stopShortName + "&mode=" + mode)); return(await DeserializeAsync <RealTimeDepartureInfo>(response)); }
internal string GetOpenHtmlTagPattern(DirectionMode directionMode) { var attributeFormatPattern = directionMode == DirectionMode.HtmlToBB ? "(?<{0}>.*?)" : "${{{0}}}"; if ((Attributes == null || Attributes.Count == 0) && !SelfAttributed) return OpeningHtmlTag; var result = OpeningHtmlTag; if (SelfAttributed) { var regex = new Regex(string.Format(@"\{{{0}}}", BbTag)); result = regex.Replace(result, string.Format(attributeFormatPattern, BbTag)); } if (Attributes != null && Attributes.Count > 0) { foreach (var attribute in Attributes) { var regex = new Regex(string.Format(@"\{{{0}}}", attribute.Key)); result = regex.Replace(result, string.Format(attributeFormatPattern, attribute.Key)); } } return result; }
private GUIContent GetWayImage(DirectionMode mode, CardinalDirection stateDirection) { Texture2D texture = null; if (mode == DirectionMode.TwoWay) { texture = DirectionPrefabs.TwoWay; if (stateDirection == CardinalDirection.E) { texture = DirectionPrefabs.TwoWayE; } else if (stateDirection == CardinalDirection.W) { texture = DirectionPrefabs.TwoWayW; } } else if (mode == DirectionMode.FourWay) { texture = DirectionPrefabs.FourWay; if (stateDirection == CardinalDirection.N) { texture = DirectionPrefabs.FourWayN; } else if (stateDirection == CardinalDirection.E) { texture = DirectionPrefabs.FourWayE; } else if (stateDirection == CardinalDirection.S) { texture = DirectionPrefabs.FourWayS; } else if (stateDirection == CardinalDirection.W) { texture = DirectionPrefabs.FourWayW; } } //else if(mode == DirectionMode.EightWay) //{ // texture = DirectionPrefabs.EightWay; // if (stateDirection == CardinalDirection.N) // { // texture = DirectionPrefabs.EightWayN; // } // else if (stateDirection == CardinalDirection.NE) // { // texture = DirectionPrefabs.EightWayNE; // } // else if (stateDirection == CardinalDirection.E) // { // texture = DirectionPrefabs.EightWayE; // } // else if (stateDirection == CardinalDirection.SE) // { // texture = DirectionPrefabs.EightWaySE; // } // else if (stateDirection == CardinalDirection.S) // { // texture = DirectionPrefabs.EightWayS; // } // else if (stateDirection == CardinalDirection.SW) // { // texture = DirectionPrefabs.EightWaySW; // } // else if (stateDirection == CardinalDirection.W) // { // texture = DirectionPrefabs.EightWayW; // } // else if (stateDirection == CardinalDirection.NW) // { // texture = DirectionPrefabs.EightWayNW; // } //} //else if(mode == DirectionMode.SixteenWay) //{ // texture = DirectionPrefabs.SixteenWay; // if (stateDirection == CardinalDirection.N) // { // texture = DirectionPrefabs.SixteenWayN; // } // else if (stateDirection == CardinalDirection.NNE) // { // texture = DirectionPrefabs.SixteenWayNNE; // } // else if (stateDirection == CardinalDirection.NE) // { // texture = DirectionPrefabs.SixteenWayNE; // } // else if (stateDirection == CardinalDirection.ENE) // { // texture = DirectionPrefabs.SixteenWayENE; // } // else if (stateDirection == CardinalDirection.E) // { // texture = DirectionPrefabs.SixteenWayE; // } // else if (stateDirection == CardinalDirection.ESE) // { // texture = DirectionPrefabs.SixteenWayESE; // } // else if (stateDirection == CardinalDirection.SE) // { // texture = DirectionPrefabs.SixteenWaySE; // } // else if (stateDirection == CardinalDirection.SSE) // { // texture = DirectionPrefabs.SixteenWaySSE; // } // else if (stateDirection == CardinalDirection.S) // { // texture = DirectionPrefabs.SixteenWayS; // } // else if (stateDirection == CardinalDirection.SSW) // { // texture = DirectionPrefabs.SixteenWaySSW; // } // else if (stateDirection == CardinalDirection.SW) // { // texture = DirectionPrefabs.SixteenWaySW; // } // else if (stateDirection == CardinalDirection.WSW) // { // texture = DirectionPrefabs.SixteenWayWSW; // } // else if (stateDirection == CardinalDirection.W) // { // texture = DirectionPrefabs.SixteenWayW; // } // else if (stateDirection == CardinalDirection.WNW) // { // texture = DirectionPrefabs.SixteenWayWNW; // } // else if (stateDirection == CardinalDirection.NW) // { // texture = DirectionPrefabs.SixteenWayNW; // } // else if (stateDirection == CardinalDirection.NNW) // { // texture = DirectionPrefabs.SixteenWayNNW; // } //} var result = new GUIContent(); result.image = texture; return(result); }
internal string GetCloseBbTagPattern(DirectionMode directionMode) { return directionMode == DirectionMode.BBToHtml ? string.Format(@"\[\/{0}]", BbTag) : string.Format("[/{0}]", BbTag); }
internal string GetCloseBbTagPattern(DirectionMode directionMode) { return(directionMode == DirectionMode.BBToHtml ? string.Format(@"\[\/{0}]", BbTag) : string.Format("[/{0}]", BbTag)); }
internal CSSDirectionProperty() : base(PropertyNames.Direction) { _mode = DirectionMode.Ltr; _inherited = true; }
internal override void Reset() { _mode = DirectionMode.Ltr; }
public void Direction(DirectionMode direction) { SerialCom.SetCamParm(CommandList.scd, ( double )(direction == DirectionMode.Forward ? 0:1)); }
internal override void Reset() { _mode = Default; }
public void SetState(DirectionMode mode) { _mode = mode; }
private void BottomButtons(DirectionMode mode, GUILayoutOption height, GUILayoutOption width) { EditorGUILayout.BeginHorizontal(GUILayout.Width(250f)); //if (mode == DirectionMode.EightWay || mode == DirectionMode.SixteenWay) //{ // var buttonContent = new GUIContent("SW", "Southwest"); // var buttonStyle = GetButtonStyle(CardinalDirection.SW); // buttonStyle.margin = new RectOffset(35, 0, 0, 0); // if(GUILayout.Button(buttonContent, buttonStyle, height, width)) // { // stateDirection = CardinalDirection.SW; // directionSelector.SetSelected(CardinalDirection.SW); // } //} //else //{ GUILayout.Label("", height, GUILayout.Width(70f)); //} //if (mode == DirectionMode.SixteenWay) //{ // var buttonContent = new GUIContent("SSW", "South-Southwest"); // var buttonStyle = GetButtonStyle(CardinalDirection.SSW); // buttonStyle.margin = new RectOffset(0, 0, 18, 0); // if(GUILayout.Button(buttonContent, buttonStyle, height, width)) // { // stateDirection = CardinalDirection.SSW; // directionSelector.SetSelected(CardinalDirection.SSW); // } //} //else //{ GUILayout.Label("", height, width); //} if (mode == DirectionMode.FourWay) // || mode == DirectionMode.EightWay || mode == DirectionMode.SixteenWay) { var buttonContent = new GUIContent("S", "South"); var buttonStyle = GetButtonStyle(CardinalDirection.S); buttonStyle.margin = new RectOffset(3, 3, 25, 0); if (GUILayout.Button(buttonContent, buttonStyle, height, width)) { stateDirection = CardinalDirection.S; directionSelector.SetSelected(CardinalDirection.S); } } //if (mode == DirectionMode.SixteenWay) //{ // var buttonContent = new GUIContent("SSE", "South-Southeast"); // var buttonStyle = GetButtonStyle(CardinalDirection.SSE); // buttonStyle.margin = new RectOffset(0, 0, 18, 0); // if(GUILayout.Button(buttonContent, buttonStyle, height, width)) // { // stateDirection = CardinalDirection.SSE; // directionSelector.SetSelected(CardinalDirection.SSE); // } //} //else //{ GUILayout.Label("", height, width); //} //if (mode == DirectionMode.EightWay || mode == DirectionMode.SixteenWay) //{ // var buttonContent = new GUIContent("SE", "Southeast"); // var buttonStyle = GetButtonStyle(CardinalDirection.SE); // buttonStyle.margin = new RectOffset(0, 0, 0, 25); // if(GUILayout.Button(buttonContent, buttonStyle, height, width)) // { // stateDirection = CardinalDirection.SE; // directionSelector.SetSelected(CardinalDirection.SE); // } //} //else //{ GUILayout.Label("", height, GUILayout.Width(70f)); //} EditorGUILayout.EndHorizontal(); }
/// <summary> /// Gets a RealTimeDepartureInfo object containing information about /// future arrivals or departures of vehicles. /// </summary> /// <param name="stopShortName">Stop short name</param> /// <param name="mode">Direction mode</param> /// <param name="startTime">Start time</param> /// <param name="endTime">End time</param> /// <returns>RealTimeDepartureInfo</returns> public async static Task <RealTimeDepartureInfo> GetRealTimeDepartureInfoAsync(int stopShortName, DirectionMode mode, DateTime startTime, DateTime endTime) { var time = ((long)startTime.ToUniversalTime().Subtract(new DateTime(1970, 1, 1)).TotalSeconds) * 1000; var buster = ((long)DateTime.Now.ToUniversalTime().Subtract(new DateTime(1970, 1, 1)).TotalSeconds) * 1000; var content = new StringContent("stop=" + stopShortName + "&mode=" + mode + "&startTime=" + time + "&timeFrame=" + (endTime - startTime).TotalMinutes + "&cacheBuster=" + buster); var response = await _client.PostAsync(new Uri(_realtimeInfoUrl), content); return(await DeserializeAsync <RealTimeDepartureInfo>(response)); }
public static Vector3 GetRandomDirection(SplatterSettings settings, Vector3?avgDir) { Vector3 moveDir = Vector3.zero; float random; DirectionMode currentDirectionMode = avgDir.HasValue? DirectionMode.Vector : settings.directionMode; if (!avgDir.HasValue) { avgDir = settings.direction; } switch (currentDirectionMode) { case DirectionMode.Vector: random = Random.Range(-settings.spanAngle * 0.5f * Mathf.Deg2Rad, settings.spanAngle * 0.5f * Mathf.Deg2Rad); float movAngle = Mathf.Atan2(avgDir.Value.y, avgDir.Value.x); movAngle += random; if (settings.orientation == OrientationMode.Vertical) { moveDir = new Vector3(Mathf.Cos(movAngle), Mathf.Sin(movAngle), 0f); } else { moveDir = new Vector3(Mathf.Cos(movAngle), 0f, Mathf.Sin(movAngle)); } break; case DirectionMode.Transform: if (settings.directionReference == null) { Debug.LogError("[SPLATTER SYSTEM] Orientation reference is not set."); return(Vector3.zero); } var angles = settings.directionReference.rotation.eulerAngles * Mathf.Deg2Rad; random = Random.Range(-settings.spanAngle * 0.5f * Mathf.Deg2Rad, settings.spanAngle * 0.5f * Mathf.Deg2Rad); angles.z += Mathf.Sin(random); if (settings.orientation == OrientationMode.Vertical) { moveDir = new Vector3(Mathf.Cos(angles.z), Mathf.Sin(angles.z), 0f); } else { moveDir = new Vector3(Mathf.Cos(angles.z), 0f, Mathf.Sin(angles.z)); } break; default: moveDir = Random.onUnitSphere; if (settings.orientation == OrientationMode.Vertical) { moveDir.z = 0; } else { moveDir.y = 0; } break; } return(moveDir); }