From 6afcde1f98663ecb69224095dba8b475ecbd36de Mon Sep 17 00:00:00 2001 From: Rendo Date: Wed, 30 Jul 2025 01:02:31 +0500 Subject: [PATCH] oops --- scripts/systems/effects/RedirectEffect.cs | 29 ++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/scripts/systems/effects/RedirectEffect.cs b/scripts/systems/effects/RedirectEffect.cs index b53ba58..588d2bf 100644 --- a/scripts/systems/effects/RedirectEffect.cs +++ b/scripts/systems/effects/RedirectEffect.cs @@ -13,8 +13,35 @@ public partial class RedirectEffect : Effect public override void Enter(Entity target) { if (target is RuntimeZombieData zombieData) + { zombieData.AbleToEat = false; - //Animation call + //Animation call + int mult; + if ((int)zombieData.GlobalPosition.Y / FieldParams.TileHeight <= 2) + { + mult = 1; + } + else if ((int)zombieData.GlobalPosition.Y / FieldParams.TileHeight >= 6) + { + mult = -1; + } + else + { + if (down) + { + mult = 1; + } + else + { + mult = -1; + } + } + zombieData.AbleToEat = false; + var tween = zombieData.CreateTweenEffect(this); + tween.TweenProperty(zombieData, "position:y", zombieData.GlobalPosition.Y + FieldParams.TileHeight * mult, Duration); + tween.Parallel().TweenProperty(zombieData, "position:x", zombieData.GlobalPosition.X - FieldParams.TileHeight * tilesWalked, Duration); + tween.TweenCallback(Callable.From(() => { zombieData.AbleToEat = true; })); + } } public override void Exit(Entity target)