本文整理汇总了C#中IWeapon类的典型用法代码示例。如果您正苦于以下问题:C# IWeapon类的具体用法?C# IWeapon怎么用?C# IWeapon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IWeapon类属于命名空间,在下文中一共展示了IWeapon类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Awake
void Awake()
{
weaponPool = new GameObjectPool(projectile, maximumSize, initialSize, transform);
impactPool = new GameObjectPool(impact, -1, initialSize / 2, transform);
WeaponManager.Register(this);
weapon = projectile.GetComponent<IWeapon>();
}
示例2: CombatantsCreatedThruFactoryCanAttack
public void CombatantsCreatedThruFactoryCanAttack()
{
// Setup our stub.
this.stubWeapon = MockRepository.GenerateStub<IWeapon>();
this.equipmentFactory.Stub(x => x.EquipCombatant(null)).IgnoreArguments().Do(
new EquipCombatant(this.StubEquipCombatant));
this.equipmentFactory.Replay();
this.stubWeapon.Expect(x => x.CalculateDamage()).Return(10);
this.stubWeapon.Expect(x => x.CalculateDamage()).Return(10);
// Get our combatants.
string knightName = "My Knight";
var knight = combatantFactory.CreateCombatant<Knight>(knightName);
string randomCombatantName = "My Random Combatant";
var randomCombatant = combatantFactory.CreateRandomCombatant(randomCombatantName);
int catapultHealth = randomCombatant.Health;
int knightHealth = knight.Health;
randomCombatant.Attack(knight);
knight.Attack(randomCombatant);
this.equipmentFactory.VerifyAllExpectations();
this.stubWeapon.VerifyAllExpectations();
Assert.AreNotEqual(catapultHealth, randomCombatant.Health);
Assert.AreNotEqual(knightHealth, knight.Health);
}
示例3: ChangeWeapon
public void ChangeWeapon(IWeapon newWeapon, List<Character> selectedNames)
{
foreach (Character character in selectedNames)
{
character.weapon = newWeapon;
}
}
示例4: FightWithDefaultContext
public void FightWithDefaultContext(IWeapon weapon1, IWeapon weapon2)
{
// Assert
weapon1.Should().BeSameAs (weapon2);
weapon1.Should().BeSameAs (_weapon1);
weapon1.Should().NotBeSameAs (_weapon2);
}
示例5: ForgedWeapon
// These two constructors are indicative of a needed abstraction.
public ForgedWeapon(IWeapon weapon, IMaterialComponent component)
{
GivenName = weapon.GivenName;
Damage = weapon.Damage;
CriticalDamage = weapon.CriticalDamage;
DamageType = weapon.DamageType;
MaxRange = weapon.MaxRange;
Proficiency = weapon.Proficiency;
RangeIncrement = weapon.RangeIncrement;
ThreatRange = weapon.ThreatRange;
ThreatRangeLowerBound = weapon.ThreatRangeLowerBound;
WeaponCategory = weapon.WeaponCategory;
WeaponName = string.Format("{0} {1}", component.ComponentName, weapon.WeaponName);
WeaponSize = weapon.WeaponSize;
WeaponSubCategory = weapon.WeaponSubCategory;
WeaponUse = weapon.WeaponUse;
Hardness = weapon.Hardness;
HitPoints = weapon.HitPoints;
IsBow = weapon.IsBow;
Weight = component.ApplyWeightModifer(weapon);
ToHitModifier = component.ApplyToHitModifier();
WeaponCost = component.ApplyCostModifier(weapon);
SpecialInfo = component.AppendSpecialInfo(weapon);
IsMasterwork = component.VerifyMasterwork(weapon);
DamageBonus = component.ApplyDamageModifier(weapon);
ComponentName = component.ComponentName;
AdditionalEnchantmentCost = component.GetAdditionalEnchantmentCost();
}
示例6: ApplyDamage
public void ApplyDamage(int _damage, IWeapon _weapon, Creature _source)
{
var fact = Math.Min(_damage, HP);
if (!(Creature is Avatar))
{
HP -= _damage;
}
Creature.DamageTaken(this, _source, _weapon, _damage);
fact -= Creature[0, 0].AddSplatter(fact, FColor.Crimson);
if (fact > 0)
{
var ro = World.Rnd.NextDouble() * Math.PI * 2;
var x = (int)(Math.Sin(ro) * 20f);
var y = (int)(Math.Cos(ro) * 20f);
new SplatterDropper(Creature.GeoInfo.Layer, Creature[0, 0], fact, FColor.Crimson, Creature[x, y]);
}
if (HP <= 0)
{
MessageManager.SendXMessage(this, new XMessage(EALTurnMessage.CREATURE_KILLED, _source, Creature));
Creature[0, 0].AddItem(new Corpse(Creature));
World.TheWorld.CreatureManager.CreatureIsDead(Creature);
}
}
示例7: LaserDecorator
public LaserDecorator(IWeapon wpn)
{
_scale = GameLogic.GetInstance().GetScale();
_offset = new Vector2(_scale*2.5f, -(_scale*5f));
_speed = new Vector2(0, -(_scale*4f));
_wpn = wpn;
}
示例8: Awake
protected virtual void Awake()
{
m_hForward = false;
m_hBackward = false;
m_hRight = false;
m_hLeft = false;
m_hWheels = new List<Wheel>();
m_hRigidbody = this.GetComponent<Rigidbody>();
m_hRigidbody.interpolation = RigidbodyInterpolation.None;
//Initialize effective wheels
List<Transform> gfxPos = this.GetComponentsInChildren<Transform>().Where(hT => hT.GetComponent<WheelCollider>() == null).ToList();
this.GetComponentsInChildren<WheelCollider>().ToList().ForEach(hW => m_hWheels.Add(new Wheel(hW, gfxPos.OrderBy(hP => Vector3.Distance(hP.position, hW.transform.position)).First().gameObject)));
m_hWheels = m_hWheels.OrderByDescending(hW => hW.Collider.transform.localPosition.z).ToList();
//Initialize extra wheels
m_hFakeWheels = GetComponentsInChildren<FakeWheel>().ToList();
//Initialize VehicleTurret
m_hTurret = GetComponentInChildren<VehicleTurret>();
//Initialize IWeapon
m_hCurrentWeapon = GetComponentInChildren<IWeapon>();
m_hActor = GetComponent<Actor>();
//Initialize Drive/Brake System
switch (DriveType)
{
case DriveType.AWD:
m_hEngine = new AwdDrive(Hp, m_hWheels);
break;
case DriveType.RWD:
m_hEngine = new RearDrive(Hp, m_hWheels);
break;
case DriveType.FWD:
m_hEngine = new ForwardDrive(Hp, m_hWheels);
break;
default:
break;
}
m_hConstanForce = this.GetComponent<ConstantForce>();
m_hReverseCOM = new Vector3(0.0f, -2.0f, 0.0f);
m_hOriginalCOM = m_hRigidbody.centerOfMass;
GroundState hGroundState = new GroundState(this);
FlyState hFlyState = new FlyState(this);
TurnedState hTurned = new TurnedState(this, m_hReverseCOM);
hGroundState.Next = hFlyState;
hFlyState.Grounded = hGroundState;
hFlyState.Turned = hTurned;
hTurned.Next = hFlyState;
m_hFlyState = hFlyState;
}
示例9: Player
protected Player(Position position, int health, int damage, string name, int energyPoints, Image image, IWeapon weapon, int healingPoints)
: base(position, health, damage, image)
{
this.Name = name;
this.EnergyPoints = energyPoints;
this.Weapon = weapon;
this.healingPoints = healingPoints;
}
示例10: Awake
void Awake()
{
this.HeliRigidBody = GetComponent<Rigidbody>();
this.mass = HeliRigidBody.mass;
this.isGrounded = true;
this.playerPlane = new Plane(Vector3.up, this.transform.position);
m_hCurrentWeapon = GetComponentInChildren<IWeapon>();
}
示例11: GetNeededArmorType
public static ArmorType GetNeededArmorType(IWeapon weapon)
{
if (weapon.Type == DamageType.Magical)
return ArmorType.Magical;
if (weapon.Range == 0)
return ArmorType.Physical;
return ArmorType.Ranged;
}
示例12: ApplyCostModifier
public double ApplyCostModifier(IWeapon weapon)
{
if (weapon.WeaponCategory.Contains("Light"))
{
return weapon.WeaponCost + lightWeaponCostModifier;
}
return weapon.WeaponCost;
}
示例13: ApplyDamageModifier
public double ApplyDamageModifier(IWeapon weapon)
{
if (weapon.IsBow)
{
return 0;
}
return DamageBonus;
}
示例14: ContextExample
public ContextExample(IWeapon weapon1, [Ctx ("a")] IWeapon weapon2)
{
_weapon1 = weapon1;
_weapon2 = weapon2;
// Assert
weapon1.Should().NotBeSameAs (weapon2);
}
示例15: setHitParameters
public void setHitParameters(Vector2 playerPosition, Vector2 dir, LayerMask hittableLayers, IWeapon currentWeapon, IWeapon[] weapons)
{
this.dir = new Vector2(dir.x, -dir.y);
this.hittableLayers = hittableLayers;
this.currentWeapon = currentWeapon;
this.weapons = weapons;
area = this.currentWeapon.getCharacteristic(IWeapon.Stats.AOE);
this.playerPosition = playerPosition;
}