• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# WeaponType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中WeaponType的典型用法代码示例。如果您正苦于以下问题:C# WeaponType类的具体用法?C# WeaponType怎么用?C# WeaponType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



WeaponType类属于命名空间,在下文中一共展示了WeaponType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: activateWeapon

    public void activateWeapon(WeaponType weapon)
    {
        switch(weapon){
            case WeaponType.NONE:
                equippedWeapon = null;
                break;
            case WeaponType.MINIGUN:
                equippedWeapon = minigunComp;
                break;
            case WeaponType.ROCKET_LAUNCHER:
                equippedWeapon = rocketLauncherComp;
                break;
            case WeaponType.SPIKES:
                equippedWeapon = spikeHandleComp;
                break;
            case WeaponType.MINE_THROWER:
                equippedWeapon = mineThrowerComp;
            break;
        }

        if(equippedWeapon != null)
            equippedWeaponNumber = (int)equippedWeapon.weaponType;
        /*
        if(equippedWeapon != null)
            equippedWeapon.reset();
        */
    }
开发者ID:NoBudgetGames,项目名称:LastIgnition,代码行数:27,代码来源:CarInventory.cs


示例2: Weapon

 public Weapon(WeaponType type, string name, int price, float fireRate)
 {
     FireRate = fireRate;
     Price = price;
     WeaponType = type;
     Name = name;
 }
开发者ID:carlosFPGA,项目名称:resim,代码行数:7,代码来源:Weapon.cs


示例3: SetType

 public void SetType(WeaponType eType)
 {
     // Set the _type
     _type = eType;
     WeaponDefinition def = Main.GetWeaponDefinition(_type);
     GetComponent<Renderer>().material.color = def.projectileColor;
 }
开发者ID:9,项目名称:SpaceSHMUP,代码行数:7,代码来源:Projectile.cs


示例4: Item

        public Item(GraphicsDeviceManager g, ContentManager c, int weapon, Vector2 startLoc, Vector2 playerDim)
        {
            graphics = g;
            content = c;

            dimensions = new Vector2(90, 120);
            loc = new Vector2(startLoc.X - playerDim.X / 2, startLoc.Y - playerDim.Y / 3);

            random = new Random();

            if (weapon == 0)
            {
                LoadContent("Textures/ShortSwordWalk");

                vitality = 0;
                dexterity = 0;
                intelligence = 0;
                strength = 0;

                critBonus = 0;
                critChance = 0;

                minDmg = 1f;
                maxDmg = 5f;

                statType = StatType.str;
                weaponType = WeaponType.slash;

                atkSpd = 1f;
            }

            animation = new SpriteAnimation(8, itemSpriteSheet, .45, new Rectangle((int)loc.X, (int)loc.Y,
                                                                      (int)dimensions.X, (int)dimensions.Y));
        }
开发者ID:Blargansmarf,项目名称:RPGrunner,代码行数:34,代码来源:Item.cs


