public void btn_about_down() { // GD.Print(AboutPanel.GetPosition()); Vector2 finalPosOpen = new Vector2(); finalPosOpen.x = -1; finalPosOpen.y = 0; Vector2 finalPosClose = new Vector2(); finalPosClose.x = -184; finalPosClose.y = 0; switch (Menuopen) { case 1: AboutTween.InterpolateProperty(AboutPanel, ":position", AboutPanel.GetPosition(), finalPosClose, 1.0f, Tween.TransitionType.Bounce, Tween.EaseType.Out, 0); AboutTween.Start(); Menuopen = 0; break; case 0: AboutTween.InterpolateProperty(AboutPanel, ":position", AboutPanel.GetPosition(), finalPosOpen, 1.0f, Tween.TransitionType.Bounce, Tween.EaseType.Out, 0); AboutTween.Start(); Menuopen = 1; break; } }
public async void Outro() { Control root = GetNode("Outro") as Control; root.SetVisible(true); Label label = root.GetNode("Title") as Label; await ToSignal(this, "next"); Tween tween = CommonTweenUtil.Fade(label, 0.3f, 0, 1); label.SetVisible(true); AddChild(tween); tween.Start(); await ToSignal(tween, "tween_completed"); tween.RemoveAll(); await ToSignal(this, "next"); tween = CommonTweenUtil.Fade(root, 0.3f, 1, 0, tween); tween.Start(); await ToSignal(tween, "tween_completed"); tween.RemoveAll(); EmitSignal("section_finished"); root.SetVisible(false); }
/// <summary> /// Open phone up /// </summary> public void Open() { if (open || opening || closing) { return; } Function.Call(Hash.CREATE_MOBILE_PHONE, 0); Function.Call(Hash.SET_MOBILE_PHONE_SCALE, 250f); Ypos.Start(-60f, -20f, .3f, ScaleFuncs.Linear); Yrot.Start(-90f, 0f, .3f, ScaleFuncs.Linear); opening = true; // Init SetHomeMenuApp(0, AppIcon.BENNYS, "Benny's shit", 10); SetHomeMenuApp(1, AppIcon.CAMERA, "Cameroon"); SetHomeMenuApp(2, AppIcon.MULTIPLAYER, "Multiplier"); SetHomeMenuApp(3, AppIcon.PLAYER_LIST, "BAWSAQ"); SetHomeMenuApp(4, AppIcon.SETTINGS_2, "GPS"); SetHomeMenuApp(5, AppIcon.NEW_CONTACT, "New contact"); SetHomeMenuApp(6, AppIcon.EMAIL, "Music"); SetHomeMenuApp(7, AppIcon.BROADCAST, "Party"); SetHomeMenuApp(8, AppIcon.CHECKLIST, "Profile"); // Show view Cellphone.CallFunction("DISPLAY_VIEW", (int)View.HomeMenu, 0); }
public async void Title() { Control root = GetNode("Title") as Control; root.SetVisible(true); Label label = GetNode("Title/Title") as Label; //Tween titleTween = CommonTweenUtil.ScaleCenter(label, new Vector2(0, 0), new Vector2(1, 1), 0.3f); await ToSignal(this, "next"); label.SetVisible(true); Tween titleTween = CommonTweenUtil.Fade(label, 0.3f, 0, 1); AddChild(titleTween); titleTween.Start(); await ToSignal(titleTween, "tween_completed"); titleTween.QueueFree(); await ToSignal(this, "next"); titleTween = CommonTweenUtil.Fade(label, 0.3f, 1, 0); AddChild(titleTween); titleTween.Start(); await ToSignal(titleTween, "tween_completed"); titleTween.QueueFree(); root.SetVisible(false); EmitSignal("section_finished"); }
public async void Intro() { Control root = GetNode("Intro") as Control; root.SetVisible(true); Tween tween = new Tween(); AddChild(tween); /* * Label label = root.GetNode("Title") as Label; * await ToSignal(this, "next"); * label.SetVisible(true); * tween = CommonTweenUtil.Fade(label, 0.3f, 0, 1, tween); * tween.Start(); * await ToSignal(tween, "tween_completed"); */ NodeMap maze = root.GetNode("NodeMap") as NodeMap; // set maze size maze.SetHeight(79); maze.SetWidth(159); maze.ResizeBlock(); //maze.animate = false; await ToSignal(this, "next"); maze.SetVisible(true); tween = CommonTweenUtil.Fade(maze, 0.3f, 0, 1, tween); //tween = CommonTweenUtil.Scale(maze, new Vector2(0, 0), new Vector2(1, 1), 0.3f, tween); tween.Start(); await ToSignal(tween, "tween_completed"); await ToSignal(this, "next"); maze.GenerateMap(); await ToSignal(maze, "finished"); maze.SetDst(159 * 2 - 2); await ToSignal(this, "next"); maze.AStar(); await ToSignal(maze, "finished"); await ToSignal(this, "next"); tween.RemoveAll(); tween = CommonTweenUtil.Fade(root, 0.3f, 1, 0, tween); tween.Start(); await ToSignal(tween, "tween_completed"); tween.QueueFree(); root.SetVisible(false); EmitSignal("section_finished"); }
/// <summary> /// Smoothly interpolates the value of a TextureProgress bar. /// </summary> public void TweenBarValue(TextureProgress bar, float targetValue, float maxValue) { var percentage = (targetValue / maxValue) * 100; tween.InterpolateProperty(bar, "value", bar.Value, percentage, 0.3f, Tween.TransitionType.Linear, Tween.EaseType.Out); tween.Start(); }
private void _startScreenShake() { Vector2 randomVector = new Vector2(random.RandfRange(-_amplitude, _amplitude), random.RandfRange(-_amplitude, _amplitude)); _shakeTween.InterpolateProperty(this, "offset", Offset, randomVector, _freqencyTimer.WaitTime, Tween.TransitionType.Sine, Tween.EaseType.InOut); _shakeTween.Start(); }
public void StartLoadingVisuals(float time) { _loading = true; _tween.StopAll(); _tween.InterpolateProperty(this, "modulate", new Color(Modulate.r, Modulate.g, Modulate.b, 0), new Color(Modulate.r, Modulate.g, Modulate.b, 1), time, Tween.TransitionType.Cubic, Tween.EaseType.InOut); _tween.Start(); }
private void StartArmFlashTween() { Color start = InvertTween ? FlashTweenEnd : FlashTweenStart; Color end = InvertTween ? FlashTweenStart : FlashTweenEnd; ArmFlashTween.InterpolateProperty(ArmTextureRect, ":self_modulate", start, end, 0.5f, Tween.TransitionType.Sine, Tween.EaseType.In); ArmFlashTween.Start(); }
public void OnItem_MouseEntered(string itemName) { if (string.IsNullOrWhiteSpace(itemName)) { GD.PushError("Item name must not be empty"); return; } var data = Autoload.Get <Data>(); if (!data.itemData.ContainsKey(itemName)) { GD.PushError($"Item name {itemName} not found"); return; } var itemRecord = data.itemData[itemName]; var itemType = itemRecord.type; _itemNameLabel.Text = itemName; _background.Texture = GetItemTypeBackground(itemType); switch (itemType) { case "item": _damageMargin.Visible = false; _healthGainedLabel.Visible = false; break; case "weapon": _damageMargin.Visible = true; _healthGainedMargin.Visible = false; _quickDamageLabel.Text = $"{itemRecord.quickDamage}"; _heavyDamageLabel.Text = $"{itemRecord.heavyDamage}"; _counterDamageLabel.Text = $"{itemRecord.counterDamage}"; break; case "usable": _damageMargin.Visible = false; _healthGainedMargin.Visible = true; _healthGainedLabel.Text = $"{itemRecord.healthGained}"; break; case "armor": _damageMargin.Visible = false; _healthGainedMargin.Visible = true; _healthGainedLabel.Text = $"{itemRecord.healthAdded}"; break; default: throw new ArgumentOutOfRangeException(); } _tween.InterpolateProperty(this, "rect_position", RectPosition, new Vector2(RectPosition.x, BOTTOM_POS_Y), ANIMATION_DURATION, Tween.TransitionType.Cubic, Tween.EaseType.Out); _tween.Start(); popupToBeVisible = true; }
private void ShowBody() { float duration = 0.2f; lifeTween.StopAll(); lifeTween.InterpolateProperty(body, "width", 0f, MaxWidth, duration); lifeTween.InterpolateCallback(this, duration, nameof(DoDamage)); lifeTween.Start(); }
protected override void On() { if (_tw == null) { return; } _tw.InterpolateProperty(this, "transform:origin", Transform.origin, _initialPosition + _openningOffset, _duration); _tw.Start(); }
private void AnimateLoss(float to) { loseLayer.Value = baseLayer.Value; baseLayer.Value = to; tweener.StopAll(); tweener.InterpolateProperty(loseLayer, "value", loseLayer.Value, baseLayer.Value, 0.25f); tweener.Start(); }
public void FadeToBlack() { Rect.Color = new Color(0, 0, 0, 0); Fader.InterpolateProperty(Rect, "color", new Color(0, 0, 0, 0), new Color(0, 0, 0, 1), FadeDuration); Fader.Start(); }
private void IconLegendMouseEnter() { tween.InterpolateProperty(this, "rect_scale", Vector2.One, new Vector2(1.1f, 1.1f), 0.1f); tween.Start(); // Highlight icon Modulate = IsUsingFallbackIcon ? data.Colour.Lightened(0.5f) : Colors.LightGray; chart.dataLines[DataName].OnMouseEnter(); }
public override void Enter(System.Collections.Generic.Dictionary <string, object> msg = null) { (_parent as Camera).isAiming = true; cameraRig.aimTarget.Visible = true; cameraRig.springArm.Translation = cameraRig._positionStart + offsetCamera; tween.InterpolateProperty(cameraRig.camera, "fov", cameraRig.camera.Fov, fov, 0.5f, Tween.TransitionType.Quad, Tween.EaseType.Out); tween.Start(); }
public async void Summary() { Control root = GetNode("Summary") as Control; root.SetVisible(true); Tween tween = new Tween(); AddChild(tween); Control header = root.GetNode("Header") as Control; await ToSignal(this, "next"); tween = CommonTweenUtil.Fade(header, 0.3f, 0, 1, tween); header.SetVisible(true); tween.Start(); await ToSignal(tween, "tween_completed"); Control description = root.GetNode("Description") as Control; description.SetVisible(true); await ToSignal(this, "next"); tween = CommonTweenUtil.Fade(description.GetNode("Label1") as Control, 0.3f, 0, 1, tween); (description.GetNode("Label1") as Control).SetVisible(true); tween.Start(); await ToSignal(tween, "tween_completed"); await ToSignal(this, "next"); tween = CommonTweenUtil.Fade(description.GetNode("Label2") as Control, 0.3f, 0, 1, tween); (description.GetNode("Label2") as Control).SetVisible(true); tween.Start(); await ToSignal(tween, "tween_completed"); await ToSignal(this, "next"); tween = CommonTweenUtil.Fade(description.GetNode("Label3") as Control, 0.3f, 0, 1, tween); (description.GetNode("Label3") as Control).SetVisible(true); tween.Start(); await ToSignal(tween, "tween_completed"); await ToSignal(this, "next"); tween = CommonTweenUtil.Fade(root, 0.3f, 1, 0, tween); tween.Start(); await ToSignal(tween, "tween_completed"); tween.QueueFree(); root.SetVisible(false); EmitSignal("section_finished"); }
private void NewShake() { Vector2 rand = new Vector2(); RandomNumberGenerator Rng = new RandomNumberGenerator(); rand.x = Rng.RandfRange((float)-Amplitude, (float)Amplitude); rand.y = Rng.RandfRange((float)-Amplitude, (float)Amplitude); ShakeTween.InterpolateProperty(Camera, "offset", Camera.Offset, rand, Frequency.WaitTime, TRANS, EASE); ShakeTween.Start(); }
/// <summary> /// To zoom the camera /// </summary> /// <param name="pZoomValue">Zoom factor</param> /// <param name="pZoomDuration">(optional - empty = ZoomDefaultZoomduration value) How fast the zoom occurs (small value = faster) </param> public void Zoom_Camera(float pZoomValue, float pZoomDuration = -1.0f) { // Set zoom speed _zoomDuration = pZoomDuration == -1.0f ? ZoomDefaultZoomduration : pZoomDuration; // Limit the zoom value between `min_zoom` and `max_zoom` _zoomTargetLevel = Mathf.Clamp(pZoomValue, ZoomMinValue, ZoomMaxValue); // Animate the zoom _tween.InterpolateProperty(this, "zoom", Zoom, new Vector2(_zoomTargetLevel, _zoomTargetLevel), _zoomDuration, Tween.TransitionType.Sine, Tween.EaseType.Out); _tween.Start(); }
public void TransitionTransparency(Control control, Control currentcontrol, Button button) { this.currentcontrol = currentcontrol; nextcontrol = control; nextbutton = button; Transition.Color = new Color(199 / 1, 240 / 1, 216 / 1, 1); TransparencyTween.InterpolateProperty(Transition, "color", new Color(199f / 255, 240f / 255, 216f / 255, 0), new Color(199f / 255, 240f / 255, 216f / 255, 1), 0.5f); TransparencyTween.InterpolateProperty(Transition, "color", new Color(199f / 255, 240f / 255, 216f / 255, 1), new Color(199f / 255, 240f / 255, 216f / 255, 0), 0.5f, delay: 0.5f); TransparencyTween.Start(); GetNode <Timer>("TransparencyTimer").Start(0.5f); }
async void ForwardTween() { tween.InterpolateProperty( follow, "unit_offset", 0, 1, walkTime, Tween.TransitionType.Linear, Tween.EaseType.InOut ); tween.Start(); await ToSignal(tween, "tween_completed"); await Turn180Tween(); BackwardTween(); }
public void ShowCursor(HexCoord coord) { if (!hexCursor.Visible) { hexCursor.Position = coord.Position(); hexCursor.Visible = true; } else { snapTween.InterpolateProperty(hexCursor, "position", null, coord.Position(), 0.1f, Tween.TransitionType.Cubic, Tween.EaseType.Out, 0); snapTween.Start(); } }
async void RotateLeft() { if (lostLevel) { return; } tween.InterpolateProperty(this, "rotation_degrees", null, rotationDegEitherSide, rotationTimeSec, Tween.TransitionType.Sine, Tween.EaseType.InOut); tween.Start(); await ToSignal(tween, "tween_completed"); await ToSignal(GetTree().CreateTimer(postRotationDelay, false), "timeout"); RotateRight(); }
private async void StartTweening() { tween.InterpolateMethod(this, "TweenMoveRed", 0, 1, 30, Tween.TransitionType.Quad, Tween.EaseType.Out); tween.Start(); await ToSignal(tween, "tween_completed"); tween.InterpolateMethod(this, "TweenMoveGreen", 0, 1, 30, Tween.TransitionType.Quad, Tween.EaseType.Out); tween.Start(); await ToSignal(tween, "tween_completed"); tween.InterpolateMethod(this, "TweenMoveBlue", 0, 1, 30, Tween.TransitionType.Quad, Tween.EaseType.Out); tween.Start(); }
private async Task AddEnergyAndParticles(TweetUi tweetUi, PackedScene particlesPackedScene, Vector2 particlesEndPosition, Action <int> addEnergy) { if (!(particlesPackedScene.Instance() is Node2D buffParticles)) { return; } GetOwner <Control>().AddChild(buffParticles); buffParticles.SetGlobalPosition(tweetUi.GetGlobalPosition() + tweetUi.GetSize() / 2); buffAnimationTween.InterpolateMethod(buffParticles, "set_global_position", buffParticles.GetGlobalPosition(), particlesEndPosition, 1f, Tween.TransitionType.Sine, Tween.EaseType.InOut); buffAnimationTween.Start(); await ToSignal(buffAnimationTween, "tween_completed"); addEnergy.Invoke(GameValues.tweetEnergy); var timer = new Timer { OneShot = true }; AddChild(timer); timer.Start(1); await ToSignal(timer, "timeout"); buffParticles.GetNode <Particles2D>("Particles2D").Emitting = false; timer.Start(1); await ToSignal(timer, "timeout"); buffParticles.QueueFree(); timer.QueueFree(); }
public void setHealth(int health) { assignColor(health); healthBar.Value = health * multiplier; tween.InterpolateProperty(underHealthBar, "value", underHealthBar.Value, health * multiplier, 0.8f, Tween.TransitionType.Sine, Tween.EaseType.InOut, 0.2f); tween.Start(); }
private void OnAnimate(string id) { if (!flyingAway && id == "flap" && sprite.CurrentAnimationFrame % 9 == 4) { Audio.Play("event:/game/general/strawberry_wingflap", Position); flapSpeed = -50f; } int pulseFrame; if (id == "flap") { pulseFrame = 25; } else { pulseFrame = 35; } if (sprite.CurrentAnimationFrame == pulseFrame) { lightTween.Start(); if (!collected && (CollideCheck <FakeWall>() || CollideCheck <Solid>())) { Audio.Play("event:/game/general/strawberry_pulse", Position); SceneAs <Level>().Displacement.AddBurst(Position, 0.6f, 4f, 28f, 0.1f, null, null); return; } Audio.Play("event:/game/general/strawberry_pulse", Position); SceneAs <Level>().Displacement.AddBurst(Position, 0.6f, 4f, 28f, 0.2f, null, null); } }
private void OnPlayer(Player player) { if (SaveData.Instance.Assists.Invincible) { if (_delay <= 0f) { _canMoveNormally = false; float from = Collider.Width; float to = Math.Max(16, (player.Left - Left) - 48f); _tween = Tween.Set(this, Tween.TweenMode.Oneshot, 0.4f, Ease.CubeOut, delegate(Tween t) { AdvanceWall(MathHelper.Lerp(from, to, t.Eased)); }, delegate(Tween t) { _canMoveNormally = true; }); _tween.Start(); _delay = 0.3f; Audio.Play("event:/game/general/assist_screenbottom", player.Position); } } else { player.Die(Vector2.UnitX); } }
public override void Awake(Scene scene) { base.Awake(scene); level = scene as Level; sprite = GFX.SpriteBank.Create(ghost ? "ghostberrySeed" : ((level.Session.Area.Mode == AreaMode.CSide) ? "goldberrySeed" : "strawberrySeed")); sprite.Position = new Vector2(sine.Value * 2f, sine.ValueOverTwo * 1f); Add(sprite); if (ghost) { sprite.Color = Color.White * 0.8f; } int seedCount = Scene.Tracker.CountEntities <GenericStrawberrySeed>(); float offset = 1f - index / (seedCount + 1f); offset = 0.25f + offset * 0.75f; sprite.PlayOffset("idle", offset, false); sprite.OnFrameChange = s => { if (Visible && sprite.CurrentAnimationID == "idle" && sprite.CurrentAnimationFrame == 19) { Audio.Play(SFX.game_gen_seed_pulse, Position, "count", index); lightTween.Start(); level.Displacement.AddBurst(Position, 0.6f, 8f, 20f, 0.2f, null, null); } }; P_Burst.Color = sprite.Color; }
private Speach speach; //this holds the Rhubarb output public async System.Threading.Tasks.Task SpeakAsync(string dialog) //The method is async to wait for the signal { string audioFile = $"res://Speach/{dialog}.wav"; string speachFile = $"res://Speach/{dialog}.json"; //Read the Json file File file = new File(); file.Open(speachFile, File.ModeFlags.Read); var jsonString = file.GetAsText(); file.Close(); speach = Newtonsoft.Json.JsonConvert.DeserializeObject <Speach>(jsonString); //Read the audio file var stream = GD.Load <AudioStreamSample>(audioFile); stream.LoopMode = AudioStreamSample.LoopModeEnum.Disabled; speachPlayer.Stream = stream; speachPlayer.Play(); //Create a tween to call UpdateSpeak, we will pass a delta calculated from zero to speach.Metadata.Duration var tween = new Tween(); AddChild(tween); tween.InterpolateMethod(this, nameof(UpdateSpeak), 0.0f, speach.Metadata.Duration, speach.Metadata.Duration, Tween.TransitionType.Linear, Tween.EaseType.InOut); tween.Start(); //Wait for the tween_completed signal await ToSignal(tween, "tween_completed"); tween.QueueFree(); isSpeaking = false; }