Esempio n. 1
0
        protected override void OnItemBought(ItemBoughtEvent ibe)
        {
            foreach (var s in GetComponent <RoomComponent>().Room.Tagged[Tags.Item])
            {
                if (s is SnekStand st && st != ibe.Stand && st.Item != null)
                {
                    return;
                }
            }

            var d = GetComponent <DialogComponent>();

            d.StartAndClose("snek_6", 3);

            Timer.Add(() => {
                d.StartAndClose("snek_7", 3);

                Timer.Add(() => {
                    AnimationUtil.Poof(Center);
                    Done = true;

                    var stand = new SnekStand();
                    Area.Add(stand);
                    stand.Center = Center;
                    stand.SetItem(Items.CreateAndAdd("bk:snek", Area), this);
                }, 4f);
            }, 4f);
        }
Esempio n. 2
0
        protected override bool Interact(Entity e)
        {
            var c = e.GetComponent <ConsumablesComponent>();

            if (c.Coins < 1)
            {
                AnimationUtil.ActionFailed();
                TextParticle.Add(e, Locale.Get("no_coins"));

                return(true);
            }

            GetComponent <AudioEmitterComponent>().Emit("level_well_coin");

            c.Coins--;

            var keys = DiceStatue.Effects.Keys;
            var key  = keys.ElementAt(Rnd.Int(keys.Count));

            TextParticle.Add(this, Locale.Get(key));

            Timer.Add(() => {
                DiceStatue.Effects[key](this, e);
            }, 1f);

            return(true);
        }
        private void AnimateTwoElementsOnDragComplete(FrameworkElement element1, FrameworkElement element2, double delta, Action completedCallback, bool movingToNextOrPrevious)
        {
            int num = movingToNextOrPrevious ? 200 : 175;
            List <AnimationInfo> animInfoList     = new List <AnimationInfo>();
            TranslateTransform   renderTransform1 = ((UIElement)element1).RenderTransform as TranslateTransform;
            TranslateTransform   renderTransform2 = ((UIElement)element2).RenderTransform as TranslateTransform;

            animInfoList.Add(new AnimationInfo()
            {
                from         = renderTransform1.X,
                to           = renderTransform1.X + delta,
                propertyPath = TranslateTransform.XProperty,
                duration     = num,
                target       = (DependencyObject)renderTransform1,
                easing       = GamesCatalogBannersSlideView.ANIMATION_EASING
            });
            animInfoList.Add(new AnimationInfo()
            {
                from         = renderTransform2.X,
                to           = renderTransform2.X + delta,
                propertyPath = TranslateTransform.XProperty,
                duration     = num,
                target       = (DependencyObject)renderTransform2,
                easing       = GamesCatalogBannersSlideView.ANIMATION_EASING
            });
            int?   startTime = new int?(0);
            Action completed = completedCallback;

            AnimationUtil.AnimateSeveral(animInfoList, startTime, completed);
        }
        protected virtual void RemoveStands()
        {
            var rm = GetComponent <RoomComponent>().Room;

            if (rm == null)
            {
                return;
            }

            GlobalSave.Put("item_stolen", true);
            var it = rm.Tagged[Tags.Item].ToArray();             // Copy it to prevent exceptions while modifying it

            foreach (var s in it)
            {
                if (s is SingleChoiceStand ist)
                {
                    if (s is HealChoiceStand)
                    {
                        AnimationUtil.Poof(ist.Center);
                        ist.Done = true;
                    }
                    else if (ist.Item != null)
                    {
                        var i = ist.Item;
                        ist.SetItem(null, this);
                        i.Done = true;
                        AnimationUtil.Poof(ist.Center);
                    }
                }
            }

            Camera.Instance.Shake(10);
        }
Esempio n. 5
0
        public static void Make(Vector2 where, Area area, float r = Radius)
        {
            foreach (var p in area.Tagged[Tags.Projectile])
            {
                if (p.DistanceTo(where) <= r)
                {
                    ((Projectile)p).Break();
                }
            }

            foreach (var e in area.Tagged[Tags.MustBeKilled])
            {
                if (e.DistanceTo(where) <= r)
                {
                    e.GetAnyComponent <BodyComponent>()?.KnockbackFrom(where, 10f);
                }
            }

            for (var i = 0; i < 10; i++)
            {
                var a = i * 0.1f * Math.PI * 2 + Rnd.Float(-0.1f, 0.1f);
                AnimationUtil.PoofFrom(where + MathUtils.CreateVector(a, r - 8), where);
            }

            for (var i = 0; i < 10; i++)
            {
                var a = Rnd.AnglePI();
                var d = Rnd.Float(r);

                AnimationUtil.PoofFrom(where + MathUtils.CreateVector(a, d), where);
            }

            Camera.Instance.Shake(6);
        }