示例5: UpdateSize

    //Note that there ARE some differences between sword, axe, and hammer calculations
    public void UpdateSize(WeaponType newType, float bladeScale, float handleScale)
    {
        //TODO - make small blade + large handle not horribly broken
        if (newType == WeaponType.SWORD) {

            //The sword handle scale gets a special calculation applied to map the 1-2 scale to a 1-12 scale
            handleTrans.localScale = new Vector3 (DEFAULT_SWORD_HANDLE_SCALE.x, (DEFAULT_SWORD_HANDLE_SCALE.y * (((handleScale - 1.6f) * 6f) + 10f)) + DEFAULT_SWORD_HANDLE_LENGTH_OFFSET, DEFAULT_SWORD_HANDLE_SCALE.z);
            handleTrans.localPosition = DEFAULT_SWORD_HANDLE_POS;

            bladeTrans.localScale = new Vector3 (DEFAULT_SWORD_BLADE_SCALE.x * bladeScale, DEFAULT_SWORD_BLADE_SCALE.y * bladeScale, DEFAULT_SWORD_BLADE_SCALE.z);
            //Weird math to get the blade in the right spot
            bladeTrans.localPosition = new Vector3 (DEFAULT_SWORD_HANDLE_POS.x, handleTrans.localPosition.y + (handleTrans.localScale.y / 2) + (bladeTrans.localScale.y / 2) + DEFAULT_SWORD_BLADE_OFFSET, DEFAULT_SWORD_HANDLE_POS.z);

        } else if (newType == WeaponType.AXE) {

            handleTrans.localScale = new Vector3 (DEFAULT_AXE_HANDLE_SCALE.x, DEFAULT_AXE_HANDLE_SCALE.y * handleScale, DEFAULT_AXE_HANDLE_SCALE.z);
            handleTrans.localPosition = new Vector3 (DEFAULT_AXE_HANDLE_POS.x, DEFAULT_AXE_HANDLE_POS.y * handleScale * .75f, DEFAULT_AXE_HANDLE_POS.z);

            bladeTrans.localScale = new Vector3 (DEFAULT_AXE_BLADE_SCALE.x * bladeScale, DEFAULT_AXE_BLADE_SCALE.y * bladeScale, DEFAULT_AXE_BLADE_SCALE.z);
            //Weird math to get the blade in the right spot
            bladeTrans.localPosition = new Vector3 (DEFAULT_AXE_HANDLE_POS.x, handleTrans.localPosition.y + (handleTrans.localScale.y / 2) - (bladeTrans.localScale.y / 2) + DEFAULT_AXE_BLADE_OFFSET, DEFAULT_AXE_HANDLE_POS.z);

        } else if (newType == WeaponType.HAMMER) {

            handleTrans.localScale = new Vector3 (DEFAULT_HAMMER_HANDLE_SCALE.x, DEFAULT_HAMMER_HANDLE_SCALE.y * handleScale, DEFAULT_HAMMER_HANDLE_SCALE.z);
            handleTrans.localPosition = new Vector3 (DEFAULT_HAMMER_HANDLE_POS.x, DEFAULT_HAMMER_HANDLE_POS.y * handleScale * .75f, DEFAULT_HAMMER_HANDLE_POS.z);

            bladeTrans.localScale = new Vector3 (DEFAULT_HAMMER_BLADE_SCALE.x * bladeScale, DEFAULT_HAMMER_BLADE_SCALE.y * bladeScale, DEFAULT_HAMMER_BLADE_SCALE.z * bladeScale);
            //Weird math to get the blade in the right spot
            bladeTrans.localPosition = new Vector3 (DEFAULT_HAMMER_HANDLE_POS.x, handleTrans.localPosition.y + (handleTrans.localScale.y / 2) - (bladeTrans.localScale.y / 2) + DEFAULT_HAMMER_BLADE_OFFSET, DEFAULT_HAMMER_HANDLE_POS.z);
        }
    }
开发者ID:type1ninja,项目名称:Dwarfnarok,代码行数:33,代码来源:WeaponSize.cs


示例6: DeathInfo

 public DeathInfo(float LastDamage, WeaponType DamageType, SourceType SourceType, Unit Killer = null)
 {
     this.DamageType = DamageType;
     this.LastDamage = LastDamage;
     this.SourceType = SourceType;
     this.Killer = Killer;
 }
开发者ID:Kinderril,项目名称:p3,代码行数:7,代码来源:DeathInfo.cs


示例7: UnlockWeapon

 public void UnlockWeapon(WeaponType type)
 {
     if(!UnlockedWeapons.Contains (type))
     {
         UnlockedWeapons.Add (type);
     }
 }
开发者ID:Meetic666,项目名称:TillDeathDoUsPart,代码行数:7,代码来源:GameData.cs


