コード例 #1
0
ファイル: Raiden.cs プロジェクト: heloman1/WeaponOut
        public override void HoldItem(Player player)
        {
            ModSabres.HoldItemManager(player, item, mod.ProjectileType <RaidenSlash>(),
                                      default(Color), 1f, player.itemTime == 0 ? 0f : 1f, customCharge, 8);

            if (player.itemTime == 0)
            {
                float radius = RaidenUtils.GetFocusRadius(player);

                RaidenUtils.DrawDustRadius(player, radius, RaidenUtils.DustAmount(player));

                if (Main.myPlayer == player.whoAmI)
                {
                    Vector2    mouse   = new Vector2(Main.screenPosition.X + Main.mouseX, Main.screenPosition.Y + Main.mouseY);
                    List <NPC> targets = RaidenUtils.GetTargettableNPCs(player.Center, mouse, radius, RaidenUtils.focusTargets);
                    RaidenUtils.DrawOrderedTargets(player, targets);
                }
            }
        }
コード例 #2
0
ファイル: Raiden.cs プロジェクト: heloman1/WeaponOut
        public override void AI()
        {
            Player player = Main.player[projectile.owner];

            if (ModSabres.AINormalSlash(projectile, SlashLogic))
            {
                FrameCheck += 1f;
                targets     = null;
            }
            else
            {
                // Charged attack
                ModSabres.AISetChargeSlashVariables(player, chargeSlashDirection);
                ModSabres.NormalSlash(projectile, player);

                // Play charged sound & set targets
                if (sndOnce)
                {
                    Vector2 mouse;
                    if (Main.myPlayer == player.whoAmI)
                    {
                        mouse = new Vector2(Main.screenPosition.X + Main.mouseX, Main.screenPosition.Y + Main.mouseY);
                    }
                    else
                    {
                        mouse = player.Center + new Vector2(player.direction * 256);
                    }                                                                // an estimation
                    targets = RaidenUtils.GetTargettableNPCs(player.Center, mouse, RaidenUtils.GetFocusRadius(player), RaidenUtils.focusTargets);
                    if (targets.Count > 0)
                    {
                        Main.PlaySound(SoundID.Item71, projectile.Center); sndOnce = false;


                        // Set up initial ending position as where we started
                        if (player.whoAmI == Main.myPlayer)
                        {
                            endingPositionCenter = player.Center;
                        }

                        // Set ending slash direction
                        if (targets.Last().Center.X > player.Center.X)
                        {
                            player.direction = 1;
                        }
                        else
                        {
                            player.direction = -1;
                        }
                    }
                }

                if (targets != null && targets.Count > 0)
                {
                    ChargeSlashAI(player);
                }
                else
                {
                    SlashLogic = 1;
                    ModSabres.AINormalSlash(projectile, SlashLogic);
                    FrameCheck += 1f;
                    targets     = null;
                }
            }
            projectile.damage = 0;
        }