Esempio n. 6
0
        private void DecibelValue_OnChanged(double percentage)
        {
            double num = 0.7 + percentage * 0.5;
            List <AnimationInfo> animInfoList = new List <AnimationInfo>();

            animInfoList.Add(new AnimationInfo()
            {
                target       = (DependencyObject)this.scaleVolume,
                propertyPath = ScaleTransform.ScaleXProperty,
                from         = this.scaleVolume.ScaleX,
                to           = num,
                duration     = 200
            });
            animInfoList.Add(new AnimationInfo()
            {
                target       = (DependencyObject)this.scaleVolume,
                propertyPath = ScaleTransform.ScaleYProperty,
                from         = this.scaleVolume.ScaleY,
                to           = num,
                duration     = 200
            });
            int?startTime = new int?();

            // ISSUE: variable of the null type

            AnimationUtil.AnimateSeveral(animInfoList, startTime, null);
        }
Esempio n. 7
0
        private void ShowHideCancelOverlay(bool show)
        {
            if (this._isAnimatingCancel)
            {
                return;
            }
            List <AnimationInfo> animInfoList = null;

            if (show && ((UIElement)this.borderCancel).Opacity < 1.0)
            {
                List <AnimationInfo> animationInfoList = new List <AnimationInfo>();
                AnimationInfo        animationInfo     = new AnimationInfo();
                animationInfo.target       = (DependencyObject)this.borderCancel;
                animationInfo.propertyPath = UIElement.OpacityProperty;
                animationInfo.from         = ((UIElement)this.borderCancel).Opacity;
                animationInfo.to           = 1.0;
                CubicEase cubicEase = new CubicEase();
                int       num1      = 0;
                ((EasingFunctionBase)cubicEase).EasingMode = ((EasingMode)num1);
                animationInfo.easing = (IEasingFunction)cubicEase;
                int num2 = 100;
                animationInfo.duration = num2;
                animationInfoList.Add(animationInfo);
                animInfoList = animationInfoList;
            }
            else if (!show && ((UIElement)this.borderCancel).Opacity > 0.0)
            {
                List <AnimationInfo> animationInfoList = new List <AnimationInfo>();
                AnimationInfo        animationInfo     = new AnimationInfo();
                animationInfo.target       = (DependencyObject)this.borderCancel;
                animationInfo.propertyPath = UIElement.OpacityProperty;
                animationInfo.from         = ((UIElement)this.borderCancel).Opacity;
                animationInfo.to           = 0.0;
                CubicEase cubicEase = new CubicEase();
                int       num1      = 0;
                ((EasingFunctionBase)cubicEase).EasingMode = ((EasingMode)num1);
                animationInfo.easing = (IEasingFunction)cubicEase;
                int num2 = 100;
                animationInfo.duration = num2;
                animationInfoList.Add(animationInfo);
                animInfoList = animationInfoList;
            }
            if (animInfoList == null)
            {
                return;
            }
            this._isAnimatingCancel = true;
            AnimationUtil.AnimateSeveral(animInfoList, new int?(), (Action)(() =>
            {
                this._isAnimatingCancel = false;
                if (((UIElement)this.borderCancel).Opacity < 1.0)
                {
                    ((Shape)this.ellipseVolume).Fill = ((Brush)Application.Current.Resources["PhoneBlue300_GrayBlue400Brush"]);
                }
                else
                {
                    ((Shape)this.ellipseVolume).Fill = ((Brush)Application.Current.Resources["PhoneAccentRedBrush"]);
                }
            }));
        }
        private static void Element_Selected(object sender, RoutedEventArgs e)
        {
            var element = (FrameworkElement)sender;

            if (element.GetValue(SelectedShadowColorProperty) is Color selectedShadowColor)
            {
                var effect = GetEffect(element);
                if (effect == null)
                {
                    effect = new DropShadowEffect()
                    {
                        Color         = selectedShadowColor,
                        ShadowDepth   = ShadowHelper.GetShadowDepth(element),
                        Direction     = ShadowHelper.GetDirection(element),
                        BlurRadius    = ShadowHelper.GetBlurRadius(element),
                        Opacity       = 0,
                        RenderingBias = ShadowHelper.GetRenderingBias(element),
                    };
                    AnimationUtil.BeginDoubleAnimation(effect, DropShadowEffect.OpacityProperty, null, ShadowHelper.GetOpacity(element), GlobalSettings.Setting.AnimationDuration);
                    SetEffect(element, effect);
                }
                else
                {
                    AnimationUtil.BeginDoubleAnimation(effect, DropShadowEffect.OpacityProperty, null, ShadowHelper.GetOpacity(element), GlobalSettings.Setting.AnimationDuration);
                    AnimationUtil.BeginColorAnimation(effect, DropShadowEffect.ColorProperty, null, selectedShadowColor, GlobalSettings.Setting.AnimationDuration);
                }
            }
        }
