コード例 #1
0
        public override void Casting()
        {
            if (CurCastingStage == 0)
            {
                //Tạo art cây súng
                Art newArt = new Art();
                newArt.SrcImage = "Shotgun";
                newArt.SrcRect  = new Rectangle(0, 0, Globals.TileSize, Globals.TileSize);
                newArt.Angle    = Owner.LastDir;
                if (Owner.LastDir == Dir.Up)
                {
                    newArt.Position = new Rectangle(Owner.CurRawPos.X, Owner.CurRawPos.Y - 16, 32, 32);
                    Game.World.BeforeCharArts.Add(newArt);
                }
                else if (Owner.LastDir == Dir.Down || Owner.LastDir == Dir.Stand)
                {
                    newArt.Position = new Rectangle(Owner.CurRawPos.X, Owner.CurRawPos.Y + 16, 32, 32);
                    Game.World.AfterCharArts.Add(newArt);
                }
                else if (Owner.LastDir == Dir.Left)
                {
                    newArt.Position = new Rectangle(Owner.CurRawPos.X - 16, Owner.CurRawPos.Y, 32, 32);
                    Game.World.AfterCharArts.Add(newArt);
                }
                else
                {
                    newArt.Position = new Rectangle(Owner.CurRawPos.X + 16, Owner.CurRawPos.Y, 32, 32);
                    Game.World.AfterCharArts.Add(newArt);
                }
                ArtList.Add(newArt);
            }
            else
            {
                //Tạo missile
                Missile m = new Missile(new TileLayer("1", 1, 0), 32, 32, Owner, this, Owner.CurRawPos, Owner.LastDir, 16, 3, 0);
                Game.World.MissileList.Add(m);
                m = new Missile(new TileLayer("1", 1, 0), 32, 32, Owner, this, Owner.CurRawPos, Owner.LastDir, 16, 3, Math.PI / 6);
                Game.World.MissileList.Add(m);
                m = new Missile(new TileLayer("1", 1, 0), 32, 32, Owner, this, Owner.CurRawPos, Owner.LastDir, 16, 3, -Math.PI / 6);
                Game.World.MissileList.Add(m);
                Owner.IsCasting = false;
            }

            if (CurCastingStage >= CastingStages)
            {
                Finished          = true;
                ArtList[0].remove = true;
                ArtList.Clear();
                Owner.IsCasting = false;
            }
        }
コード例 #2
0
        public override void Casting()
        {
            if (CurCastingStage == 0)
            {
                //Tạo art cây súng
                Art newArt = new Art();
                newArt.SrcImage = "Bow";
                newArt.SrcRect  = new Rectangle(0, 0, Globals.TileSize, Globals.TileSize);
                //newArt.Angle = Game.GetAngleByCharacterFacing(Owner, true, true);
                newArt.Angle = Owner.LastDir;
                if (Owner.LastDir == Dir.Up)
                {
                    newArt.Position = new Rectangle(Owner.CurRawPos.X, Owner.CurRawPos.Y - 12, 32, 32);
                    Game.World.BeforeCharArts.Add(newArt);
                }
                else if (Owner.LastDir == Dir.Down || Owner.LastDir == Dir.Stand)
                {
                    newArt.Position = new Rectangle(Owner.CurRawPos.X, Owner.CurRawPos.Y + 12, 32, 32);
                    Game.World.AfterCharArts.Add(newArt);
                }
                else if (Owner.LastDir == Dir.Left)
                {
                    newArt.Position = new Rectangle(Owner.CurRawPos.X - 12, Owner.CurRawPos.Y, 32, 32);
                    Game.World.AfterCharArts.Add(newArt);
                }
                else
                {
                    newArt.Position = new Rectangle(Owner.CurRawPos.X + 12, Owner.CurRawPos.Y, 32, 32);
                    Game.World.AfterCharArts.Add(newArt);
                }

                ArtList.Add(newArt);
            }
            else
            {
                //Tạo missile
                Missile m = new Missile(new TileLayer("1", 2, 0), 32, 32, Owner, this, Owner.CurRawPos, Owner.LastDir, 12, 10, 0);
                Game.World.MissileList.Add(m);
                Owner.IsCasting = false;
                SoundManager.PlayByFileName("Bow");
            }

            if (CurCastingStage >= CastingStages)
            {
                Finished          = true;
                ArtList[0].remove = true;
                ArtList.Clear();
                Owner.IsCasting = false;
            }
        }