示例8: Weapon

	// Use this for initialization
	public Weapon(WeaponType Type)
    {
        Weapontype = Type;
        //left?

        Facing = ItemFacing.Left;

        switch (Type)
        { 
            case WeaponType.Axe:
                break;
            case WeaponType.Pistol:
                break;
            case WeaponType.Rifle:
                ItemSprite = GameObject.CreatePrimitive(PrimitiveType.Plane);
                ItemSprite.transform.localScale = new Vector3(-(0.5f / SizeMod), 1.0f, -(0.2f / SizeMod));

                Texture tex = (Texture)UnityEditor.AssetDatabase.LoadAssetAtPath("Assets\\Resources\\Drawings\\Weapons\\rifle.png", typeof(Texture));
                ItemSprite.GetComponent<Renderer>().material = (Material)UnityEditor.AssetDatabase.LoadAssetAtPath("Assets\\Resources\\Drawings\\Weapons\\rifle.mat", typeof(Material));

                ItemSprite.transform.rotation = Quaternion.AngleAxis(TargetAngle, -Vector3.up);

                break;
        }
	}
开发者ID:miintz,项目名称:ParadigmShift,代码行数:26,代码来源:Weapon.cs


示例9: IWeapon

 protected IWeapon(int damage, int durability, WeaponType type, List<Rune> runes)
 {
     this.damage = damage;
             this.durability = this.currentDurability = durability;
             this.type = type;
             this.runes = runes;
 }
开发者ID:BruceRodrigues,项目名称:GameProject,代码行数:7,代码来源:IWeapon.cs


示例10: SetHitPct

 public void SetHitPct(bool hit, WeaponType weapon)
 {
     switch (weapon)
     {
         case WeaponType.Bullet:
             bulletsFired++;
             if(hit)
             {
                 bulletsHit++;
             }
             bulletHitPct = (bulletsHit / bulletsFired) * 100;
             break;
         case WeaponType.Laser:
             lasersFired++;
             if (hit)
             {
                 lasersHit++;
             }
             laserHitPct = (lasersHit / lasersFired) * 100;
             break;
         case WeaponType.Rocket:
             rocketsFired++;
             if (hit)
             {
                 rocketsHit++;
             }
             rocketHitPct = (rocketsHit / rocketsFired) * 100;
             break;
     }
 }
开发者ID:Broghain,项目名称:GTO7,代码行数:30,代码来源:DifficultyManager.cs


示例11: Weapon

 public Weapon(string texturePath, Rectangle rectangle, int speed, int damage, WeaponType type, string name)
     : base(texturePath, rectangle, speed)
 {
     this.WeaponType = type;
     this.Damage = damage;
     this.Name = name;
 }
开发者ID:dajuanrobins,项目名称:MazeGameDemo,代码行数:7,代码来源:Weapon.cs


示例12: initialize

 public void initialize()
 {
     energy = 100;
             weaponLevel = 5;
             weaponType = WeaponType.BARE_HANDS;
             health = 10;
 }
开发者ID:nczempin,项目名称:Turn-the-Corner,代码行数:7,代码来源:CharacterData.cs


示例13: GetWeaponDefinition

    public static WeaponDefinition GetWeaponDefinition( WeaponType wt )
    {
        if (W_DEFS.ContainsKey (wt))
            return W_DEFS [wt];

        return new WeaponDefinition ();
    }
开发者ID:WilliamSellitti,项目名称:SpaceSHMUP,代码行数:7,代码来源:Main.cs


示例14: WeaponBay

 /// <summary>
 /// Create an item for the player or enemy
 /// </summary>
 /// <param name="SlotType">What type of slot this item uses</param>
 /// <param name="Location">The location of this slot, relative to the user</param>
 /// <param name="WeaponType">What type of weapon this item is</param>
 public WeaponBay(Vector2 Location, Boolean PlayerOwned, WeaponType WeaponType, Vector2 Direction, Texture2D ProjectileTexture)
     : base(SlotType.WeaponBay, Location, PlayerOwned)
 {
     wtWeaponType = WeaponType;
     v2Direction = Direction;
     t2dProjectile = ProjectileTexture;
 }
