Пример #1
0
        private static IEnumerator<bool> LinearLaserOption(PlayerOption option, OptionInitializationInformation info)
        {
            var s = false;
            var ps = false;
            var la = false;
            PlayerLinearLaser ls = null;

            while (true)
            {
                s = option.Parent.IsShottableTiming;
                if (!ps && s)
                {
                    la = true;
                    ls = new PlayerLinearLaser(option, LinearLaserMarisaStyle, 8, CommonObjects.ImageLaser8)
                    {
                        Angle = GetAngle(info.Direction) ?? 0,
                        X = option.X,
                        Y = option.Y
                    };
                    option.ParentManager.Add(ls, (int)GameLayer.PlayerBullet);
                }
                if (ps && !s)
                {
                    la = false;
                    ls.AddSubOperation(LaserThrowAway(ls.Angle, 20));
                }
                if (la)
                {
                    ls.X = option.X;
                    ls.Y = option.Y;
                }
                ps = s;
                yield return true;
            }
        }
Пример #2
0
 public OptionSelectionInformation()
 {
     Name = "";
     Description = "";
     ActualUserValues = new OptionSelectionValue[3];
     ModeStrings = new List<string>();
     UserValueDescription = new Dictionary<OptionSelectionValue, string>();
     DefaultValue = new OptionInitializationInformation();
 }
Пример #3
0
        private static IEnumerator<bool> FavoriteSniperOption(PlayerOption option, OptionInitializationInformation info)
        {
            EnemyUser ptl = null;
            PlayerInputButton pb = 0;
            while (true)
            {
                var tl = option.ParentManager.OfType<EnemyUser>()
                .Where(p => p.SourceStatus.RetweetedStatus == null)
                .OrderBy(p =>
                {
                    var x = p.X - option.X;
                    var y = p.Y - option.Y;
                    return Math.Sqrt(x * x + y * y);
                }).FirstOrDefault();
                if (tl != null)
                {
                    tl.ScaleX = 1.3;
                    tl.ScaleY = 1.3;
                }
                if (ptl != null && tl != ptl)
                {
                    ptl.ScaleX = 1.0;
                    ptl.ScaleY = 1.0;
                }
                var b = option.Parent.CurrentInput.Button;
                if ((b & PlayerInputButton.Shot) != 0 && (pb & PlayerInputButton.Shot) == 0)
                {
                    //一撃死じゃなきゃマズイだろ!?
                    option.Game.TwitterTokens.Favorites.CreateAsync(id => tl.SourceStatus.Id);
                    foreach (var i in option.ParentManager
                        .OfType<EnemyUser>()
                        .Where(p => p.SourceStatus.Id == tl.SourceStatus.Id))
                    {
                        i.Damage(i.TotalHealth);
                    }
                }

                ptl = tl;
                pb = b;
                yield return true;
            }
        }
Пример #4
0
        private static IEnumerator<bool> GradiusLaserOption(PlayerOption option, OptionInitializationInformation info)
        {
            var sbc = 0;
            var sb = new Point[30];

            var sp = Point.FromDisplayObject(option.Parent);
            var threshold = info.UserDoubleValue1;
            var pp = sp;
            for (int i = 0; i < sb.Length; i++) sb[i] = sp;

            while (true)
            {
                option.PreventParentOperation();
                var np = Point.FromDisplayObject(option.Parent);
                if (pp.DistanceTo(np) >= threshold)
                {
                    sb[(sbc++) % sb.Length] = np;
                    option.ApplyPosition(sb[(sbc + sb.Length + 1) % sb.Length]);
                }
                pp = np;
                yield return true;
            }
        }
Пример #5
0
        private static IEnumerator<bool> StringAdvertisementOption(PlayerOption option, OptionInitializationInformation info)
        {
            var cv = info.UserStringValue2.Split(',').Select(p => Convert.ToInt32(p)).ToArray();

            var ss = new StringSprite(CommonObjects.FontSystemMedium, DX.GetColor(cv[0], cv[1], cv[2])) { Value = info.UserStringValue1 };
            option.ParentManager.Add(ss, (int)GameLayer.Player);

            while (true)
            {
                ss.X = option.X;
                ss.Y = option.Y;
                yield return true;
            }
        }
Пример #6
0
 public static IEnumerator<bool> NoneOption(PlayerOption option, OptionInitializationInformation info)
 {
     while (true) yield return true;
 }
Пример #7
0
 private static IEnumerator<bool> HomingShotOption(PlayerOption option, OptionInitializationInformation info)
 {
     while (true)
     {
         if (option.Parent.IsTriggerShottableTiming)
         {
             option.ParentManager.Add(
                 new PlayerImageBullet(option, Homing(), CommonObjects.ImageShotArrow, option.Information.UserInformation.ShotStrength / 2)
                 {
                     X = option.X,
                     Y = option.Y,
                     Angle = GetAngle(info.Direction) ?? -Math.PI / 2.0,
                     HomeX = 6,
                     HomeY = 12,
                     CollisionRadius = 6
                 },
                 (int)GameLayer.PlayerBullet);
         }
         yield return true;
     }
 }
Пример #8
0
 private static IEnumerator<bool> FollwingAttackOption(PlayerOption option, OptionInitializationInformation info)
 {
     bool tg = false;
     EnemyUser target = null;
     var tl = option.ParentManager.OfType<EnemyUser>()
         .Where(p =>
         {
             var x = p.X - option.X;
             var y = p.Y - option.Y;
             return Math.Sqrt(x * x + y * y) <= 200;
         });
     while (true)
     {
         target = tl.FirstOrDefault();
         if (target == null && tg)
         {
             tg = false;
             var sx = option.X;
             var sy = option.Y;
             for (int i = 0; i < 30; i++)
             {
                 option.PreventParentOperation();
                 option.X = Easing.OutQuad(i, 30, sx, option.Parent.X - sx);
                 option.Y = Easing.OutQuad(i, 30, sy, option.Parent.Y - sy);
                 yield return true;
             }
         }
         else if (!tg && target != null)
         {
             tg = true;
             while (target != null)
             {
                 var sx = option.X;
                 var sy = option.Y;
                 //同じ敵から同時に帰ってくると見栄えしないのでランダム
                 var rw = rnd.Next(10);
                 for (int i = 0; i < rw; i++)
                 {
                     option.PreventParentOperation();
                     yield return true;
                 }
                 for (int i = 0; i < 30; i++)
                 {
                     option.PreventParentOperation();
                     option.X = Easing.OutQuad(i, 30, sx, target.X - sx);
                     option.Y = Easing.OutQuad(i, 30, sy, target.Y - sy);
                     yield return true;
                 }
                 while (!target.IsDead)
                 {
                     option.PreventParentOperation();
                     option.X = target.X;
                     option.Y = target.Y;
                     target.Damage(100);
                     yield return true;
                 }
                 tl = option.ParentManager.OfType<EnemyUser>()
                 .Where(p =>
                 {
                     var x = p.X - option.X;
                     var y = p.Y - option.Y;
                     return Math.Sqrt(x * x + y * y) <= 200;
                 });
                 target = tl.FirstOrDefault();
             }
         }
         else
         {
             yield return true;
         }
     }
 }