Esempio n. 9
0
 public void HideMenu()
 {
     AnimationUtil.OutToTop(mMenu, duration: 300, animationEnded: () =>
     {
         mDimLayout.Visibility = ViewStates.Gone;
     });
 }
Esempio n. 10
0
            public override void Update(float dt)
            {
                base.Update(dt);

                var dx = Self.DxTo(Self.Owner);
                var dy = Self.DyTo(Self.Owner);
                var d  = MathUtils.Distance(dx, dy);

                if (d > 256)
                {
                    AnimationUtil.Poof(Self.Center);
                    Self.Center = Self.Owner.Center + Rnd.Offset(24);
                    AnimationUtil.Poof(Self.Center);

                    Self.Become <HappyState>();

                    return;
                }

                if (d < 32)
                {
                    Self.Become <HappyState>();
                    return;
                }

                var body = Self.GetComponent <RectBodyComponent>();
                var s    = dt * 20;

                body.Velocity += new Vector2(dx / d * s, dy / d * s);
            }
Esempio n. 11
0
        public override void Use(Entity entity, Item item)
        {
            if (onlyIfHasNone)
            {
                var inventory = entity.GetComponent <InventoryComponent>();

                foreach (var i in inventory.Items)
                {
                    if (ItemPool.Pet.Contains(i.Data.Pools))
                    {
                        return;
                    }
                }
            }

            if (random)
            {
                entity.GetComponent <InventoryComponent>().Pickup(Items.CreateAndAdd(Items.Generate(ItemPool.Pet), entity.Area));
                return;
            }

            var o = PetRegistry.Create(pet, entity);

            if (o == null)
            {
                Log.Error($"Failed to create pet with id {pet}");
                return;
            }

            o.Center = entity.Center + Rnd.Offset(24);
            AnimationUtil.Poof(o.Center, entity.Depth + 1);
        }
Esempio n. 12
0
        public override bool HandleEvent(Event e)
        {
            if (e is ItemTakenEvent)
            {
                Camera.Instance.Shake(8);
                var r = GetComponent <RoomComponent>().Room;

                foreach (var c in r.Controllable)
                {
                    c.TurnOn();
                    AnimationUtil.Poof(c.Center);
                }

                foreach (var n in r.Tagged[Tags.Npc])
                {
                    if (n is OldMan)
                    {
                        n.GetComponent <DialogComponent>().Start("old_man_5");
                        n.RemoveComponent <CloseDialogComponent>();

                        break;
                    }
                }
            }

            return(base.HandleEvent(e));
        }