开发者ID:Lyise,项目名称:SARP,代码行数:13,代码来源:WeaponBay.cs


示例15: GetAmmo

        public float GetAmmo(WeaponType offset)
        {
            // proc not running?
            if(CanRead && _baseAddress > 0)
            {
                return 0f;
            }

            var bytesRead = 0;

            // yo dawg I heard you like pointers so I'mma point to these pointers that
            // point to pointers, get the point(ers)?
            if(!_finalLocations.ContainsKey(offset))
            {
                byte[] p1a = _bl2.ReadMemory(_baseAddress + BASE_OFFSET, 4, out bytesRead);
                int p1v = BitConverter.ToInt32(p1a, 0);

                byte[] p2a = _bl2.ReadMemory(p1v + 0x2c, 4, out bytesRead);
                int p2v = BitConverter.ToInt32(p2a, 0);

                byte[] p3a = _bl2.ReadMemory(p2v + (int)offset, 4, out bytesRead);
                int p3v = BitConverter.ToInt32(p3a, 0);

                // lets cache the actual ammo location so we're not doing this every time we check for ammo
                _finalLocations[offset] = p3v;
            }

            byte[] ammo = _bl2.ReadMemory(_finalLocations[offset] + 0x6c, 4, out bytesRead);
            return BitConverter.ToSingle(ammo, 0);
        }
开发者ID:strider-,项目名称:Borderlands2Demo,代码行数:30,代码来源:Borderlands2AmmoReader.cs


示例16: Creature

    // public int speed = 0;
    public Creature(World world, int location_x, int location_y, float hp, ArmorType armor, WeaponType weapon,
		float atk, float def, int area, int movement, int range = 1)
        : base(world, location_x, location_y, hp, area, movement)
    {
        Armor = armor;
        Weapon = weapon;
        Range = range;
        // Units = unit;

        // Here speed is treated as priority for attacking. The party has higher speed attacks first.
        // Here we calcuate speed bonus for Armors.
        if (Armor == ArmorType.Cloth)
            Speed += 10;
        else if (Armor == ArmorType.Leather)
            Speed += 8;
        else if (Armor == ArmorType.Wooden)
            Speed += 6;
        else if (Armor == ArmorType.Mail)
            Speed += 4;
        else if (Armor == ArmorType.Plate)
            Speed += 3;

        // Here we calcuate speed bonus for Weapons.
        if (Weapon == WeaponType.Light)
            Speed += 6;
        else if (Weapon == WeaponType.Piercing)
            Speed += 4;
        else if (Weapon == WeaponType.Heavy)
            Speed += 2;
        else if (Weapon == WeaponType.Energy)
            Speed += 3;

        Def = def + (int)Armor;
        Atk = atk;
    }
开发者ID:12xq4,项目名称:EverConquestALand,代码行数:36,代码来源:Creature.cs


示例17: getModifier

    public static int getModifier(WeaponType weaponType, EnemyType enemyType)
    {
        if (weaponType == WeaponType.BARE_HANDS) {
                        if (enemyType == EnemyType.Spider) {
                                return 1;
                        } else if (enemyType == EnemyType.Zombie) {
                                return -1;
                        } else {
                                return 0;
                        }
                } else if (weaponType == WeaponType.STAFF) {
                        if (enemyType == EnemyType.Spider) {
                                return -1;
                        } else if (enemyType == EnemyType.Zombie) {
                                return 0;
                        } else {
                                return 1;
                        }
                } else if (weaponType == WeaponType.SWORD) {
                        if (enemyType == EnemyType.Spider) {
                                return 0;
                        } else if (enemyType == EnemyType.Zombie) {
                                return 1;
                        } else {
                                return -1;
                        }
                } else {
                        return 0;

                }
    }
