本文整理汇总了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();
*/
}
示例2: Weapon
public Weapon(WeaponType type, string name, int price, float fireRate)
{
FireRate = fireRate;
Price = price;
WeaponType = type;
Name = name;
}
示例3: SetType
public void SetType(WeaponType eType)
{
// Set the _type
_type = eType;
WeaponDefinition def = Main.GetWeaponDefinition(_type);
GetComponent<Renderer>().material.color = def.projectileColor;
}
示例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));
}
示例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);
}
}
示例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;
}
示例7: UnlockWeapon
public void UnlockWeapon(WeaponType type)
{
if(!UnlockedWeapons.Contains (type))
{
UnlockedWeapons.Add (type);
}
}
示例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;
}
}
示例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;
}
示例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;
}
}
示例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;
}
示例12: initialize
public void initialize()
{
energy = 100;
weaponLevel = 5;
weaponType = WeaponType.BARE_HANDS;
health = 10;
}
示例13: GetWeaponDefinition
public static WeaponDefinition GetWeaponDefinition( WeaponType wt )
{
if (W_DEFS.ContainsKey (wt))
return W_DEFS [wt];
return new WeaponDefinition ();
}
示例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;
}
示例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);
}