Esempio n. 13
0
        private void Hide(bool hideFreshNews = false)
        {
            this.UpdateSystemTrayAndAppBarIfNeeded();
            this._isAnimating = true;
            IEasingFunction      ieasingFunction = new QuadraticEase();
            object               yproperty       = TranslateTransform.YProperty;
            List <AnimationInfo> animInfoList    = new List <AnimationInfo>()
            {
                new AnimationInfo()
                {
                    target = (DependencyObject)this._translateHeader, propertyPath = yproperty, from = this._translateHeader.Y, to = this._minOffsetHeader, easing = ieasingFunction, duration = 150
                }
            };

            if (hideFreshNews && this._isFreshNewsShowed)
            {
                animInfoList.Add(new AnimationInfo()
                {
                    target       = this._translateFreshNews,
                    propertyPath = yproperty,
                    from         = this._translateFreshNews.Y,
                    to           = this._minOffsetFreshNews,
                    easing       = ieasingFunction,
                    duration     = 150
                });
            }
            AnimationUtil.AnimateSeveral(animInfoList, new int?(0), (Action)(() =>
            {
                this.UpdateExtraCrop();
                this.UpdateSystemTrayAndAppBarIfNeeded();
                this._isAnimating = false;
            }));
        }
Esempio n. 14
0
        public override bool HandleEvent(Event e)
        {
            if (e is RoomClearedEvent)
            {
                roomsCleared++;

                if (roomsCleared >= numRooms)
                {
                    GetComponent <FollowerComponent>().Pause = 1f;
                    roomsCleared = 0;

                    var a = GetComponent <ZSliceComponent>();

                    Tween.To(0.6f, a.Scale.X, x => a.Scale.X = x, 0.2f);
                    Tween.To(1.6f, a.Scale.Y, x => a.Scale.Y = x, 0.2f).OnEnd = () => {
                        Tween.To(1.8f, a.Scale.X, x => a.Scale.X = x, 0.2f);
                        Tween.To(0.2f, a.Scale.Y, x => a.Scale.Y = x, 0.2f).OnEnd = () => {
                            var item = callback(Area);

                            if (item != null)
                            {
                                item.Center = Center;
                            }

                            AnimationUtil.Poof(Center);

                            Tween.To(1, a.Scale.X, x => a.Scale.X = x, 0.6f);
                            Tween.To(1, a.Scale.Y, x => a.Scale.Y = x, 0.6f);
                        };
                    };
                }
            }

            return(base.HandleEvent(e));
        }
Esempio n. 15
0
        public override void Happen(Player player)
        {
            var list = new List <Room>();

            foreach (var rm in player.Area.Tagged[Tags.Room])
            {
                var room = (Room)rm;

                foreach (var t in types)
                {
                    if (room.Type == t)
                    {
                        list.Add(room);
                        break;
                    }
                }
            }

            if (list.Count == 0)
            {
                return;
            }

            var r = list[Rnd.Int(list.Count)];

            AnimationUtil.TeleportAway(player, () => {
                player.Center = r.GetRandomFreeTile() * 16 + new Vector2(8);
                Camera.Instance.Jump();

                AnimationUtil.TeleportIn(player);
            });
        }
Esempio n. 16
0
        private bool Interact(Entity entity)
        {
            if (Item == null)
            {
                return(true);
            }

            var i = Items.CreateAndAdd(Item, entity.Area);

            if (i != null)
            {
                i.CenterX  = CenterX;
                i.Y        = Bottom;
                i.Scourged = true;
            }

            Item = null;
            UpdateSprite();
            Run.AddScourge(true);

            GetComponent <DialogComponent>().Close();

            AnimationUtil.Poof(Center);
            Camera.Instance.Shake(16);

            // fixme: spawn ghosts, dialog should not appear when player is ded

            return(true);
        }
Esempio n. 17
0
        private void StartSong()
        {
            if (index >= song.Length)
            {
                GetComponent <DialogComponent>().Close();
                return;
            }

            GetComponent <DialogComponent>().Start(song[index], null, () => {
                Timer.Add(() => {
                    StartSong();
                }, 2);

                if (RickRoll)
                {
                    foreach (var item in GetComponent <RoomComponent>().Room.Tagged[Tags.Item])
                    {
                        item.Done = true;
                        AnimationUtil.Poof(item.Center);
                    }
                }
            });

            index++;
        }
Esempio n. 18
0
        public static Player CreatePlayer(Area area, byte index, bool gamepad, Vector2 where)
        {
            InGameState.Multiplayer = true;

            Player p;
            var    input = area.Add(p = new LocalPlayer()).GetComponent <InputComponent>();

            input.Index           = index;
            input.KeyboardEnabled = !gamepad;
            input.GamepadEnabled  = gamepad;

            p.BottomCenter = where;

            var cursor = new Cursor {
                Player = p
            };

            var u = new UiInventory(p, true);

            u.ForceUpdate = true;

            ((InGameState)Engine.Instance.State).Ui.Add(u);
            ((InGameState)Engine.Instance.State).TopUi.Add(cursor);

            p.GetComponent <CursorComponent>().Cursor = cursor;

            AnimationUtil.Poof(where, 1);
            Camera.Instance.Shake(16);

            return(p);
        }