开发者ID:nczempin,项目名称:Turn-the-Corner,代码行数:31,代码来源:Combat.cs


示例18: Weapon

 public Weapon(string _name, DmgType _dmgType, int _physDmgAmt, EleDmgType _eleDmgType, int _eleDmgAmt, int _range) : base()
 {
     Name = _name;
     Id = (double)UnityEngine.Random.Range(0, 1000000000);
     Range = _range;
     EleDmgAmt = _eleDmgAmt;
     PhysDmgAmt = _physDmgAmt;
     PhysDmg = _dmgType;
     EleDmg = _eleDmgType;
     if (Range < 2)
     {
         WeapType = WeaponType.Low;
     }
     else if (Range < 4)
     {
         WeapType = WeaponType.Medium;
     }
     else if (Range < 10)
     {
         WeapType = WeaponType.High;
     }
     else if (Range < 30)
     {
         WeapType = WeaponType.RLow;
     }
     else
     {
         WeapType = WeaponType.RHigh;
     }
     Id = Database.WeaponDbInsert(this);
 }
开发者ID:pShusta,项目名称:TheFellnightPrison,代码行数:31,代码来源:Weapon.cs


示例19: UpdateStats

    public void UpdateStats(WeaponType newType = WeaponType.AXE, float newHandleLength = 1.0f, float newHeadSize = 1.0f)
    {
        type = newType;
        handleLength = newHandleLength;
        headSize = newHeadSize;

        //TODO - balance these?
        //DPS is identical on all weapons, but bigger weapons also get larger knockback and reach, so...
        damageMod = headSize * handleLength;
        knockbackMod = headSize * handleLength;
        attackTime = headSize * handleLength;

        switch (type) {
        case WeaponType.AXE:
            damageMod *= GLOBAL_AXE_DAMAGE_MOD;
            knockbackMod *= GLOBAL_AXE_KNOCKBACK_MOD;
            attackTime *= GLOBAL_AXE_ATTACK_TIME_MOD;
            break;
        case WeaponType.HAMMER:
            damageMod *= GLOBAL_HAMMER_DAMAGE_MOD;
            knockbackMod *= GLOBAL_HAMMER_KNOCKBACK_MOD;
            attackTime *= GLOBAL_HAMMER_ATTACK_TIME_MOD;
            break;
        //Other weapons default to sword stats
        default:
            damageMod *= GLOBAL_SWORD_DAMAGE_MOD;
            knockbackMod *= GLOBAL_SWORD_KNOCKBACK_MOD;
            attackTime *= GLOBAL_SWORD_ATTACK_TIME_MOD;
            break;
        }
    }
开发者ID:type1ninja,项目名称:Dwarfnarok,代码行数:31,代码来源:Weapon.cs


示例20: CreateWeapon

        public static Weapon CreateWeapon(WeaponType weaponType, float ammoMultiplier)
        {
            switch (weaponType)
            {
                case WeaponType.AssaultRifle:
                    return new AssaultRifle();

                case WeaponType.Shotgun:
                    return new Shotgun(ammoMultiplier);

                case WeaponType.RocketLauncher:
                    return new RocketLauncher(ammoMultiplier);

                case WeaponType.Laser:
                    return new Laser(ammoMultiplier);

                case WeaponType.Minigun:
                    return new Minigun(ammoMultiplier);

                case WeaponType.Bouncer:
                    return new Bouncer(ammoMultiplier);

                case WeaponType.Flamethrower:
                    return new Flamethrower(ammoMultiplier);

                case WeaponType.Waterblaster:
                    return new Waterthrower(ammoMultiplier);

                default:
                    throw new ArgumentOutOfRangeException("weaponType");
            }
        }
开发者ID:JaakkoLipsanen,项目名称:Skypiea,代码行数:32,代码来源:WeaponFactory.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# WearableType类代码示例发布时间:2022-05-24
下一篇:
C# WeaponQuality类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap