public ContextExample(IWeapon weapon1, [Ctx ("a")] IWeapon weapon2) { _weapon1 = weapon1; _weapon2 = weapon2; // Assert weapon1.Should().NotBeSameAs (weapon2); }
public EnchantedMagicWeapon(IWeapon weapon, List<IWeaponEnchantment> weaponEnchantments) { enchantments = new List<IWeaponEnchantment>(); LoadCriticalDamageDictionary(); plusWeapon = QualifyWeapon(weapon); enchantments.AddRange(weaponEnchantments); // IWeapon WeaponName = plusWeapon.WeaponName; GivenName = plusWeapon.GivenName; Proficiency = plusWeapon.Proficiency; WeaponUse = plusWeapon.WeaponUse; WeaponCategory = plusWeapon.WeaponCategory; WeaponSubCategory = plusWeapon.WeaponSubCategory; WeaponSize = plusWeapon.WeaponSize; WeaponCost = plusWeapon.WeaponCost; Damage = plusWeapon.Damage; ThreatRangeLowerBound = plusWeapon.ThreatRangeLowerBound; CriticalDamage = plusWeapon.CriticalDamage; DamageType = plusWeapon.DamageType; Weight = plusWeapon.Weight; Hardness = plusWeapon.Hardness; HitPoints = plusWeapon.HitPoints; RangeIncrement = plusWeapon.RangeIncrement; MaxRange = plusWeapon.MaxRange; IsBow = plusWeapon.IsBow; //IForgedWeapon AdditionalEnchantmentCost = plusWeapon.AdditionalEnchantmentCost; ToHitModifier = plusWeapon.ToHitModifier; DamageBonus = plusWeapon.DamageBonus; ComponentName = plusWeapon.ComponentName; //IPlusEnhancedWeapon PlusEnhancement = plusWeapon.PlusEnhancement; GeneratesLight = plusWeapon.GeneratesLight; RequiredFeats = plusWeapon.RequiredFeats; //IWeaponEnhancement // Properties needing method assignments // IWeapon CostModifier = TallyCostModifiers(); ThreatRange = CalculateThreatRange(); // IPlusWeapon and IWeaponEnchantment MinimumCasterLevel = DetermineMinimumCasterLevel(plusWeapon.MinimumCasterLevel); MagicAura = AssembleAuras(); // IWeaponEnchantment RequiredSpells = AssembleRequiredSpells(); AdditionalRequirements = AssembleAdditionalRequirements(); // Non interface implemented properties ModifiedRangeIncrement = CalculateRangeModifier(plusWeapon.RangeIncrement); ModifiedMaxRange = CalculateRangeModifier(plusWeapon.MaxRange); SpecialInfo = AppendSpecialInfo(); }
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; }
public List<EffectivePoint> CalculateTargetablePoints(IWeapon weapon, Point wielderPosition) { List<EffectivePoint> targetablePoints = new List<EffectivePoint>(); targetablePoints.Add(new EffectivePoint(wielderPosition + new Point(1, 0), 1.0f)); targetablePoints.Add(new EffectivePoint(wielderPosition + new Point(-1, 0), 1.0f)); targetablePoints.Add(new EffectivePoint(wielderPosition + new Point(0, 1), 1.0f)); targetablePoints.Add(new EffectivePoint(wielderPosition + new Point(0, -1), 1.0f)); return targetablePoints; }
public override void Add(TypeOfGun type, IWeapon weapon) { KeyValuePair<TypeOfGun, IWeapon> tmp = new KeyValuePair<TypeOfGun, IWeapon>(type, weapon); if (weaponRepository.Contains(tmp) == false) { weaponRepository.Add(tmp); } }
//TODO : загрузку и инициализацию консрукторов из файла public BaseShip() { Weapon = new Cannon(); weaponCache = new WeaponCache(); weaponCache.Add(Weapon.GunType, Weapon); bulletForCurrentShoot = TypeOFBullets.Cannonbal; NumOfCannonballs = 10; // TODO kill magic number int Weight = 1000; }
public void ChangeWeapon( int newIndex ) { InstancedWeapons[activeIndex].gameObject.SetActive(false); InstancedWeapons[activeIndex].PutAway(); activeIndex = newIndex; activeWeapon = InstancedWeapons[activeIndex].GetComponent<IWeapon>(); InstancedWeapons[activeIndex].gameObject.SetActive(true); }
// Use this for initialization void Start() { if (primaryWeaponMount != null) { pWeapon = primaryWeaponMount.GetComponentInChildren<IWeapon> (); print (pWeapon); } if (secondaryWeaponMount != null) { sWeapon = secondaryWeaponMount.GetComponentInChildren<IWeapon> (); } }
public Astronaut() : base("astronaut3_0") { IsAnimating = true; FrameSize = new Point(30, 37); _talkBox = new TalkBox(this); _weapon = new Rifle(this); SubSprites.Add(_weapon); SubSprites.Add(_talkBox); _weapon.ReLoad(5); }
public void Equip(IWeapon weapon) { if (CanEquip(weapon)) { m_weapons.Add(weapon); } else { throw new CantEquipWeaponException(); } }
public GuidedMissileDecorator(IWeapon wpn) { _scale = GameLogic.GetInstance().GetScale(); _offset = new Vector2(_scale*8f, -(_scale*0.5f)); _speed = _scale*2f; _wpn = wpn; if(_enemies == null) { _enemies = GameLogic.GetInstance().GetEnemies(); } }
/// <summary> /// if weapon is active weapon, we will include the damage scaling stats /// </summary> /// <param name="weapon"></param> /// <param name="isActiveWeapon"></param> public WeaponCombatNode(IWeapon weapon, bool isActiveWeapon) : base(weapon) { mWeapon = weapon; // if (isActiveWeapon) { LoadAttributeScalar(mWeapon.AttributeScaling); LoadDamageMin(mWeapon.DamageMin); LoadDamageMax(mWeapon.DamageMax); } }
override public IWeapon GetProduct(TypeOfGun gun) { for (int i = 0; i < weapons.Count; i++) { if (weapons[i].GunType == gun) { bought = weapons[i]; weapons.RemoveAt(i); break; } } return bought; }
public List<EffectivePoint> CalculateTargetablePoints(IWeapon weapon, Point wielderPosition) { Weapon weaponCore = (Weapon)weapon; int baseRange = int.Parse(weaponCore.Attributes["BaseRange"], CultureInfo.InvariantCulture); int baseMinRange = int.Parse(weaponCore.Attributes["BaseMinRange"], CultureInfo.InvariantCulture); int baseFalloffStart = int.Parse(weaponCore.Attributes["BaseFalloffStart"], CultureInfo.InvariantCulture); float falloffAmount = float.Parse(weaponCore.Attributes["FalloffAmount"], CultureInfo.InvariantCulture); List<EffectivePoint> targetablePoints = GenerateRangedTargetablePoints(wielderPosition, baseRange, baseMinRange, baseFalloffStart, falloffAmount); return targetablePoints; }
private void Start() { _weapon = GetComponent <IWeapon>(); _directionCalculator = GetComponent <MouseDirectionCalculator>(); }
public void Add(IWeapon weapon) { this._elements.Add(weapon); }
public Unit(IWeapon weapon) { this.weapon = weapon; }
public Wizard(string name, double health, double armor, IWeapon weapon, double powerMagic) : base(name, health, armor, weapon) { PowerMagic = powerMagic; }
public HeroThatCanUseAnyWeapon(string name, IWeapon weapon) { Name = name; MyWeapon = weapon; }
public Soldier(IWeapon weapon) { this.weapon = weapon; }
public void GiveWeapon(IWeapon weapon) { Weapon = weapon; }
public Repository(IWeapon weapon) { this.Weapon = weapon; }
public void DefendAttack(IWeapon weapon) { HP -= Weapon.DefendAttack(weapon); }
//public Shinobi (IWeapon weapon) //{ // Weapon = weapon; // HP = 20; //} public Shinobi(IWeapon weapon, string name) { Weapon = weapon; HP = 20; Name = name; }
public GrandFatherStyleNinja(IWeapon weapon) : base(weapon) { }
public string PrintWeapon(string name) { IWeapon weapon = this.weapons[name]; return(weapon.ToString()); }
public void SetWeapon(IWeapon weapon) { this.currentWeapon = weapon; currentWeapon.SetWeaponPosition(weaponPort); }
public void AddWeapon(IWeapon weapon) { this.weapons.Add(weapon.Name, weapon); }
public OwnStyleNinja(IWeapon weapon) : base(weapon) { }
public Epic(IWeapon weapon) { this.weapon = weapon; this.IncreaseDamage(); }
public Tank(IWeapon weapon) { this.weapon = weapon; }
public ISpaceShip CreateSpaceship(string model, ISpaceshipEngine engine, IArmour armour, IWeapon weapon) { return(new FuturisticSpaceship(engine, armour, weapon, model)); }
public void changeGun(IWeapon weapon) { this.weapon = weapon; }
private void ProcessWeaponDamage(IMobileObject attacker, IMobileObject defender, IWeapon weapon) { foreach (IDamage damage in weapon.DamageList) { DealDamage(attacker, defender, damage); } }
public void Arm(IWeapon weapon) { _weapon = weapon; }
public void TestInitialize() { this.axe = new Axe(AxeAttack, AxeDurability); this.dummy = new Dummy(DummyHealth, DummyXP); }
public Hero(IHeroFactory heroFactory) { _weapon = heroFactory.CreateWeapon(); _armor = heroFactory.CreateArmor(); }
public void Fire(IWeapon weapon) // Было Weapon стало IWeapon, потому что сделали интерфейс, и теперь аргументом будет тип данных IWeapon { // Сделано для того что бы охватить все типы оружия, огнестрел, холодное, лазерное и т.д. weapon.Fire(); // Выстрел игрока из переданного оружия }
public void Load(SaveData data) { string origPrefix = data.Prefix; // save original Prefix before editing it if (MainHandWeapon != null) { Destroy((MainHandWeapon as Behaviour).gameObject); mainHandWeapon = null; // set the variable (not the property) to null to avoid transfering to inventory } if (OffHandWeapon != null) { Destroy((OffHandWeapon as Behaviour).gameObject); offHandWeapon = null; // set the variable (not the property) to null to avoid transfering to inventory } string mainHandPath = data.Get("mainWeapon_path"); string offHandPath = data.Get("offWeapon_path"); if (mainHandPath != null) { GameObject prefab = Resources.Load <GameObject>(mainHandPath); if (prefab == null) { Debug.LogWarning("Loading Weapon MainHand : Failed to load \"" + mainHandPath + "\""); } else { GameObject instance = Instantiate(prefab, Vector3.zero, Quaternion.identity) as GameObject; MainHandWeapon = instance.GetComponent <IWeapon>(); } } if (offHandPath != null) { GameObject prefab = Resources.Load <GameObject>(offHandPath); if (prefab == null) { Debug.LogWarning("Loading Weapon OffHand : Failed to load \"" + offHandPath + "\""); } else { GameObject instance = Instantiate(prefab, Vector3.zero, Quaternion.identity) as GameObject; OffHandWeapon = instance.GetComponent <IWeapon>(); } } string ammoType = data.Get("ammos_type"); if (ammoType != null) { Type type = Type.GetType(ammoType); IRangedWeaponAmmo ammo; if (type.BaseType == typeof(ScriptableObject)) // need to call CreateInstance from ScriptableObject { ammo = (IRangedWeaponAmmo)ScriptableObject.CreateInstance(type); } else { ammo = (IRangedWeaponAmmo)Activator.CreateInstance(type); } data.Prefix = origPrefix + "ammos_"; ammo.Load(data); CurrentAmmos = ammo; } saveLoaded = true; }
public EventWeaponChange(IWeapon weap) { newWeapon = weap; }
private IWeapon CreateFromRecognizedString(string recognizedName, IWeapon currentWeapon, float sensitivityScale) { var weaponName = recognizedName.FindMostSimilar(WeaponNamesToTypes.Keys); WeaponNamesToTypes.TryGetValue(weaponName, out var weaponType); var inGameName = weaponType.GetWeaponName(); IWeapon result; if (currentWeapon?.IsTheSameWeapon(inGameName) ?? weaponType == WeaponAL.Unknown) { return(currentWeapon); } var numOfMods = WeaponTypesToNumOfMods[weaponType]; switch (weaponType) { case WeaponAL.Wingman: case WeaponAL.MASTIFF: case WeaponAL.KRABER: case WeaponAL.Longbow: case WeaponAL.Peacekeeper: case WeaponAL.TripleTake: case WeaponAL.ChargedRifle: case WeaponAL.Docek: result = new NonAdjustableWeapon(inGameName, 0, recognizedName, numOfMods); break; case WeaponAL.Havoc: result = new Havoc(inGameName, 2, recognizedName, numOfMods); break; case WeaponAL.Devotion: result = new Devotion(inGameName, recognizedName, numOfMods); break; case WeaponAL.LStar: result = new LStar(inGameName, 2, recognizedName, numOfMods); break; case WeaponAL.Flatline: result = new Flatline(inGameName, 2, recognizedName, numOfMods); break; case WeaponAL.Hemlok: result = new Hemlok(inGameName, 2, recognizedName, numOfMods); break; case WeaponAL.Prowler: result = new Prowler(inGameName, 2, recognizedName, numOfMods); break; case WeaponAL.RE45: result = new RE45(inGameName, 2, recognizedName, numOfMods); break; case WeaponAL.R301: result = new R301(inGameName, 2, recognizedName, numOfMods); break; case WeaponAL.R99: result = new R99(inGameName, 1.5, recognizedName, numOfMods); break; case WeaponAL.Alternator: result = new Alternator(inGameName, 2, recognizedName, numOfMods); break; case WeaponAL.G7Scout: result = new G7Scout(inGameName, 2, recognizedName, numOfMods); break; case WeaponAL.Spitfire: result = new Spitfire(inGameName, recognizedName, numOfMods); break; case WeaponAL.Repeater3030: result = new Repeater3030(inGameName, 2, recognizedName, numOfMods); break; case WeaponAL.Unknown: case WeaponAL.EVA8Auto: case WeaponAL.Mozambique: case WeaponAL.P2020: result = new RegularAdjustmentWeapon(inGameName, 2, recognizedName, numOfMods); break; case WeaponAL.Volt: result = new Volt(inGameName, 1.5, recognizedName, numOfMods); break; default: throw new ArgumentOutOfRangeException(); } result.SetSensitivityScale(sensitivityScale); this.OnWeaponCreated(result); return(result); }
protected virtual void OnWeaponCreated(IWeapon weapon) { this.WeaponCreated?.Invoke(this, new WeaponCreatedEventArgs(weapon)); }
public IWeapon FromRecognizedString(string weaponString, IWeapon currentWeapon, float sensitivityScale) { return(this.CreateFromRecognizedString(weaponString, currentWeapon, sensitivityScale)); }
public Hero(string name, IWeapon weapon) { this.name = name; this.experience = 0; this.weapon = weapon; }
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); } }
// 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(); }
public void FightWithDefaultContext(IWeapon weapon1, IWeapon weapon2) { // Assert weapon1.Should().BeSameAs (weapon2); weapon1.Should().BeSameAs (_weapon1); weapon1.Should().NotBeSameAs (_weapon2); }
void Awake() { weaponPool = new GameObjectPool(projectile, maximumSize, initialSize, transform); impactPool = new GameObjectPool(impact, -1, initialSize / 2, transform); WeaponManager.Register(this); weapon = projectile.GetComponent<IWeapon>(); }
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); }
public PlayerShip(Game game) : base(game) { SetTexture(Resources.playerShip); SetMovingBehaviour(new PlayerMovement(this)); _wpn = new Cannon(); }
public void ChangeWeapon(IWeapon newWeapon, List<Character> selectedNames) { foreach (Character character in selectedNames) { character.weapon = newWeapon; } }
void Start() { if (weapon == null) { weapon = transform.Require<Weapon>(); } Equip(weapon); }
public static ArmorType GetNeededArmorType(IWeapon weapon) { if (weapon.Type == DamageType.Magical) return ArmorType.Magical; if (weapon.Range == 0) return ArmorType.Physical; return ArmorType.Ranged; }
public void SwapWeapon() { _currentWeaponIndex = (_currentWeaponIndex + 1) % _weapons.Count; _currentWeapon = _weapons[_currentWeaponIndex]; if (OnWeaponChanged != null) OnWeaponChanged(_currentWeapon); }
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; }
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>(); }
public double ApplyCostModifier(IWeapon weapon) { if (weapon.WeaponCategory.Contains("Light")) { return weapon.WeaponCost + lightWeaponCostModifier; } return weapon.WeaponCost; }
public double ApplyDamageModifier(IWeapon weapon) { if (weapon.IsBow) { return 0; } return DamageBonus; }
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; }
public LaserDecorator(IWeapon wpn) { _scale = GameLogic.GetInstance().GetScale(); _offset = new Vector2(_scale*2.5f, -(_scale*5f)); _speed = new Vector2(0, -(_scale*4f)); _wpn = wpn; }