Exemplo n.º 1
0
        public IEnumerator <YieldInstruction> ProcessEndAnim(Character user, Character target, BattleData data)
        {
            //trigger animations of target
            if (data.HitCharAnim != 0)
            {
                StaticCharAnimation charAnim = CharAnimation.GetCharAnim(data.HitCharAnim);
                charAnim.AnimLoc = target.CharLoc;
                charAnim.CharDir = target.CharDir;
                yield return(CoroutineManager.Instance.StartCoroutine(target.StartAnim(charAnim)));
            }


            //play battle FX
            foreach (BattleFX fx in data.IntroFX)
            {
                yield return(CoroutineManager.Instance.StartCoroutine(ProcessBattleFX(user, target, fx)));
            }

            //play sound
            GameManager.Instance.BattleSE(data.HitFX.Sound);
            //the animation
            FiniteEmitter endEmitter = (FiniteEmitter)data.HitFX.Emitter.Clone();

            endEmitter.SetupEmit(target.MapLoc, user.MapLoc, target.CharDir);
            CreateAnim(endEmitter, DrawLayer.NoDraw);
            SetScreenShake(new ScreenMover(data.HitFX.ScreenMovement));
            yield return(new WaitForFrames(GameManager.Instance.ModifyBattleSpeed(data.HitFX.Delay, target.CharLoc)));
        }
Exemplo n.º 2
0
        public IEnumerator <YieldInstruction> ReleaseExplosion(Loc tile, Character user, DungeonScene.HitboxEffect effect, DungeonScene.HitboxEffect hitEffect)
        {
            foreach (BattleFX fx in IntroFX)
            {
                //play sound
                GameManager.Instance.BattleSE(fx.Sound);
                //the animation
                FiniteEmitter fxEmitter = (FiniteEmitter)fx.Emitter.Clone();
                fxEmitter.SetupEmit(tile * GraphicsManager.TileSize, user.MapLoc, user.CharDir);
                DungeonScene.Instance.CreateAnim(fxEmitter, DrawLayer.NoDraw);
                DungeonScene.Instance.SetScreenShake(new ScreenMover(fx.ScreenMovement));
                yield return(new WaitForFrames(GameManager.Instance.ModifyBattleSpeed(fx.Delay, tile)));
            }

            GameManager.Instance.BattleSE(ExplodeFX.Sound);
            FiniteEmitter emitter = (FiniteEmitter)ExplodeFX.Emitter.Clone();

            emitter.SetupEmit(tile * GraphicsManager.TileSize, user.MapLoc, user.CharDir);
            DungeonScene.Instance.CreateAnim(emitter, DrawLayer.NoDraw);
            DungeonScene.Instance.SetScreenShake(new ScreenMover(ExplodeFX.ScreenMovement));

            yield return(CoroutineManager.Instance.StartCoroutine(DungeonScene.Instance.ReleaseHitboxes(user,
                                                                                                        new CircleSquareHitbox(user, TargetAlignments, HitTiles, TileAlignment.None, tile, TileEmitter, Emitter, Range, Speed, ExplodeFX.Delay, Hitbox.AreaLimit.Full, user.CharDir),
                                                                                                        effect, hitEffect)));
        }
Exemplo n.º 3
0
        //===================================
        //  VFX
        //===================================



        /// <summary>
        /// Plays a VFX
        /// </summary>
        /// <param name="chara"></param>
        /// <param name="anim"></param>
        public void PlayVFX(FiniteEmitter emitter, int x, int y, Dir8 dir = Dir8.Down, int xTo = -1, int yTo = -1)
        {
            FiniteEmitter endEmitter = (FiniteEmitter)emitter.Clone();
            Loc           endLoc     = (x > -1) ? new Loc(x, y) : Loc.Zero;

            endEmitter.SetupEmit(new Loc(x, y), endLoc, dir);
            GroundScene.Instance.CreateAnim(endEmitter, DrawLayer.NoDraw);
        }
