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


C# WeaponType类代码示例

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


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


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