当前位置: 首页>>代码示例>>C#>>正文


C# Projectile.attach_weapon方法代码示例

本文整理汇总了C#中Projectile.attach_weapon方法的典型用法代码示例。如果您正苦于以下问题:C# Projectile.attach_weapon方法的具体用法?C# Projectile.attach_weapon怎么用?C# Projectile.attach_weapon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Projectile的用法示例。


在下文中一共展示了Projectile.attach_weapon方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: bow_attack

        public void bow_attack(Floor fl, ref ContentManager Secondary_cManager, gridCoordinate attack_location, int monsterID, int DoodadID)
        {
            Weapon Bow = null;
            if (main_hand != null && (main_hand.get_my_weapon_type() == Weapon.Type.Bow ||
                                     main_hand.get_my_weapon_type() == Weapon.Type.Crossbow))
                Bow = main_hand;
            else if (off_hand != null && (off_hand.get_my_weapon_type() == Weapon.Type.Bow ||
                                          off_hand.get_my_weapon_type() == Weapon.Type.Crossbow))
                Bow = off_hand;

            gridCoordinate opposition_coord = new gridCoordinate(-1, -1);
            if (monsterID != -1)
                opposition_coord = attack_location;
            else
                opposition_coord = fl.Doodad_by_index(DoodadID).get_g_coord();

            int cbow_xsplash = 0;
            int cbow_ysplash = 0;
            if (opposition_coord.x < my_grid_coord.x)
                cbow_xsplash = -1;
            else if (opposition_coord.x > my_grid_coord.x)
                cbow_xsplash = 1;

            if (opposition_coord.y < my_grid_coord.y)
                cbow_ysplash = -1;
            else if (opposition_coord.y > my_grid_coord.y)
                cbow_ysplash = 1;
            gridCoordinate splash_coord = new gridCoordinate(opposition_coord.x + cbow_xsplash, opposition_coord.y + cbow_ysplash);

            int base_min_dmg_to_monster = Bow.specific_damage_val(false);
            int base_max_dmg_to_monster = Bow.specific_damage_val(true);

            int max_dmg_to_monster = (int)base_max_dmg_to_monster;
            int min_dmg_to_monster = (int)base_min_dmg_to_monster;

            if (is_cbow_equipped() && my_character == Character.Falsael)
            {
                max_dmg_to_monster = (int)Math.Ceiling(base_max_dmg_to_monster * 1.2);
                min_dmg_to_monster = (int)Math.Ceiling(base_min_dmg_to_monster * 1.2);
            }

            if (Bow.get_my_weapon_type() == Weapon.Type.Bow)
            {
                Projectile prj = new Projectile(get_my_grid_C(), opposition_coord, Projectile.projectile_type.Arrow, ref Secondary_cManager, false, Scroll.Atk_Area_Type.singleTile);
                prj.attach_weapon(Bow);
                fl.create_new_projectile(prj);
            }
            else if(Bow.get_my_weapon_type() == Weapon.Type.Crossbow)
            {
                Projectile prj = new Projectile(get_my_grid_C(), opposition_coord, Projectile.projectile_type.Crossbow_Bolt, ref Secondary_cManager, false, Scroll.Atk_Area_Type.smallfixedAOE);
                List<gridCoordinate> crossbow_aoe = new List<gridCoordinate>();
                crossbow_aoe.Add(opposition_coord);
                crossbow_aoe.Add(splash_coord);
                prj.set_small_AOE_matrix(crossbow_aoe);
                prj.attach_weapon(Bow);
                fl.create_new_projectile(prj);
            }

            string attack_msg = "";
            if (monsterID != -1)
                attack_msg = "You attack the " + fl.badguy_by_monster_id(monsterID).my_name + " with your " + Bow.get_my_name() + "!";
            else
                attack_msg = "You attack the " + fl.Doodad_by_index(DoodadID).my_name() + " with your " + Bow.get_my_name() + "!";
            message_buffer.Add(attack_msg);

            total_sound += my_sound_value() + (my_sound_value() / 2);
            total_scent += my_scent_value();

            if (my_class == Chara_Class.Warrior)
            {
                c_energy += 6;
            }
        }
开发者ID:Chupaflor,项目名称:Cronkpit_Samples,代码行数:73,代码来源:Player.cs


注:本文中的Projectile.attach_weapon方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。