Exemplo n.º 4
0
 public StaticHitbox(Character user, Alignment targetAlignments, bool hitTiles, TileAlignment burstTiles, Loc origin, FiniteEmitter tileEmitter, FiniteEmitter emitter, int delay)
     : base(user, origin * GraphicsManager.TileSize, tileEmitter, delay)
 {
     TargetAlignments = targetAlignments;
     HitTiles         = hitTiles;
     BurstTiles       = burstTiles;
     Origin           = origin;
     Emitter          = (FiniteEmitter)emitter.Clone();
     Emitter.SetupEmit(MapLoc, user.MapLoc, user.CharDir);
 }
Exemplo n.º 5
0
        public IEnumerator <YieldInstruction> ProcessBattleFX(Loc userLoc, Loc targetLoc, Dir8 userDir, BattleFX fx)
        {
            //play sound
            GameManager.Instance.BattleSE(fx.Sound);
            //the animation
            FiniteEmitter fxEmitter = (FiniteEmitter)fx.Emitter.Clone();

            fxEmitter.SetupEmit(targetLoc * GraphicsManager.TileSize, userLoc * GraphicsManager.TileSize, userDir);
            CreateAnim(fxEmitter, DrawLayer.NoDraw);
            SetScreenShake(new ScreenMover(fx.ScreenMovement));
            yield return(new WaitForFrames(GameManager.Instance.ModifyBattleSpeed(fx.Delay, targetLoc)));
        }
Exemplo n.º 6
0
        public virtual void Update(FrameTick elapsedTime)
        {
            time += elapsedTime;

            while (TilesToEmit.Count > 0 && time >= TilesToEmit.FrontPriority())
            {
                int priority = TilesToEmit.FrontPriority();
                Loc tile     = TilesToEmit.Dequeue();

                FiniteEmitter tileEmitter = (FiniteEmitter)TileEmitter.Clone();
                tileEmitter.SetupEmit(tile * GraphicsManager.TileSize, User.MapLoc, User.CharDir);
                DungeonScene.Instance.CreateAnim(tileEmitter, DrawLayer.NoDraw);
            }
        }
Exemplo n.º 7
0
        public override IEnumerator <YieldInstruction> Apply(GameEventOwner owner, Character ownerChar, BattleContext context)
        {
            if (context.ContextStates.Contains <Redirected>())
            {
                yield break;
            }

            if (context.ActionType == BattleActionType.Trap || context.ActionType == BattleActionType.Item)
            {
                yield break;
            }

            //must be a status move
            if (context.Data.Category != BattleData.SkillCategory.Status)
            {
                yield break;
            }

            //attacker must be target
            if (context.User != context.Target)
            {
                yield break;
            }


            GameManager.Instance.BattleSE(Sound);
            if (!ownerChar.Unidentifiable)
            {
                FiniteEmitter endEmitter = (FiniteEmitter)Emitter.Clone();
                endEmitter.SetupEmit(ownerChar.MapLoc, ownerChar.MapLoc, ownerChar.CharDir);
                DungeonScene.Instance.CreateAnim(endEmitter, DrawLayer.NoDraw);
            }

            CharAnimAction SpinAnim = new CharAnimAction(ownerChar.CharLoc, (context.Target.CharLoc - ownerChar.CharLoc).ApproximateDir8(), 05);//Attack

            SpinAnim.MajorAnim = true;

            yield return(CoroutineManager.Instance.StartCoroutine(ownerChar.StartAnim(SpinAnim)));

            yield return(new WaitWhile(ownerChar.OccupiedwithAction));

            DungeonScene.Instance.LogMsg(String.Format(new StringKey("MSG_SNATCH").ToLocal(), ownerChar.GetDisplayName(false)));
            context.Target = ownerChar;
            context.ContextStates.Set(new Redirected());
        }