Esempio n. 19
0
        private void HideRecordingEllipse()
        {
            List <AnimationInfo> animInfoList = new List <AnimationInfo>();

            animInfoList.Add(new AnimationInfo()
            {
                target       = (DependencyObject)this.scaleVolume,
                propertyPath = ScaleTransform.ScaleXProperty,
                from         = this.scaleVolume.ScaleX,
                to           = 0.0,
                duration     = 200
            });
            animInfoList.Add(new AnimationInfo()
            {
                target       = (DependencyObject)this.scaleVolume,
                propertyPath = ScaleTransform.ScaleYProperty,
                from         = this.scaleVolume.ScaleY,
                to           = 0.0,
                duration     = 200
            });
            int?startTime = new int?();

            // ISSUE: variable of the null type

            AnimationUtil.AnimateSeveral(animInfoList, startTime, null);
            ((UIElement)this.ellipseRec).Opacity = 0.0;
        }
Esempio n. 20
0
        private void OpenOrClose()
        {
            if (!_isBound)
            {
                return;
            }

            if (IsOpen)
            {
                if (!StaysOpen)
                {
                    Mouse.AddPreviewMouseDownOutsideCapturedElementHandler(this, OnLostMouseCapture);
                    Mouse.Capture(this, CaptureMode.SubTree);
                }
            }
            switch (Placement)
            {
            case DrawerPlacement.Left:
            case DrawerPlacement.Right:
                if (double.IsPositiveInfinity(MaxWidth))
                {
                    return;
                }
                AnimationUtil.BeginDoubleAnimation(this, WidthProperty, double.IsNaN(Width) ? 0 : Width, IsOpen ? (MaxWidth - ShadowHelper.GetBlurRadius(this)) : MinWidth, IsLoaded ? AnimationDuration : TimeSpan.Zero, null, AnimationEase);
                break;

            default:
                if (double.IsPositiveInfinity(MaxHeight))
                {
                    throw new Exception("Drawer.MaxHeight must have a ensured value.");
                }
                AnimationUtil.BeginDoubleAnimation(this, HeightProperty, double.IsNaN(Height) ? 0 : Height, IsOpen ? (MaxHeight - ShadowHelper.GetBlurRadius(this)) : MinHeight, IsLoaded ? AnimationDuration : TimeSpan.Zero, null, AnimationEase);;
                break;
            }
        }
Esempio n. 21
0
        protected override void OnItemBought(ItemBoughtEvent ibe)
        {
            if (open)
            {
                return;
            }

            foreach (var s in GetComponent <RoomComponent>().Room.Tagged[Tags.Item])
            {
                if (s is BoxyStand st && st != ibe.Stand && st.Item != null)
                {
                    return;
                }
            }

            var d = GetComponent <DialogComponent>();

            d.StartAndClose("boxy_9", 3);

            Timer.Add(() => {
                AnimationUtil.Poof(Center);

                GetComponent <DropsComponent>().SpawnDrops();

                open            = true;
                var a           = GetComponent <AnimationComponent>();
                a.Animation.Tag = "open";
                a.Animate();

                Achievements.Unlock("bk:open_up");
            }, 4f);
        }
Esempio n. 22
0
    public AnimationExportData(Transform transform, bool useQuaternion)
    {
        t = transform;

        Animator ator = t.GetComponent <Animator>();

        a = ator.runtimeAnimatorController;

        defaultAnimation = a.animationClips[0];

        AnimationClipCurveData[] data = AnimationUtility.GetAllCurves(defaultAnimation, true);
        properties = new Hashtable();

        foreach (AnimationClipCurveData d in data)
        {
            string jn = AnimationUtil.ExtractPropertyName(d.propertyName);

            if (!properties.ContainsKey(d.path))
            {
                properties.Add(d.path, new AnimationObject(d.path));
            }

            AnimationObject ao = (AnimationObject)properties[d.path];

            AnimationProperty p = new AnimationProperty(jn, d);
            ao.Properties.Add(p);
        }
    }
Esempio n. 23
0
        // Start Borrowing Operations
        private void btnAcceptBorrowingBorrow_Click(object sender, EventArgs e)
        {
            Items = userController.GetItems(false);
            if (selectedBorrowItem != null && selectedBorrowStock != null)
            {
                selectedBorrowItem = Items.FirstOrDefault(x => x.Id.Equals(selectedBorrowItem.Id));
            }
            else
            {
                AnimationUtil.ShowSync(pnlAcceptBorrowingFailAlert);
                return;
            }

            int quantity = Convert.ToInt32(dropBorrowItemCount.selectedValue);

            if (selectedBorrowItem != null && selectedBorrowItem.InStock >= quantity)
            {
                userController.ChargeItem(selectedBorrowItem, selectedBorrowStock, selectedBorrowerUser, quantity);

                Items = userController.GetItems(false);
                ListUtil.InitializeListView(mlvSearchBorrowItem, Items);

                //Borrows = Items.SelectMany(x => x.Borrows).Where(x => x.IsReturn == false).ToList();
                tbcBorrow.SelectedTab = tbpSearchBorrowItem;

                ClearManageBorrowItem();
            }
            else
            {
                AnimationUtil.ShowSync(pnlAcceptBorrowingFailAlert);
            }
            InitializeDetails();
        }
Esempio n. 24
0
        protected override void OnTake(Item item, Entity who)
        {
            base.OnTake(item, who);

            var rm = GetComponent <RoomComponent>().Room;

            if (rm == null)
            {
                return;
            }

            var it = rm.Tagged[Tags.Item].ToArray();             // Copy it to prevent exceptions while modifying it

            foreach (var s in it)
            {
                if (s != this && s is GrannyStand ist && ist.Item != null)
                {
                    ist.Item.Done = true;
                    ist.Done      = true;
                    AnimationUtil.Poof(ist.Center);
                }
            }

            Done = true;
            Camera.Instance.Shake(10);
            Achievements.Unlock("bk:grannys_gift");
        }
Esempio n. 25
0
            public override void Update(float dt)
            {
                base.Update(dt);

                if (!shot && Self.GetComponent <WallAnimationComponent>().Animation.Paused)
                {
                    if (Self.Target == null)
                    {
                        Become <IdleState>();
                        return;
                    }

                    shot = true;

                    var a = Self.GetComponent <WallAnimationComponent>();
                    Self.GetComponent <AudioEmitterComponent>().EmitRandomized("mob_fire_wall");

                    var angle      = Self.Direction.ToAngle();
                    var projectile = Projectile.Make(Self, "small", angle, 5f);

                    projectile.AddLight(32f, Projectile.RedLight);
                    projectile.Center  += MathUtils.CreateVector(angle, 4);
                    projectile.Spectral = true;

                    AnimationUtil.Poof(projectile.Center);

                    a.Scale.X = 1.8f;
                    a.Scale.Y = 0.2f;

                    Tween.To(1, a.Scale.X, x => a.Scale.X = x, 0.4f);
                    Tween.To(1, a.Scale.Y, x => a.Scale.Y = x, 0.4f).OnEnd = () => { Become <IdleState>(); };
                }
            }
Esempio n. 26
0
        private void AnimateTwoElementsOnDragComplete(FrameworkElement element1, FrameworkElement element2, double delta, Action completedCallback, bool movingToNextOrPrevious)
        {
            int num = movingToNextOrPrevious ? 200 : 175;
            List <AnimationInfo> animInfoList        = new List <AnimationInfo>();
            TranslateTransform   translateTransform1 = element1.RenderTransform as TranslateTransform;
            TranslateTransform   translateTransform2 = element2.RenderTransform as TranslateTransform;

            animInfoList.Add(new AnimationInfo()
            {
                from         = translateTransform1.X,
                to           = translateTransform1.X + delta,
                propertyPath = (object)TranslateTransform.XProperty,
                duration     = num,
                target       = (DependencyObject)translateTransform1,
                easing       = SwipeThroughControl.ANIMATION_EASING
            });
            animInfoList.Add(new AnimationInfo()
            {
                from         = translateTransform2.X,
                to           = translateTransform2.X + delta,
                propertyPath = (object)TranslateTransform.XProperty,
                duration     = num,
                target       = (DependencyObject)translateTransform2,
                easing       = SwipeThroughControl.ANIMATION_EASING
            });
            int?   startTime = new int?(0);
            Action completed = completedCallback;

            AnimationUtil.AnimateSeveral(animInfoList, startTime, completed);
        }