コード例 #3
0
        public override void Casting()
        {
            Owner.AniFrame += 1;

            foreach (Art a in ArtList)
            {
                a.Position.Y   += Globals.TileSize * 2;
                a.SkillCounter += 1;
                if (a.SkillCounter >= 5 && !a.remove)
                {
                    a.remove = true;
                    SoundManager.PlayByFileName("Explosion");
                    Rectangle area = new Rectangle(a.Position.X + 8, a.Position.Y + 8, a.Position.Width - 16, a.Position.Height - 16);

                    Art explosion = new Art();
                    explosion.SrcImage      = "Explosion";
                    explosion.AutoRemove    = true;
                    explosion.Frames        = 7;
                    explosion.FrameInterval = 50;
                    explosion.SrcRect       = new Rectangle(0, 0, Globals.TileSize * 2, Globals.TileSize * 2);
                    explosion.Position      = a.Position;
                    Game.World.AfterCharArts.Add(explosion);

                    List <Character> hitTargets = GamePlay.GetEnemies(area, Team.Enemy);
                    foreach (Character c in hitTargets)
                    {
                        if (GamePlay.CheckHit(Owner, c, this))
                        {
                            GamePlay.InfictDamage(Owner, c, GamePlay.DamageCalculation(Owner, c, this));
                        }
                    }
                }
            }

            if (CurCastingStage % 5 == 0 && CurCastingStage < CastingStages - 10)
            {
                SoundManager.PlayByFileName("ThrowBomb");
                Art newArt = new Art();
                newArt.SrcImage = "Ball";
                newArt.SrcRect  = new Rectangle(0, 0, Globals.TileSize * 4, Globals.TileSize * 4);
                Rectangle loc = new Rectangle(
                    Globals.gen.Next(Game.Player.CurRawPos.X - 3 * Globals.TileSize, Game.Player.CurRawPos.X + Game.Player.charType.Size.X + 2 * Globals.TileSize),
                    Globals.gen.Next(Game.Player.CurRawPos.Y - 3 * Globals.TileSize, Game.Player.CurRawPos.Y + Game.Player.charType.Size.Y + 2 * Globals.TileSize),
                    Globals.TileSize * 4, Globals.TileSize * 4);
                newArt.Position = new Rectangle(loc.X, loc.Y - 10 * Globals.TileSize, loc.Width, loc.Height);
                ArtList.Add(newArt);
                Game.World.AfterCharArts.Add(newArt);
            }

            if (CurCastingStage % 20 == 0)
            {
                SoundManager.PlayByFileName("Laugh");
            }

            if (CurCastingStage >= CastingStages)
            {
                Finished = true;
                foreach (Art a in ArtList)
                {
                    a.remove = true;
                }
                ArtList.Clear();
                Owner.IsCasting = false;
                Owner.charType.Source.srcPos.Y = 0;
            }
        }
コード例 #4
0
        public override void Casting()
        {
            if (CurCastingStage == 1)
            {
                SoundManager.PlayByFileName("Dash");
            }

            if (GamePlay.IsBlocked(Owner, distance, Owner.LastDir))
            {
                CurCastingStage = CastingStages;
            }
            else
            {
                if (Owner.LastDir == Dir.Up)
                {
                    Owner.OffSet.Y -= distance;
                }
                else if (Owner.LastDir == Dir.Down)
                {
                    Owner.OffSet.Y += distance;
                }
                else if (Owner.LastDir == Dir.Left)
                {
                    Owner.OffSet.X -= distance;
                }
                else if (Owner.LastDir == Dir.Right)
                {
                    Owner.OffSet.X += distance;
                }
                Owner.SetPos();
                Owner.AniFrame += 1;

                SetShieldByOwnerPos();

                List <Character> hitTargets = GamePlay.GetEnemies(Owner.HitBox, Owner.team);
                foreach (Character c in hitTargets)
                {
                    if (GamePlay.CheckHit(Owner, c, this) && targetList.Contains(c) == false)
                    {
                        targetList.Add(c);
                        SoundManager.PlayByFileName("Charge");
                        Art slash = new Art();
                        slash.SrcImage      = "Slash";
                        slash.AutoRemove    = true;
                        slash.Frames        = 6;
                        slash.FrameInterval = 30;
                        slash.SrcRect       = new Rectangle(0, 0, Globals.TileSize * 2, Globals.TileSize * 2);
                        slash.Position      = new Rectangle(c.CurRawPos.X - 16, c.CurRawPos.Y - 16, Globals.TileSize * 2, Globals.TileSize * 2);
                        ArtList.Add(slash);
                        Game.World.AfterCharArts.Add(slash);
                        GamePlay.InfictDamage(Owner, c, GamePlay.DamageCalculation(Owner, c, this));
                    }
                }
            }

            if (CurCastingStage >= CastingStages)
            {
                Owner.ResetPos();
                Finished          = true;
                ArtList[0].remove = true;
                ArtList.Clear();
                targetList.Clear();
                Owner.IsCasting = false;
            }
        }