public TileRenderData(TileBase floorOverlay, TileBase tile, TileBase overlayTile, RotationEffect effect) { this.floorOverlayTile = floorOverlay; this.objectTile = tile; this.overlayTile = overlayTile; this.effect = effect; }
public override void Run(Window window) { Rect square = window.GetInnerSquare(); Button button1 = new Button(window) { Text = "Effect", }; button1.Move(square.X, square.Y); button1.Resize(square.Width / 2, square.Height / 2); button1.Show(); Button button2 = new Button(window) { Text = "Chain Effect", }; button2.Move(square.X + square.Width / 2, square.Y + square.Height / 2); button2.Resize(square.Width / 2, square.Height / 2); button2.Show(); Point begin = new Point(); begin.X = begin.Y = 0; Point end = new Point(); end.X = end.Y = square.Height / 2; TranslationEffect translation = new TranslationEffect(begin, end); translation.EffectEnded += (s, e) => { Console.WriteLine("Translation Effect Ended"); }; RotationEffect rotation = new RotationEffect(0, 180); rotation.EffectEnded += (s, e) => { Console.WriteLine("Rotation Effect Ended"); }; button1.Clicked += (s, e) => { Transit transit1 = CreateTransit(); transit1.Objects.Add(button1); transit1.Objects.Add(button2); transit1.AddEffect(translation); transit1.AddEffect(rotation); transit1.Go(); }; button2.Clicked += (s, e) => { Transit transit1 = CreateTransit(); transit1.Objects.Add(button1); transit1.AddEffect(translation); transit1.AddEffect(rotation); Transit transit2 = CreateTransit(); transit2.Objects.Add(button2); transit2.AddEffect(translation); transit2.AddEffect(rotation); transit1.Chains.Add(transit2); transit1.Go(); }; }
public override void Run(Window window) { Button button1 = new Button(window) { Text = "Effect", }; button1.Move(0, 0); button1.Resize(270, 200); button1.Show(); Button button2 = new Button(window) { Text = "Chain Effect", }; button2.Move(270, 200); button2.Resize(270, 200); button2.Show(); Point begin = new Point(); begin.X = begin.Y = 0; Point end = new Point(); end.X = end.Y = 200; TranslationEffect translation = new TranslationEffect(begin, end); translation.EffectEnded += (s, e) => { Console.WriteLine("Translation Effect Ended"); }; RotationEffect rotation = new RotationEffect(0, 180); rotation.EffectEnded += (s, e) => { Console.WriteLine("Rotation Effect Ended"); }; button1.Clicked += (s, e) => { Transit transit1 = CreateTransit(); transit1.Objects.Add(button1); transit1.Objects.Add(button2); transit1.AddEffect(translation); transit1.AddEffect(rotation); transit1.Go(); }; button2.Clicked += (s, e) => { Transit transit1 = CreateTransit(); transit1.Objects.Add(button1); transit1.AddEffect(translation); transit1.AddEffect(rotation); Transit transit2 = CreateTransit(); transit2.Objects.Add(button2); transit2.AddEffect(translation); transit2.AddEffect(rotation); transit1.Chains.Add(transit2); transit1.Go(); }; }
public StateManager(Hero hero, World world) { LoadSounds(); this.world = world; platman = hero; rotationEffect = RotationEffect.GetRotationUp(0); platman.Mechanic.GravityManager.GravityChanged += GravityManager_GravityChanged; CurrentState = State.Standy; }
/// <summary> /// Initialize and start the camera preview /// </summary> public async Task InitializeAsync() { if (CaptureButton.Content.ToString().Equals("Capture and Canny")) { CaptureButton.Content = "Stop"; // Create a camera preview image source (from Imaging SDK) if (_cameraPreviewImageSource == null) { _cameraPreviewImageSource = new CameraPreviewImageSource(); await _cameraPreviewImageSource.InitializeAsync(string.Empty); } var properties = await _cameraPreviewImageSource.StartPreviewAsync(); // Create a preview bitmap with the correct aspect ratio var width = 640.0; var height = (width / properties.Width) * properties.Height; var bitmap = new WriteableBitmap((int)width, (int)height); _writeableBitmap = bitmap; // Create a filter effect to be used with the source (e.g. used to correct rotation) //_effect = new FilterEffect(_cameraPreviewImageSource); //_effect.Filters = new IFilter[] { new RotationFilter(90.0) }; //_writeableBitmapRenderer = new WriteableBitmapRenderer(_effect, _writeableBitmap); RotationEffect rotation = new RotationEffect(_cameraPreviewImageSource, 90); _writeableBitmapRenderer = new WriteableBitmapRenderer(rotation, _writeableBitmap); //_writeableBitmapRenderer.Source = new EffectList() { _cameraPreviewImageSource, rotation }; //_writeableBitmapRenderer.WriteableBitmap = _writeableBitmap; ImageView.Source = _writeableBitmap; // Attach preview frame delegate _cameraPreviewImageSource.PreviewFrameAvailable += OnPreviewFrameAvailable; } else { if (CaptureButton.Content.ToString().Equals("Stop")) { await _cameraPreviewImageSource.StopPreviewAsync(); _cameraPreviewImageSource.Dispose(); _cameraPreviewImageSource = null; } CaptureButton.Content = "Capture and Canny"; ImageView.Source = null; } }
/// <summary> /// Returns an angle from enum RotationEffect. /// </summary> private float getAngle(RotationEffect e) { switch (e) { case RotationEffect.ROTATE_90: return(90f); case RotationEffect.ROTATE_180: return(180f); case RotationEffect.ROTATE_270: return(270f); default: return(0f); } }
public static RingRotationEffectController Create(TrackLaneRingsRotationEffectSpawner baseEffect) { BeatmapEventType eventTypeForThisEffect = Helper.GetValue <BeatmapEventType>(baseEffect, "_beatmapEventType"); RotationStepType stepType = Helper.GetValue <RotationStepType>(baseEffect, "_rotationStepType"); float stepMax = Helper.GetValue <float>(baseEffect, "_rotationStep"); float rotation = Helper.GetValue <float>(baseEffect, "_rotation"); int propagationSpeed = Helper.GetValue <int>(baseEffect, "_rotationPropagationSpeed"); float flexySpeed = Helper.GetValue <float>(baseEffect, "_rotationFlexySpeed"); TrackLaneRingsRotationEffect rotationEffect = Helper.GetValue <TrackLaneRingsRotationEffect>(baseEffect, "_trackLaneRingsRotationEffect"); TrackLaneRingsManager manager = Helper.GetValue <TrackLaneRingsManager>(rotationEffect, "_trackLaneRingsManager"); float startupAngle = Helper.GetValue <float>(rotationEffect, "_startupRotationAngle"); float startupStep = Helper.GetValue <float>(rotationEffect, "_startupRotationStep"); int startupPropagationSpeed = Helper.GetValue <int>(rotationEffect, "_startupRotationPropagationSpeed"); float startupFlexySpeed = Helper.GetValue <float>(rotationEffect, "_startupRotationFlexySpeed"); RotationEffect startupRotationEffect = new RotationEffect { progress = 0, angle = startupAngle, step = startupStep, propagationSpeed = startupPropagationSpeed, flexySpeed = startupFlexySpeed }; RingRotationEffectController controller = new GameObject("TwitchFXRingRotationController").AddComponent <RingRotationEffectController>(); controller.eventTypeForThisEffect = eventTypeForThisEffect; controller.manager = manager; controller.name = baseEffect.name; controller.isBig = baseEffect.name.Contains("Big"); controller.stepType = stepType; controller.stepMax = stepMax; controller.startupRotationEffect = startupRotationEffect; controller.rotation = rotation; controller.propagationSpeed = propagationSpeed; controller.flexySpeed = flexySpeed; return(controller); }
private void GravityManager_GravityChanged(object sender, EventArgs e) { if (world.Gravity == VelocityValues.Instance.GravityDown) { rotationEffect = RotationEffect.GetRotationDown(rotationEffect.Angle); } else if (world.Gravity == VelocityValues.Instance.GravityUp) { rotationEffect = RotationEffect.GetRotationUp(rotationEffect.Angle); } else if (world.Gravity == VelocityValues.Instance.GravityLeft) { rotationEffect = RotationEffect.GetRotationLeft(rotationEffect.Angle); } else if (world.Gravity == VelocityValues.Instance.GravityRight) { rotationEffect = RotationEffect.GetRotationRight(rotationEffect.Angle); } rotationEffect.Enabled = true; }
public void FixedUpdate() { TrackLaneRing[] rings = manager.Rings; for (int i = activeRotationEffects.Count - 1; i >= 0; i--) { RotationEffect rotation = activeRotationEffects[i]; for (int j = (int)rotation.progress; j < rotation.progress + rotation.propagationSpeed && j < rings.Length; j++) { rings[j].SetDestRotation( rotation.angle + j * rotation.step, rotation.flexySpeed ); } rotation.progress += rotation.propagationSpeed; if (rotation.progress >= rings.Length) { activeRotationEffects.RemoveAt(i); } } }
public void OnEvent(BeatmapEventData eventData) { if (eventData.type != eventTypeForThisEffect) { return; } CustomBeatmapEventData customEventData = eventData as CustomBeatmapEventData; string nameFilter = customEventData?.ringsNameFilter; if (nameFilter != null && !nameFilter.Equals(name, StringComparison.OrdinalIgnoreCase)) { return; } float direction = -(customEventData?.direction ?? (Random.value > 0.5f ? 1f : -1f)); bool counterSpin = customEventData?.ringsCounterSpin ?? false; bool reset = customEventData?.ringsReset ?? false; if (counterSpin && isBig) { direction = -direction; } float step; switch (stepType) { case RotationStepType.Range0ToMax: step = Random.Range(0f, stepMax); break; case RotationStepType.Range: step = Random.Range(-stepMax, stepMax); break; case RotationStepType.MaxOr0: step = Random.value > 0.5f ? stepMax : 0f; break; default: step = 0f; break; } step = customEventData?.ringsStep ?? step; float propagationSpeed = customEventData?.ringsPropagationSpeed ?? this.propagationSpeed; float flexySpeed = customEventData?.ringsFlexySpeed ?? this.flexySpeed; float?stepMultiplier = customEventData?.ringsStepMultiplier; float?propagationSpeedMultiplier = customEventData?.ringsPropagationSpeedMultiplier; float?flexySpeedMultiplier = customEventData?.ringsFlexySpeedMultiplier; if (stepMultiplier.HasValue) { step *= stepMultiplier.Value; } if (propagationSpeedMultiplier.HasValue) { propagationSpeed *= propagationSpeedMultiplier.Value; } if (flexySpeedMultiplier.HasValue) { flexySpeed *= flexySpeedMultiplier.Value; } if (reset) { step = 0; propagationSpeed = 50; flexySpeed = 50; } RotationEffect rotationEffect = new RotationEffect { progress = 0, angle = manager.Rings[0].GetDestinationRotation() + rotation * direction, step = step, propagationSpeed = propagationSpeed, flexySpeed = flexySpeed }; activeRotationEffects.Add(rotationEffect); }
public void Start() { activeRotationEffects.Add(startupRotationEffect); startupRotationEffect = null; }
public void Flip() { if (RotationEffect != null && !RotationEffect.Terminated) return; RotationEffect = new RotationEffect(); RotationEffect.Length = 500; RotationEffect.Progress = Effect<IPhysical>.ProgressType.Linear; RotationEffect.Quantity = MathHelper.Pi; Scene.PhysicalEffects.Add(Image, RotationEffect); }
public void Update() { if (RotationEffect != null && RotationEffect.Terminated) { Image.Rotation = 0; Progress = 0; RotationEffect = null; } if (RemainingTime >= MinimumTime) return; Progress = (int)Math.Ceiling(((MinimumTime - RemainingTime) / MinimumTime) * (NB_PIXELS / 2)); }