Esempio n. 27
0
    //< 해당 스탯이 변경될때마다 호출되는 함수
    void SetupStatProcess()
    {
        // 이동 속도 변경에 따른 처리
        Stats[AbilityType.MOVE_SPEED].FinalValueChanged += (attr) => {
            if (null != Owner.Animation)
            {
                AnimationUtil.SetAnimationSpeed(Owner.Animation, (attr as Attribute).FinalValue / Stats[AbilityType.MOVE_SPEED].Value, GetAnimData(eAnimName.Anim_move).aniName);
            }
        };

        // 최대 체력 증/감에 따른 처리
        Stats[AbilityType.HP].FinalValueChanged += (attr) => {
            int addHp = MaxHp - savedMaxHp;
            if (addHp > 0 && !IsDead)
            {
                Hp += addHp;
            }

            savedMaxHp = MaxHp;
        };

        // 스피드 변경시, 애니메이션 속도 조절되도록 변경
        Stats[AbilityType.ATTACK_SPEED].FinalValueChanged += (attr) =>
        {
            if (null != Owner.Animation)
            {
                AnimationUtil.SetAnimationSpeed(Owner.Animation, (attr as Attribute).FinalValue, GetAttackAnims());
            }
        };
    }
Esempio n. 28
0
        public override bool HandleEvent(Event e)
        {
            if (e is ItemTakenEvent ite && !(ite.Who is ScourgedStand || !(ite.Stand is ScourgedStand)))
            {
                var rm = GetComponent <RoomComponent>().Room;

                if (ite.Stand != this && ite.Stand.GetComponent <RoomComponent>().Room == rm)
                {
                    var it = rm.Tagged[Tags.Item].ToArray();                     // Copy it to prevent exceptions while modifying it

                    foreach (var s in it)
                    {
                        if (s is ScourgedStand ist && ist.Item != null)
                        {
                            var i = ist.Item;
                            ist.SetItem(null, this);
                            i.Done = true;
                            AnimationUtil.Poof(ist.Center);
                        }
                    }

                    Camera.Instance.Shake(10);
                }
            }

            return(base.HandleEvent(e));
        }
Esempio n. 29
0
        protected override void DoAction(Entity entity, Item item, List <Entity> entities)
        {
            var rooms = entity.Area.Tagged[Tags.Room];

            if (rooms.Count < 2)
            {
                return;
            }

            foreach (var e in entities)
            {
                var room    = e.GetComponent <RoomComponent>().Room;
                var newRoom = (Room)Rnd.Element <Entity>(rooms, r => r != room && r is Room rm && rm.Type != RoomType.Granny && rm.Type != RoomType.OldMan && rm.Type != RoomType.Secret && rm.Type != RoomType.Special && rm.Type != RoomType.Hidden);

                if (newRoom != null)
                {
                    AnimationUtil.TeleportAway(e, () => {
                        e.Center = newRoom.GetRandomFreeTile() * 16 + new Vector2(8);
                        Camera.Instance.Jump();
                        AnimationUtil.TeleportIn(e);
                        e.GetComponent <HealthComponent>().Unhittable = false;
                    });

                    entity.GetComponent <AudioEmitterComponent>().EmitRandomized("quck");
                }
            }
        }
Esempio n. 30
0
        public override void Update(float dt)
        {
            base.Update(dt);
            t += dt;

            if (t >= 1f)
            {
                t = 0;

                if (Done)
                {
                    return;
                }

                var r  = GetComponent <RoomComponent>().Room;
                var rm = Owner.GetComponent <RoomComponent>().Room;

                if (r != rm)
                {
                    AnimationUtil.Poof(Center);
                    Center = rm.GetRandomFreeTile() * 16 + new Vector2(8);
                    AnimationUtil.Poof(Center);
                    GetComponent <AnimationComponent>().Animate();
                    OnJump();
                }
            }
        }