public void SetWeaponType(WeaponTypes type) { MeshRenderer iconRenderer = icon.GetComponent<MeshRenderer>(); iconRenderer.enabled = true; if (type == WeaponTypes.LieGenerator) { iconRenderer.material = (Material) Instantiate(Resources.Load("materials/liegeneratorhint")); lieHint = true; } else if (type == WeaponTypes.DrinkSpot) { iconRenderer.material = (Material) Instantiate(Resources.Load("materials/drinks")); } else if (type == WeaponTypes.ShoppingCenter) { iconRenderer.material = (Material) Instantiate(Resources.Load("materials/shopping")); } else if (type == WeaponTypes.Brothel) { iconRenderer.material = (Material) Instantiate(Resources.Load("materials/brothel")); } else { iconRenderer.enabled = false; } m_type = type; }
protected Weapon(string id, decimal price, double weight, int damage, WeaponTypes type, WeaponKind kind) : base(id, price, weight) { this.Damage = damage; this.WeaponType = type; this.WeaponKind = kind; }
public Ship(PlayerIndex playerIndex, Texture2D txShipTexture,Texture2D txBulletTexture,WeaponTypes WeaponType) { this.player = playerIndex; this._weaponType = WeaponType; this.ShipTexture = txShipTexture; this._txBulletTexture = txBulletTexture; }
void Start () { // Setup which type of weapon we are based on our name. if(gameObject.name.Contains("Sword")) myWeaponType = WeaponTypes.Sword; else if(gameObject.name.Contains("Staff")) myWeaponType = WeaponTypes.Staff; }
public Weapon(int minDamage, int maxDamage, WeaponTypes type, int durability, List<BodyPart> equipLocations ) { this.MinDamage = minDamage; this.MaxDamage = maxDamage; this.Name = type.ToString(); this.Type = type; this.Durability = durability; this.EquipLocations = equipLocations; }
public BaseWeapon(BaseWeapon item) : base(item) { subType = item.subType; Stats = new WeaponStatCollection(); Stats.AddStat<LinkableStat>(StatType.ATTACKPOWER, item.Stats.GetStat(StatType.ATTACKPOWER).BaseValue); Stats.AddStat<LinkableStat>(StatType.ATTACKSPEED, item.Stats.GetStat(StatType.ATTACKSPEED).BaseValue); Stats.AddStat<LinkableStat>(StatType.ATTACKRANGE, item.Stats.GetStat(StatType.ATTACKRANGE).BaseValue); hand = item.Hand; }
public BaseWeapon(Dictionary<string, string> itemDictionary) : base(itemDictionary) { subType = (WeaponTypes)Enum.Parse(typeof(WeaponTypes), itemDictionary["SubType"]); Stats = new WeaponStatCollection(); Stats.AddStat<LinkableStat>(StatType.ATTACKPOWER, int.Parse(itemDictionary["BaseStat1"])); Stats.AddStat<LinkableStat>(StatType.ATTACKSPEED, int.Parse(itemDictionary["BaseStat2"])); Stats.AddStat<LinkableStat>(StatType.ATTACKRANGE, int.Parse(itemDictionary["BaseStat3"])); hand = int.Parse(itemDictionary["BaseStat4"]); }
//returns a value between 0 and 1 based on how much ammo the bot has for //the given weapon, and the maximum amount of ammo the bot can carry. The //closer the amount carried is to the max amount, the higher the score public static float IndividualWeaponStrength(BotEntity bot, WeaponTypes weaponType) { //grab a pointer to the gun (if the bot owns an instance) Weapon wp = bot.WeaponSystem.GetWeaponFromInventory(weaponType); if (wp != null) { return wp.NumRoundsRemaining/ GetMaxRoundsBotCanCarryForWeapon(weaponType); } return 0.0f; }
/// <summary> /// Устанавливает текущий атакер по типу оружия /// </summary> /// <param name="attackerType"></param> public void setAttacker(WeaponTypes attackerType) { // Меняем атакер по умолчанию currentAttackerType=attackerType; switch(attackerType){ case WeaponTypes.Sword: currentAttacker=swordAttacker; break; case WeaponTypes.Range: currentAttacker=rangeAttacker; break; case WeaponTypes.Magic: currentAttacker=magicAttacker; break; } }
///<summary> ///constructor ///</summary> ///<param name="weaponType"></param> ///<param name="defaultNumRounds"></param> ///<param name="maxRoundsCarried"></param> ///<param name="rateOfFire"></param> ///<param name="idealRange"></param> ///<param name="projectileSpeed"></param> ///<param name="ownerOfGun"></param> protected Weapon( WeaponTypes weaponType, int defaultNumRounds, int maxRoundsCarried, float rateOfFire, float idealRange, float projectileSpeed, BotEntity ownerOfGun) { _weaponType = weaponType; _numRoundsLeft = defaultNumRounds; _owner = ownerOfGun; _rateOfFire = rateOfFire; _maxRoundsCarried = maxRoundsCarried; _lastDesirabilityScore = 0; _idealRange = idealRange; _maxProjectileSpeed = projectileSpeed; _timeNextAvailable = Time.TimeNow; }
public static void setWeaponType(WeaponTypes wType) { WeaponType = wType; switch (WeaponType) { case WeaponTypes.NORMAL: WeaponDamage = WEAPON_DAMAGE_NORMAL; break; case WeaponTypes.UPGRADE1: WeaponDamage = WEAPON_DAMAGE_UPGRADE1; break; case WeaponTypes.UPGRADE2: WeaponDamage = WEAPON_DAMAGE_UPGRADE2; break; case WeaponTypes.UPGRADE3: WeaponDamage = WEAPON_DAMAGE_UPGRADE3; break; default: Debug.LogError("WeaponDamage ["+WeaponType+"] not supported. Using normal damage"); WeaponDamage = WEAPON_DAMAGE_NORMAL; break; } }
void OnGUI() { string[] results2 = AssetDatabase.FindAssets("_Weapons"); string ScriptableObjectpath = AssetDatabase.GUIDToAssetPath(results2[0]); GUILayout.Label(texture, GUILayout.ExpandWidth(true), GUILayout.MaxHeight(80)); scrollPos = GUILayout.BeginScrollView(scrollPos, GUILayout.MinHeight(10), GUILayout.MaxHeight(800)); sele = (newOrPref)EditorGUILayout.EnumPopup("", sele); switch (sele) { case newOrPref.AddWeaponFromPrefab: EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); prefab = EditorGUILayout.ObjectField("Weapon Prefab:", prefab, typeof(Object), allowSceneObjects: true); WeaponImage = (Sprite)EditorGUILayout.ObjectField("Add Weapon Sprite:", WeaponImage, typeof(Sprite), allowSceneObjects: true); weaponDamage = EditorGUILayout.IntField("Weapon Damage:", weaponDamage); weaponAmmo = EditorGUILayout.IntField("Weapon Start Ammo:", weaponAmmo); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button(new GUIContent("Add New Weapon", "adds new weapon."))) { createWeaponFromPrefab(); PrefabAddComponent(); } if (GUILayout.Button(new GUIContent("Remove Last Weapon", "removes last added weapon."))) { if (EditorUtility.DisplayDialog("Remove Last Weapon", "Are shure you want to remove last added weapon?", "Yes", "No, it was a mistake")) { removeWeapon(); } } EditorGUILayout.EndHorizontal(); if (weapons == null) { w = (Weapons)AssetDatabase.LoadAssetAtPath(ScriptableObjectpath, typeof(Weapons)); weapons = w.wep; } for (int i = 0; i < weapons.Count; i++) { EditorGUILayout.SelectableLabel("weapon : " + weapons[i]); } EditorGUILayout.HelpBox("You can always change damage value in damage array in GameManager.", MessageType.Info); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); break; case newOrPref.MakeNewWeapon: GUILayout.Label("New Weapon Settings", EditorStyles.boldLabel, GUILayout.ExpandWidth(true)); GUILayout.Label("Choose what type of weapon you want to add.", EditorStyles.centeredGreyMiniLabel); types = (WeaponTypes)EditorGUILayout.EnumPopup("", types); GUILayout.Label("Enter Weapon name you want to add.", EditorStyles.centeredGreyMiniLabel); WeaponImage = (Sprite)EditorGUILayout.ObjectField("Add Weapon Sprite:", WeaponImage, typeof(Sprite), allowSceneObjects: true); weaponName = EditorGUILayout.TextField("Weapon Name", "" + weaponName); if (types == WeaponTypes.Launcher) { WeaponAmmo = EditorGUILayout.FloatField("Weapon Start Ammo:", WeaponAmmo); } else { weaponAmmo = EditorGUILayout.IntField("Weapon Start Ammo:", weaponAmmo); } weaponDamage = EditorGUILayout.IntField("Weapon Damage:", weaponDamage); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button(new GUIContent("Add New Weapon", "adds new weapon."))) { createWeapon(); addComponent(types); } if (GUILayout.Button(new GUIContent("Remove Last Weapon", "removes last added weapon."))) { if (EditorUtility.DisplayDialog("Remove Last Weapon", "Are shure you want to remove last added weapon?", "Yes", "No, it was a mistake")) { removeWeapon(); } } EditorGUILayout.EndHorizontal(); if (weapons == null) { w = (Weapons)AssetDatabase.LoadAssetAtPath(ScriptableObjectpath, typeof(Weapons)); weapons = w.wep; } for (int i = 0; i < weapons.Count; i++) { EditorGUILayout.SelectableLabel("weapon : " + weapons[i]); } switch (types) { case WeaponTypes.MachineGun: EditorGUILayout.HelpBox("After you add new weapon: " + "\n1) Set All Settings in MachineGun component, attached to your new Weapon.", MessageType.Info); break; case WeaponTypes.Launcher: EditorGUILayout.HelpBox("After you add new weapon: " + "\n1) Set All Settings in Launcher component, attached to your new Weapon.", MessageType.Info); break; case WeaponTypes.GrenadeLauncher: EditorGUILayout.HelpBox("After you add new weapon: " + "\n1) Set All Settings in GrenadeLauncher component, attached to your new Weapon.", MessageType.Info); break; case WeaponTypes.Laser: EditorGUILayout.HelpBox("After you add new weapon: " + "\n1) Set All Settings in Laser component, attached to your new Weapon.", MessageType.Info); break; case WeaponTypes.Lightning: EditorGUILayout.HelpBox("After you add new weapon: " + "\n1) Set All Settings in Lightning component, attached to your new Weapon.", MessageType.Info); break; default: Debug.LogError("Unrecognized Option"); break; } break; default: break; } GUILayout.Label("New Toggles for Weapons", EditorStyles.boldLabel, GUILayout.ExpandWidth(true)); EditorGUILayout.HelpBox("Before adding toggles, Open SelectionMenu Scene. ", MessageType.Info); ToggleWeaponImage = (Sprite)EditorGUILayout.ObjectField("Add Toggle Sprite:", ToggleWeaponImage, typeof(Sprite), allowSceneObjects: true); GUILayout.Label("Enter Toggle name.", EditorStyles.centeredGreyMiniLabel); toggleName = EditorGUILayout.TextField("Toggle Name", "" + toggleName); EditorGUILayout.HelpBox("'Toggle Weapon Number' is index number of weapon in weapon selection(count starts from 0, like in arrays)", MessageType.Info); WeaponToggleNumber = EditorGUILayout.TextField("Toggle Weapon Number", "" + WeaponToggleNumber); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button(new GUIContent("Add New Toggle", "adds toggle and parents it to 'WeaponsPanel' "))) { if (EditorUtility.DisplayDialog("Add new Toggle", "Is current scene 'SelectionMenu'? (if not, nothing will work)", "Yep", "No")) { createToggle(); } } if (GUILayout.Button(new GUIContent("Remove Last Toggle", "removes last toggle from 'WeaponsPanel' "))) { if (EditorUtility.DisplayDialog("Remove last Toggle", "Is current scene 'SelectionMenu'? (if not, nothing will work)", "Yep", "No")) { removeToggle(); } } EditorGUILayout.EndHorizontal(); if (toggles == null) { w = (Weapons)AssetDatabase.LoadAssetAtPath(ScriptableObjectpath, typeof(Weapons)); toggles = w.toggles; } for (int i = 0; i < toggles.Count; i++) { toggles[i] = EditorGUILayout.TextField("Toggle", toggles[i]); } EditorGUILayout.Space(); EditorGUILayout.Space(); GUILayout.EndScrollView(); }
public static void resetOnGameOver() { health = DEFAULT_HEALTH; score = DEFAULT_SCORE; lives = DEFAULT_LIVES; cryptoLocks = 0; WeaponType = WeaponTypes.NORMAL; BOOST_TIME = 0; }
/////////////////////////////////////////////////////////////////////// // Initialisation public void SetUpDefaults() { for (int i = 0; i < (int)WeaponTypes.Count; ++i) { WeaponTypes weaponType = (WeaponTypes)i; if (SchemeTypes.CanApplyWeaponSetting(weaponType, WeaponSettings.Power) && weaponType != WeaponTypes.JetPack) { Access(weaponType).Power.SetValue(2); } } //Most of these are taken from Intermediate. Access(SettingTypes.HotSeatDelay).SetValue(5); Access(SettingTypes.RetreatTime).SetValue(3); Access(SettingTypes.RopeRetreatTime).SetValue(5); Access(SettingTypes.DisplayTotalRoundTime).SetValue(SchemeTypes.False); Access(SettingTypes.AutomaticReplays).SetValue(SchemeTypes.True); Access(SettingTypes.FallDamage).SetValue(SchemeTypes.True); Access(SettingTypes.ArtilleryMode).SetValue(SchemeTypes.False); Access(SettingTypes.StockpilingMode).SetValue((byte)StockpilingModes.Off); Access(SettingTypes.WormSelect).SetValue((byte)WormSelectModes.Off); Access(SettingTypes.SuddenDeathEvent).SetValue((byte)SuddenDeathEvents.OneHitPoint); Access(SettingTypes.WaterRiseRate).SetValue(0x02); Access(SettingTypes.DonorCards).SetValue(SchemeTypes.False); Access(SettingTypes.HealthCrateEnergy).SetValue(25); Access(SettingTypes.HazardousObjectTypes).SetValue(0x05); Access(SettingTypes.MineDelay).SetValue(3); Access(SettingTypes.DudMines).SetValue(SchemeTypes.True); Access(SettingTypes.InitialWormPlacement).SetValue(SchemeTypes.False); Access(SettingTypes.InitialWormEnergy).SetValue(100); Access(SettingTypes.TurnTime).SetValue(45); Access(SettingTypes.RoundTime).SetValue(15); Access(SettingTypes.NumberOfRounds).SetValue(1); Access(SettingTypes.TeamWeapons).SetValue(SchemeTypes.True); Access(SettingTypes.SuperWeapons).SetValue(SchemeTypes.True); if (Version < SchemeVersion.Armageddon3) { return; } //Set extended option non-zero defaults. Access(ExtendedOptionTypes.Wind).SetValue(100); Access(ExtendedOptionTypes.WindBias).SetValue(15); Access(ExtendedOptionTypes.Gravity).SetValue(0x3D70); Access(ExtendedOptionTypes.Friction).SetValue(0xF5C2); Access(ExtendedOptionTypes.RopeKnocking).SetValue(255); Access(ExtendedOptionTypes.BloodLevel).SetValue(255); Access(ExtendedOptionTypes.NoCrateProbability).SetValue(255); Access(ExtendedOptionTypes.MaximumCrateCount).SetValue(5); Access(ExtendedOptionTypes.SuddenDeathDisablesWormSelect).SetValue(SchemeTypes.True); Access(ExtendedOptionTypes.SuddenDeathWormDamagePerTurn).SetValue(5); Access(ExtendedOptionTypes.ExplosionsPushAllObjects).SetValue((int)ExtendedOptionsTriState.Default); Access(ExtendedOptionTypes.UndeterminedCrates).SetValue((int)ExtendedOptionsTriState.Default); Access(ExtendedOptionTypes.UndeterminedFuses).SetValue((int)ExtendedOptionsTriState.Default); Access(ExtendedOptionTypes.PauseTimerWhileFiring).SetValue(SchemeTypes.True); Access(ExtendedOptionTypes.PneumaticDrillImpartsVelocity).SetValue((int)ExtendedOptionsTriState.Default); Access(ExtendedOptionTypes.PetrolTurnDecay).SetValue(0x3332); Access(ExtendedOptionTypes.PetrolTouchDecay).SetValue(30); Access(ExtendedOptionTypes.MaximumFlameletCount).SetValue(200); Access(ExtendedOptionTypes.MaximumProjectileSpeed).SetValue(0x200000); Access(ExtendedOptionTypes.MaximumRopeSpeed).SetValue(0x100000); Access(ExtendedOptionTypes.MaximumJetPackSpeed).SetValue(0x50000); Access(ExtendedOptionTypes.GameEngineSpeed).SetValue(0x10000); Access(ExtendedOptionTypes.IndianRopeGlitch).SetValue((int)ExtendedOptionsTriState.Default); Access(ExtendedOptionTypes.HerdDoublingGlitch).SetValue((int)ExtendedOptionsTriState.Default); Access(ExtendedOptionTypes.JetPackBungeeGlitch).SetValue(SchemeTypes.True); Access(ExtendedOptionTypes.HerdDoublingGlitch).SetValue(SchemeTypes.True); Access(ExtendedOptionTypes.AngleCheatGlitch).SetValue(SchemeTypes.True); Access(ExtendedOptionTypes.GlideGlitch).SetValue(SchemeTypes.True); Access(ExtendedOptionTypes.FloatingWeaponGlitch).SetValue(SchemeTypes.True); Access(ExtendedOptionTypes.RubberWormGravityStrength).SetValue(0x10000); Access(ExtendedOptionTypes.TerrainOverlapPhasingGlitch).SetValue((int)ExtendedOptionsTriState.Default); Access(ExtendedOptionTypes.HealthCratesCurePoison).SetValue((int)HealthCratesCurePoisonModes.Team); Access(ExtendedOptionTypes.SheepHeavensGate).SetValue(7); Access(ExtendedOptionTypes.DoubleTimeStackLimit).SetValue(1); }
private int ApplyDamageToNonPlayer(Items.DaggerfallUnityItem weapon, Vector3 direction, bool bowAttack = false) { if (senses.Target == null) { return(0); } // TODO: Merge with hit code in WeaponManager to eliminate duplicate code EnemyEntity entity = entityBehaviour.Entity as EnemyEntity; EnemyEntity targetEntity = senses.Target.Entity as EnemyEntity; EnemySounds targetSounds = senses.Target.GetComponent <EnemySounds>(); EnemyMotor targetMotor = senses.Target.transform.GetComponent <EnemyMotor>(); // Calculate damage damage = FormulaHelper.CalculateAttackDamage(entity, targetEntity, false, 0, weapon); // Break any "normal power" concealment effects on enemy if (entity.IsMagicallyConcealedNormalPower && damage > 0) { EntityEffectManager.BreakNormalPowerConcealmentEffects(entityBehaviour); } // Play hit sound and trigger blood splash at hit point if (damage > 0) { targetSounds.PlayHitSound(weapon); EnemyBlood blood = senses.Target.transform.GetComponent <EnemyBlood>(); CharacterController targetController = senses.Target.transform.GetComponent <CharacterController>(); Vector3 bloodPos = senses.Target.transform.position + targetController.center; bloodPos.y += targetController.height / 8; if (blood) { blood.ShowBloodSplash(targetEntity.MobileEnemy.BloodIndex, bloodPos); } // Knock back enemy based on damage and enemy weight if (targetMotor && (targetMotor.KnockbackSpeed <= (5 / (PlayerSpeedChanger.classicToUnitySpeedUnitRatio / 10)) && (entityBehaviour.EntityType == EntityTypes.EnemyClass || targetEntity.MobileEnemy.Weight > 0))) { float enemyWeight = targetEntity.GetWeightInClassicUnits(); float tenTimesDamage = damage * 10; float twoTimesDamage = damage * 2; float knockBackAmount = ((tenTimesDamage - enemyWeight) * 256) / (enemyWeight + tenTimesDamage) * twoTimesDamage; float KnockbackSpeed = (tenTimesDamage / enemyWeight) * (twoTimesDamage - (knockBackAmount / 256)); KnockbackSpeed /= (PlayerSpeedChanger.classicToUnitySpeedUnitRatio / 10); if (KnockbackSpeed < (15 / (PlayerSpeedChanger.classicToUnitySpeedUnitRatio / 10))) { KnockbackSpeed = (15 / (PlayerSpeedChanger.classicToUnitySpeedUnitRatio / 10)); } targetMotor.KnockbackSpeed = KnockbackSpeed; targetMotor.KnockbackDirection = direction; } if (DaggerfallUnity.Settings.CombatVoices && senses.Target.EntityType == EntityTypes.EnemyClass && Dice100.SuccessRoll(40)) { DaggerfallMobileUnit targetMobileUnit = senses.Target.GetComponentInChildren <DaggerfallMobileUnit>(); Genders gender; if (targetMobileUnit.Summary.Enemy.Gender == MobileGender.Male || targetEntity.MobileEnemy.ID == (int)MobileTypes.Knight_CityWatch) { gender = Genders.Male; } else { gender = Genders.Female; } targetSounds.PlayCombatVoice(gender, false, damage >= targetEntity.MaxHealth / 4); } } else { WeaponTypes weaponType = WeaponTypes.Melee; if (weapon != null) { weaponType = DaggerfallUnity.Instance.ItemHelper.ConvertItemToAPIWeaponType(weapon); } if ((!bowAttack && !targetEntity.MobileEnemy.ParrySounds) || weaponType == WeaponTypes.Melee) { sounds.PlayMissSound(weapon); } else if (targetEntity.MobileEnemy.ParrySounds) { targetSounds.PlayParrySound(); } } // Handle Strikes payload from enemy to non-player target - this could change damage amount if (weapon != null && weapon.IsEnchanted) { EntityEffectManager effectManager = GetComponent <EntityEffectManager>(); if (effectManager) { damage = effectManager.DoItemEnchantmentPayloads(EnchantmentPayloadFlags.Strikes, weapon, entity.Items, targetEntity.EntityBehaviour, damage); } } targetEntity.DecreaseHealth(damage); if (targetMotor) { targetMotor.MakeEnemyHostileToAttacker(entityBehaviour); } return(damage); }
public int ammunitionFor(WeaponTypes w) { return(m_ammunition[(int)w]); }
//Constructor. public Weapon(string name, string description, int id, WeaponTypes weaponType, List <StatMod> stats) : base(name, description, id, stats) { EquipmentType = EquipmentTypes.Weapon; WeaponType = weaponType; }
public static bool IsSuperWeapon(WeaponTypes weaponType) { return(HasWeaponCategoryFlags(weaponType, WeaponCategoryFlags.SuperWeapon)); }
public void Add(WeaponTypes weapon, XElement element) { _weaponTypes.Add(weapon, element); }
public static Weapon GetWeapon(this string item) => WeaponTypes.GetValueOrDefault(item);
public static bool IsUtility(WeaponTypes weaponType) { return(HasWeaponCategoryFlags(weaponType, WeaponCategoryFlags.Utility)); }
/// <summary> /// Choose previous weapon if possible. /// </summary> public static void PreviousWeapon() { WeaponTypes previousWeapon = (WeaponTypes)(((int)currentWeapon + 2) % 3); if (gotWeapons[(int)previousWeapon] == true) { currentWeapon = previousWeapon; return; } // if (gotWeapons) // Try the other direction previousWeapon = (WeaponTypes)(((int)currentWeapon + 1) % 3); if (gotWeapons[(int)previousWeapon] == true) currentWeapon = previousWeapon; }
public EvaluatorGetWeapon(float characterBias, WeaponTypes weaponType) : base(characterBias) { _weaponType = weaponType; }
public Weapon getWeapon(WeaponTypes wp) { return _weapons[wp]; }
public Player(Texture2D txPlayerShip, Texture2D txBullet, WeaponTypes weaponTypes) { this.playerShip = new Ship(PlayerIndex.One, txPlayerShip, txBullet, weaponTypes); }
public static bool HasRubberWormSetting(WeaponTypes weaponType) { return(Enum.IsDefined(typeof(RubberWormSettings), (int)weaponType)); }
public void ChangeCurrentWeaponType(WeaponTypes type) { mm.meshReady = false; currentType = type; foreach (KeyValuePair <string, Selectable> item in parameters) { item.Value.gameObject.SetActive(false); } // set init params showSliderIndex = 0; switch (type) { case WeaponTypes.刀: ShowSlider("gripLength", 0.35f); ShowSlider("gripWidth", 0.05f); ShowSlider("guardLength", 0.05f); ShowSlider("bladeLengthGrow", 0.4f); ShowSlider("bladeLengthGrowFactor", 1.0f); ShowSlider("bladeWidth", 0.2f); ShowSlider("bladeWidthFactorA", 0.016f); ShowSlider("bladeWidthFactorB", 1.0f); ShowSlider("bladeThick", 0.06f); ShowSlider("bladeCurv", 0.3f); ShowSlider("edgeRatio", 0.3f); break; case WeaponTypes.槍: ShowSlider("gripLength", 1.7f); ShowSlider("gripWidth", 0.03f); ShowSlider("bladeLengthGrow", 0.01f); ShowSlider("bladeLengthGrowFactor", 0.0f); ShowSlider("bladeWidth", 0.03f); ShowSlider("bladeWidthFactorA", 0.003f); ShowSlider("bladeThick", 0.03f); ShowSlider("bladeCurv", 0.0f); break; case WeaponTypes.劍: ShowSlider("gripLength", 0.35f); ShowSlider("gripWidth", 0.05f); ShowSlider("guardLength", 0.05f); ShowSlider("bladeLengthGrow", 0.4f); ShowSlider("bladeLengthGrowFactor", 1.0f); ShowSlider("bladeWidth", 0.075f); ShowSlider("bladeWidthFactorA", 0.004f); ShowSlider("bladeThick", 0.03f); ShowSlider("bladeCurv", 0.0f); break; case WeaponTypes.戟: ShowSlider("gripLength", 1.7f); ShowSlider("gripWidth", 0.03f); ShowSlider("bladeLengthGrow", 0.01f); ShowSlider("bladeLengthGrowFactor", 0.0f); ShowSlider("bladeWidth", 0.03f); ShowSlider("bladeWidthFactorA", 0.003f); ShowSlider("bladeThick", 0.03f); ShowSlider("bladeCurv", 0.0f); ShowSlider("edgeRatio", 0.5f); ShowSlider("crescentL", 0.25f); ShowSlider("crescentW", 0.25f); ShowSlider("crescentD", 0.4f); ShowSlider("crescentT", 0.1f); break; case WeaponTypes.斧鉞: ShowSlider("gripLength", 1.5f); ShowSlider("gripWidth", 0.04f); ShowSlider("bladeCurv", 3.0f); ShowSlider("crescentL", 0.4f); ShowSlider("crescentW", 0.15f); ShowSlider("crescentD", 0.6f); ShowSlider("crescentT", 0.3f); break; case WeaponTypes.尖刀: ShowSlider("gripLength", 1.25f); ShowSlider("gripWidth", 0.04f); ShowSlider("guardLength", 0.05f); ShowSlider("guardWidth", 0.11f); ShowSlider("bladeLengthGrow", 0.025f); ShowSlider("bladeLengthGrowFactor", 0.2f); ShowSlider("bladeWidth", 0.08f); ShowSlider("bladeWidthFactorA", 0.0015f); ShowSlider("bladeThick", 0.075f); ShowSlider("bladeCurv", 1.25f); break; //case WeaponTypes.自訂: // ShowSlider("gripLength", 1.25f); // ShowSlider("gripWidth", 0.04f); // ShowSlider("guardLength", 0.05f); // ShowSlider("guardWidth", 0.11f); // ShowSlider("bladeLengthGrow", 0.025f); // ShowSlider("bladeLengthGrowFactor", 0.2f); // ShowSlider("bladeWidth", 0.08f); // ShowSlider("bladeWidthFactorA", 0.0015f); // ShowSlider("bladeThick", 0.075f); // ShowSlider("bladeCurv", 1.25f); // ShowSlider("edgeRatio", 0.5f); // ShowSlider("crescentL", 0.25f); // ShowSlider("crescentW", 0.25f); // ShowSlider("crescentD", 0.4f); // ShowSlider("crescentT", 0.1f); // break; default: break; } mm.AfterStart(); }
public bool WeaponTypeExists(string name) { return(WeaponTypes.Any(o => o.Name == name)); }
public void addValidIndex(WeaponTypes w) { validIndecies.Add(w); }
private int ApplyDamageToNonPlayer(Items.DaggerfallUnityItem weapon, Vector3 direction, bool bowAttack = false) { if (senses.Target == null) { return(0); } // TODO: Merge with hit code in WeaponManager to eliminate duplicate code EnemyEntity entity = entityBehaviour.Entity as EnemyEntity; EnemyEntity targetEntity = senses.Target.Entity as EnemyEntity; EnemySounds targetSounds = senses.Target.GetComponent <EnemySounds>(); EnemyMotor targetMotor = senses.Target.transform.GetComponent <EnemyMotor>(); int enemyDamType = EnemyDamageTypeUsed(entity, weapon); // Returns an integer value that corresponds to a specific damage type that this type of enemy can use, will use later on in combat formula. // Calculate damage damage = FormulaHelper.CalculateAttackDamage(entity, targetEntity, -1, 0, weapon, out bool shieldBlockSuccess, out int mainDamType, out bool critStrikeSuccess, out bool armorPartAbsorbed, out bool armorCompleteAbsorbed, out Items.DaggerfallUnityItem addedAIWeapon, out bool hitSuccess, out bool metalShield, out bool metalArmor, enemyDamType); // Break any "normal power" concealment effects on enemy if (entity.IsMagicallyConcealedNormalPower && damage > 0) { EntityEffectManager.BreakNormalPowerConcealmentEffects(entityBehaviour); } // If the AI was given a weapon through the damage formula, this gives them that weapon for this part of the calling method for later use. if (weapon == null) { weapon = addedAIWeapon; } // Play associated sound when armor/shield was responsible for absorbing damage completely. if (damage <= 0) { if (hitSuccess && shieldBlockSuccess) { targetSounds.PlayShieldBlockSound(weapon, metalShield); } else if (hitSuccess && armorCompleteAbsorbed) { targetSounds.PlayArmorAbsorbSound(weapon, metalArmor); } else { WeaponTypes weaponType = WeaponTypes.Melee; if (weapon != null) { weaponType = DaggerfallUnity.Instance.ItemHelper.ConvertItemToAPIWeaponType(weapon); } if ((!bowAttack && !targetEntity.MobileEnemy.ParrySounds) || weaponType == WeaponTypes.Melee) { sounds.PlayMissSound(weapon); } else if (targetEntity.MobileEnemy.ParrySounds) { targetSounds.PlayParrySound(); } } } // Play hit sound and trigger blood splash at hit point if (damage > 0) { if (shieldBlockSuccess && armorPartAbsorbed) { sounds.PlayShieldBlockSound(weapon, metalShield); } targetSounds.PlayHitSound(weapon); EnemyBlood blood = senses.Target.transform.GetComponent <EnemyBlood>(); CharacterController targetController = senses.Target.transform.GetComponent <CharacterController>(); Vector3 bloodPos = senses.Target.transform.position + targetController.center; bloodPos.y += targetController.height / 8; if (blood) { blood.ShowBloodSplash(targetEntity.MobileEnemy.BloodIndex, bloodPos); } // Knock back enemy based on damage and enemy weight if (targetMotor && (targetMotor.KnockbackSpeed <= (5 / (PlayerSpeedChanger.classicToUnitySpeedUnitRatio / 10)) && (entityBehaviour.EntityType == EntityTypes.EnemyClass || targetEntity.MobileEnemy.Weight > 0))) { float enemyWeight = targetEntity.GetWeightInClassicUnits(); float tenTimesDamage = damage * 10; float twoTimesDamage = damage * 2; float knockBackAmount = ((tenTimesDamage - enemyWeight) * 256) / (enemyWeight + tenTimesDamage) * twoTimesDamage; float KnockbackSpeed = (tenTimesDamage / enemyWeight) * (twoTimesDamage - (knockBackAmount / 256)); KnockbackSpeed /= (PlayerSpeedChanger.classicToUnitySpeedUnitRatio / 10); if (KnockbackSpeed < (15 / (PlayerSpeedChanger.classicToUnitySpeedUnitRatio / 10))) { KnockbackSpeed = (15 / (PlayerSpeedChanger.classicToUnitySpeedUnitRatio / 10)); } targetMotor.KnockbackSpeed = KnockbackSpeed; targetMotor.KnockbackDirection = direction; } if (DaggerfallUnity.Settings.CombatVoices && senses.Target.EntityType == EntityTypes.EnemyClass && Dice100.SuccessRoll(40)) { DaggerfallMobileUnit targetMobileUnit = senses.Target.GetComponentInChildren <DaggerfallMobileUnit>(); Genders gender; if (targetMobileUnit.Summary.Enemy.Gender == MobileGender.Male || targetEntity.MobileEnemy.ID == (int)MobileTypes.Knight_CityWatch) { gender = Genders.Male; } else { gender = Genders.Female; } targetSounds.PlayCombatVoice(gender, false, damage >= targetEntity.MaxHealth / 4); } } // Handle Strikes payload from enemy to non-player target - this could change damage amount if (weapon != null && weapon.IsEnchanted) { EntityEffectManager effectManager = GetComponent <EntityEffectManager>(); if (effectManager) { damage = effectManager.DoItemEnchantmentPayloads(EnchantmentPayloadFlags.Strikes, weapon, entity.Items, targetEntity.EntityBehaviour, damage); } } targetEntity.DecreaseHealth(damage); if (targetMotor) { targetMotor.MakeEnemyHostileToAttacker(entityBehaviour); } return(damage); }
public static void SetWeaponType(this ItemSpec item, WeaponTypes value) { item.SetProperty(new ItemSpecProperty((short)ItemSpecPropertyEnum.WeaponType, (short)value)); }
/// <summary> /// Reset all player entries for restarting a game. /// </summary> public static void Reset() { gameOver = false; alreadyUploadedHighscore = false; gameTimeMs = 0; health = 1.0f; score = 0; //unused: cameraWobbelTimeoutMs = 0; lastShootTimeMs = -500; position = new Vector2(0, -MaxYPosition); shipRotation = new Vector2(0, 0); shipPos = new Vector3(0, 0, 0); shootNum = 0; currentWeapon = WeaponTypes.MG; empBombs = 0; // Assign keys. Warning: This is VERY slow, never use it // inside any render loop (getting Settings, etc.)! moveLeftKey = GameSettings.Default.MoveLeftKey; moveRightKey = GameSettings.Default.MoveRightKey; moveUpKey = GameSettings.Default.MoveForwardKey; moveDownKey = GameSettings.Default.MoveBackwardKey; // Also assign mouse sensibility mouseSensibility = 2.5f - 2.0f * GameSettings.Default.ControllerSensibility; if (mouseSensibility < 0.5f) mouseSensibility = 0.5f; // Reset light position (make sure it still comes from the same direction) BaseGame.LightDirection = new Vector3(2, -7, 5); }
/// <summary> /// Gets the given weapon by reference. /// </summary> public Weapon Access(WeaponTypes weapon) { Debug.Assert(weapon < WeaponTypes.Count); return(Weapons[(int)weapon]); }
public static string GetWeaponFilename(WeaponTypes weaponType) { switch (weaponType) { case WeaponTypes.LongBlade: return "WEAPON04.CIF"; case WeaponTypes.LongBlade_Magic: return "WEAPO104.CIF"; case WeaponTypes.Staff: return "WEAPON01.CIF"; case WeaponTypes.Staff_Magic: return "WEAPO101.CIF"; case WeaponTypes.Dagger: return "WEAPON02.CIF"; case WeaponTypes.Dagger_Magic: return "WEAPO102.CIF"; case WeaponTypes.Mace: return "WEAPON05.CIF"; case WeaponTypes.Mace_Magic: return "WEAPO105.CIF"; case WeaponTypes.Flail: return "WEAPON06.CIF"; case WeaponTypes.Flail_Magic: return "WEAPO106.CIF"; case WeaponTypes.Warhammer: return "WEAPON07.CIF"; case WeaponTypes.Warhammer_Magic: return "WEAPO107.CIF"; case WeaponTypes.Battleaxe: return "WEAPON08.CIF"; case WeaponTypes.Battleaxe_Magic: return "WEAPO108.CIF"; case WeaponTypes.Bow: return "WEAPON09.CIF"; case WeaponTypes.Melee: return "WEAPON10.CIF"; case WeaponTypes.Werecreature: return "WEAPON11.CIF"; default: throw new Exception("Unknown weapon type."); } }
private void spawnWeaponPickup(bool eastOrNorth, WeaponTypes weaponType) { TileStruct tile = null; if (Width > Height) { if (!eastOrNorth) tile = ObjectPlacer.findAvailableTile(this, -30, 0); else tile = ObjectPlacer.findAvailableTile(this, 30, 0); } else { if (!eastOrNorth) tile = ObjectPlacer.findAvailableTile(this, 0, -30); else tile = ObjectPlacer.findAvailableTile(this, 0, 30); } var obj = (GameObject)Instantiate(Resources.Load("Pickup"), new Vector3(tile.X * 3.2f, tile.Y * 3.2f, -0.15f), Quaternion.identity); obj.GetComponent<PickupWeapon>().SelectedWeapon = weaponType; monsters.Add(obj); }
public Weapon(string ItemName, int ItemLevel, ArmorSlots ItemSlot, WeaponTypes WeaponType, WeaponAttributes WeaponAttributes) : base(ItemName, ItemLevel, ItemSlot) { this.WeaponType = WeaponType; this.WeaponAttributes = WeaponAttributes; }
static int GetRoleplayRealismItemsWeaponBalanceAdjustedSpeed(int baseSpeed, PlayerEntity player, WeaponTypes weaponType) { EquipSlots weaponSlot = GameManager.Instance.WeaponManager.UsingRightHand ? EquipSlots.RightHand : EquipSlots.LeftHand; DaggerfallUnityItem weapon = player.ItemEquipTable.GetItem(weaponSlot); // Hand-to-hand keeps its whole speed if (weaponType == WeaponTypes.Melee || weapon == null) { return(baseSpeed); } float weaponWeight = weapon.ItemTemplate.baseWeight; // Seems like the Feather Weight weapon enchant won't affect this formula int strWeightPerc = 150 - player.Stats.LiveStrength; float adjustedWeight = strWeightPerc * weaponWeight / 100f; float speedReductionPerc = adjustedWeight * 3.4f / 90f; // Magic numbers taken from R&R:I return((int)(baseSpeed * (1 - speedReductionPerc))); }
/// <summary> /// Reset all player entries for restarting a game. /// </summary> public static void Reset() { gameOver = false; alreadyUploadedHighscore = false; gameTimeMs = 0; lastGameTimeMs = 0; health = 100.0f; MaxHealth = 100.0f; score = 25; level = 1; levelPointsToSpend = 0; damageIncrease = 0; defenseIncrease = 0; speedIncrease = 0; currentWeapon = WeaponTypes.Club; gotWeapons = new bool[3] { true, false, false }; gotKey = false; }
public static WeaponAnimation[] GetWeaponAnims(WeaponTypes weaponType) { if (weaponType == WeaponTypes.Dagger || weaponType == WeaponTypes.Dagger_Magic) return DaggerWeaponAnims; else if (weaponType == WeaponTypes.Staff || weaponType == WeaponTypes.Staff_Magic) return StaffWeaponAnims; else if (weaponType == WeaponTypes.Werecreature) return WerecreatureWeaponAnims; else return GeneralWeaponAnims; }
///<summary> ///this is called by a weapon affector and will add a weapon of the ///specified type to the bot's inventory. /// ///if the bot already has a weapon of this type, only the ammo is added ///</summary> ///<param name="weaponType"></param> public void AddWeapon(WeaponTypes weaponType) { //create an instance of this weapon Weapon w = null; switch (weaponType) { case WeaponTypes.Railgun: w = new WeaponRailgun(_owner); break; case WeaponTypes.Shotgun: w = new WeaponShotgun(_owner); break; case WeaponTypes.RocketLauncher: w = new WeaponRocketLauncher(_owner); break; } if (null == w) return; //if the bot already holds a weapon of this type, just add its ammo Weapon present = GetWeaponFromInventory(weaponType); if (present != null) { present.IncrementRounds(w.NumRoundsRemaining); } //if not already holding, add to inventory else { _weaponMap[weaponType] = w; } }
private static BaseWeapon instantiateWeaponType(WeaponTypes type) { return (BaseWeapon)Activator.CreateInstance(WepTypes[type]); }
///<summary> ///Change weapon ///</summary> ///<param name="weaponType"></param> public void ChangeWeapon(WeaponTypes weaponType) { Weapon w = GetWeaponFromInventory(weaponType); if (w != null) { CurrentWeapon = w; } }
///<summary> ///Gets the amount of ammo remaining for the specified weapon. ///</summary> ///<param name="weaponType"></param> ///<returns> ///the amount of ammo remaining for the specified weapon or zero if the ///weapon is not in the inventory ///</returns> public int GetAmmoRemaining(WeaponTypes weaponType) { return _weaponMap[weaponType] != null ? _weaponMap[weaponType].NumRoundsRemaining : 0; }
///<summary> ///Get any matching weapon in inventory or ///null pointer if the weapon is not present ///</summary> ///<param name="weaponType"></param> ///<returns> ///any matching weapon in inventory or ///null pointer if the weapon is not present ///</returns> public Weapon GetWeaponFromInventory(WeaponTypes weaponType) { return _weaponMap[weaponType]; }
// Use this for initialization void Start() { //// Singleton //if (Instance != this) Destroy(this); //mm = ManagerSingleton.Instance; mm = FindObjectOfType <ManagerSingleton>(); // Weapon type buttons currentType = WeaponTypes.斧鉞; chooseWeaponBtnPrefab = Resources.Load <Button>("Prefabs/ChooseWeaponButton"); chooseWeaponBtns = new List <Button>(); foreach (WeaponTypes item in Enum.GetValues(typeof(WeaponTypes))) { Button newBtn = Instantiate(chooseWeaponBtnPrefab, chooseWeaponPanel.transform); newBtn.GetComponent <RectTransform>().anchoredPosition = new Vector2(0, -50 - (int)item * 70); newBtn.GetComponentInChildren <Text>().text = item.ToString(); newBtn.onClick.AddListener(delegate { ChangeCurrentWeaponType(item); }); chooseWeaponBtns.Add(newBtn); } // Parameters initialization parametersSetup = new Dictionary <string, List <object> >() { { "showLineIsOn", new List <object>() { false, false, true, "顯示L-system" } }, { "circleSubdivision", new List <object>() { 50, 10, 100, "細緻度" } }, { "pommelSubdivision", new List <object>() { 50, 10, 100, "pommelSubdivision" } }, { "pommelOuterDiameter", new List <object>() { 1.5f, 0.0f, 3.0f, "pommelOuterDiameter" } }, { "pommelInnerDiameter", new List <object>() { 0.5f, 0.0f, 3.0f, "pommelInnerDiameter" } }, { "pommelLength", new List <object>() { 0.5f, 0.0f, 1.0f, "pommel長" } }, { "pommelWidth", new List <object>() { 0.3f, 0.0f, 0.5f, "pommel寬" } }, { "gripSubdivision", new List <object>() { 50, 10, 100, "gripSubdivision" } }, { "gripLength", new List <object>() { 1.2f, 0.0f, 2.0f, "柄長" } }, { "gripWidth", new List <object>() { 0.1f, 0.0f, 0.1f, "柄徑" } }, { "guardSubdivision", new List <object>() { 50, 10, 100, "guardSubdivision" } }, { "guardLength", new List <object>() { 0.1f, 0.0f, 0.3f, "護手長" } }, { "guardWidth", new List <object>() { 0.3f, 0.0f, 0.5f, "護手寬" } }, { "bladeSubdivision", new List <object>() { 50, 10, 100, "bladeSubdivision" } }, { "bladeLengthGrow", new List <object>() { 0.2f, 0.0f, 0.5f, "刃長" } }, { "bladeLengthGrowFactor", new List <object>() { 0.0f, 0.0f, 2.0f, "刃長係數A" } }, { "bladeWidth", new List <object>() { 0.2f, 0.0f, 0.3f, "刃寬" } }, { "bladeWidthFactorA", new List <object>() { 0.0f, 0.0f, 0.02f, "刃寬係數A" } }, { "bladeWidthFactorB", new List <object>() { 1.0f, 0.0f, 1.0f, "刃寬係數B" } }, { "bladeThick", new List <object>() { 0.0f, 0.0f, 0.1f, "刃厚" } }, { "bladeWaveFreq", new List <object>() { 0.0f, 0.0f, 5.0f, "刀刃蛇形頻率" } }, { "bladeWaveAmp", new List <object>() { 0.0f, 0.0f, 5.0f, "刀刃蛇形振幅" } }, { "bladeCurv", new List <object>() { 2.5f, -3.0f, 3.0f, "刃彎" } }, { "edgeRatio", new List <object>() { 0.15f, 0.0f, 1.0f, "刃鋒比例" } }, { "maxIter", new List <object>() { 47, 10, 80, "迭代次數" } }, { "spearGripWidth", new List <object>() { 0.6f, 0.0f, 3.0f, "spearGripWidth" } }, { "spearGripLength", new List <object>() { 5.0f, 0.0f, 10.0f, "spearGripLength" } }, { "crescentL", new List <object>() { 0.75f, 0.0f, 1.5f, "特殊刃長" } }, { "crescentW", new List <object>() { 0.3f, 0.0f, 1.0f, "特殊刃寬" } }, { "crescentD", new List <object>() { 0.6f, 0.0f, 0.999f, "特殊刃凹" } }, { "crescentT", new List <object>() { 0.3f, 0.0f, 1.0f, "特殊刃厚" } } }; // slider setup parameterNamePrefab = Resources.Load <Text>("Prefabs/Text"); parameterSliderPrefab = Resources.Load <Slider>("Prefabs/ParameterSlider"); parameters = new Dictionary <string, Selectable>(); for (int i = 0; i < parametersSetup.Count; i++) { KeyValuePair <string, List <object> > pair = parametersSetup.ElementAt(i); Type pType = pair.Value[0].GetType(); Slider newSlider = Instantiate(parameterSliderPrefab, parameterPanel.transform); newSlider.name = pair.Key; if (pType == typeof(float)) { newSlider.maxValue = (float)(pair.Value[2]); newSlider.minValue = (float)pair.Value[1]; newSlider.value = (float)pair.Value[0]; } else if (pType == typeof(int)) { newSlider.maxValue = (int)(pair.Value[2]); newSlider.minValue = (int)pair.Value[1]; newSlider.value = (int)pair.Value[0]; newSlider.wholeNumbers = true; } newSlider.onValueChanged.AddListener(delegate { mm.MakeWeapon(); }); newSlider.gameObject.SetActive(false); Text newText = Instantiate(parameterNamePrefab, newSlider.transform); newText.GetComponent <RectTransform>().anchoredPosition = new Vector2(-170, 0); newText.text = (string)pair.Value[3]; newText.alignment = TextAnchor.MiddleLeft; parameters.Add(pair.Key, newSlider); } // Show line showLine.onValueChanged.AddListener(delegate { ShowLSystemLine(showLine); }); edgeCurve = AnimationCurve.EaseInOut(0.0f, 1.0f, 1.0f, 0.0f); }
public WeaponType GetWeaponTypeByName(string name) { return(WeaponTypes.First(o => o.Name == name)); }
public bool Contains(WeaponTypes weapon) { return(_weaponTypes.ContainsKey(weapon)); }
///<summary> ///change weapon to one of the given type if in inventory ///</summary> ///<param name="weaponType">weapon type to change to</param> public void ChangeWeapon(WeaponTypes weaponType) { WeaponSystem.ChangeWeapon(weaponType); }
public XElement Get(WeaponTypes weapon) { return(_weaponTypes[weapon]); }
/// <summary> /// Use this method of creating weapons when loading a game. It will create the new weapon /// without locking, since the locked object may not have been created yet. /// </summary> /// <param name="type">The type of the weapon</param> /// <param name="id">The lock ID. This is the ID the weapon will lock on to.</param> /// <param name="index">The array index to insert the lock tag into. This is a parallel array and is used to associated lock IDs with projectiles.</param> /// <param name="reachRange">The reaching range</param> /// <returns>The new projectile as type Explosive</returns> private WeaponBase createNewWeapon(WeaponTypes type, string id, int index, Range reachRange) { locks[index] = id; return(createNewWeapon(type, null, reachRange)); }
public void setAmmunitionFor(WeaponTypes w, int value) { m_ammunition[(int)w] = value; }
private void LoadWeaponAtlas() { // Get weapon filename string filename = WeaponBasics.GetWeaponFilename(WeaponType); // Load the weapon texture atlas // Texture is dilated into a transparent coloured border to remove dark edges when filtered // Important to use returned UV rects when drawing to get right dimensions weaponAtlas = GetWeaponTextureAtlas(filename, MetalType, out weaponRects, out weaponIndices, 2, 2, true); weaponAtlas.filterMode = dfUnity.MaterialReader.MainFilterMode; // Get weapon anims weaponAnims = (WeaponAnimation[])WeaponBasics.GetWeaponAnims(WeaponType).Clone(); // Store current weapon lastWeaponType = WeaponType; lastMetalType = MetalType; }
/// <summary> /// Creates a new projectile. /// </summary> /// <param name="type">The type (Guns, Missile, LTS, etc) of the weapon</param> /// <param name="target">The projector at which this projectile is being fired</param> /// <param name="reachRange">The range of how wide this projectile will consider itself a hit</param> /// <returns>The projectile as type Explosive. It will also have been given an ID.</returns> private WeaponBase createNewWeapon(WeaponTypes type, Projector target, Range reachRange) { //if isLoading is true, ammo count could be 0 but we still have to load weapon //since ammo is decreased when weapon is created. WeaponBase w = null; if (ammunitionFor(type) != 0 || Options.isLoading) { switch (type) { case WeaponTypes.guns: validWeapons.Add(w = new Guns(this)); break; case WeaponTypes.missile: validWeapons.Add(w = new Missile(this)); break; case WeaponTypes.laserCannonSystem: if ((lCSTarget == null && LTSCount < 1) || Options.isLoading) { //ltsCount will not increment if loaded in from file LTSCount++; //so increment it if we're loading it from a file as well validWeapons.Add(w = new LaserCannonSystem(this)); } break; case WeaponTypes.cruiseMissile: validWeapons.Add(w = new CruiseMissile(this)); break; case WeaponTypes.missileInterceptor: Projector iLock = getInterceptorLock(); if (iLock == null) { break; } target = iLock; validWeapons.Add(w = new MissileInterceptor(this)); break; case WeaponTypes.samMissile: validWeapons.Add(w = new SAMMissile(this)); break; case WeaponTypes.explosiveMissile: validWeapons.Add(w = new ExplosiveMissile(this)); break; case WeaponTypes.tankMissile: validWeapons.Add(w = new TankMissile(this)); break; case WeaponTypes.battleShipGuns: validWeapons.Add(w = new BattleShipGuns(this)); break; } } //if ammo remaining if (w != null) { // Only the client that fired the actual projectile will send info about its fired projectiles. // Other clients will just duplicate this projectile, and wait for instructions from this client. String id = creator.id + "_" + next + "_" + (nextPos++); if (nextID != null) //received weapon duplicate command from server { w.setID(nextID); // command includes assigned ID. /*When firing with guns, only one creation ID will be sent to the server, * signaling the ID of the first shot. We parse this ID to get the IDs of the remaining shots since nextID will be null after this. * See use() to see how gunshots are fired together. * */ if (weaponIndex == WeaponTypes.guns) { String[] idParts = nextID.Split(new char[] { '_' }); next = Convert.ToInt32(idParts[1]); nextPos = Convert.ToInt32(idParts[2]) + 1; } //if guns nextID = null; } else //If nextID == null IE: not server weapon { if (!Options.isLoading) //weapon's load method will add to object table { w.setID(id, !(w is Guns)); //don't add bullets to object table } } w.readyToDispose += freeWeapon; //Notify this class when the weapon has completed its execution w.eventHit += eventHit; if (target != null) { w.lockOn(target); } w.initRange(reachRange); System.Diagnostics.Trace.WriteLineIf(w != null, "WCreated weapon " + w.id); if (w.id != null) { System.Diagnostics.Trace.WriteLine("WCreated id " + w.id); } return(w); } return(null); }
private void Start() { Weapon = WeaponTypes.Arm; BulletsNumberText = _bulletText.GetComponent <Text>(); }
/// <summary> /// Converts Daggerfall weapon to generic API WeaponType. /// </summary> /// <param name="item">Weapon to convert.</param> /// <returns>WeaponTypes.</returns> public WeaponTypes ConvertItemToAPIWeaponType(DaggerfallUnityItem item) { // Must be a weapon if (item.ItemGroup != ItemGroups.Weapons) { return(WeaponTypes.None); } // Find FPS animation set for this weapon type // Daggerfall re-uses the same animations for many different weapons WeaponTypes result = WeaponTypes.None; switch (item.TemplateIndex) { case (int)Weapons.Dagger: result = WeaponTypes.Dagger; break; case (int)Weapons.Staff: result = WeaponTypes.Staff; break; case (int)Weapons.Tanto: case (int)Weapons.Shortsword: case (int)Weapons.Wakazashi: case (int)Weapons.Broadsword: case (int)Weapons.Saber: case (int)Weapons.Longsword: case (int)Weapons.Katana: case (int)Weapons.Claymore: case (int)Weapons.Dai_Katana: result = WeaponTypes.LongBlade; break; case (int)Weapons.Mace: result = WeaponTypes.Mace; break; case (int)Weapons.Flail: result = WeaponTypes.Flail; break; case (int)Weapons.Warhammer: result = WeaponTypes.Warhammer; break; case (int)Weapons.Battle_Axe: case (int)Weapons.War_Axe: result = WeaponTypes.Battleaxe; break; case (int)Weapons.Short_Bow: case (int)Weapons.Long_Bow: result = WeaponTypes.Bow; break; default: return(WeaponTypes.None); } // Handle enchanted weapons if (item.legacyMagic != null && item.legacyMagic[0] != -1) { switch (result) { case WeaponTypes.Dagger: result = WeaponTypes.Dagger_Magic; break; case WeaponTypes.Staff: result = WeaponTypes.Staff_Magic; break; case WeaponTypes.LongBlade: result = WeaponTypes.LongBlade_Magic; break; case WeaponTypes.Mace: result = WeaponTypes.Mace_Magic; break; case WeaponTypes.Flail: result = WeaponTypes.Flail_Magic; break; case WeaponTypes.Warhammer: result = WeaponTypes.Warhammer_Magic; break; case WeaponTypes.Battleaxe: result = WeaponTypes.Battleaxe_Magic; break; default: break; } } return(result); }
public void SetWeapon(WeaponTypes weapon) { /* ColorSwap and Shader to change MegaMan's color scheme * * his spritesheets have been altered to greyscale for his outfit * Red 64 for the helmet, gloves, boots, etc ( SwapIndex.Primary ) * Red 128 for his shirt, pants, etc ( SwapIndex.Secondary ) * * couple ways to code this but I settled on #2 * * #1 using Lists * * var colorIndex = new List<int>(); * var playerColors = new List<Color>(); * colorIndex.Add((int)SwapIndex.Primary); * colorIndex.Add((int)SwapIndex.Secondary); * playerColors.Add(ColorSwap.ColorFromIntRGB(64, 64, 64)); * playerColors.Add(ColorSwap.ColorFromIntRGB(128, 128, 128)); * colorSwap.SwapColors(colorIndex, playerColors); * * #2 using SwapColor as needed then ApplyColor * * colorSwap.SwapColor((int)SwapIndex.Primary, ColorSwap.ColorFromInt(0x0073F7)); * colorSwap.SwapColor((int)SwapIndex.Secondary, ColorSwap.ColorFromInt(0x00FFFF)); * colorSwap.ApplyColor(); * * Also, we'll change the color of our weapon energy bar * and adjust the energy value as given in the playerWeaponsStruct * */ // set new selected weapon (determines color scheme) playerWeapon = weapon; // calculate weapon energy value to adjust the bars int currentEnergy = weaponsData[(int)playerWeapon].currentEnergy; int maxEnergy = weaponsData[(int)playerWeapon].maxEnergy; float weaponEnergyValue = (float)currentEnergy / (float)maxEnergy; // apply new selected color scheme with ColorSwap and set weapon energy bar switch (playerWeapon) { case WeaponTypes.MegaBuster: // dark blue, light blue colorSwap.SwapColor((int)SwapIndex.Primary, ColorSwap.ColorFromInt(0x0073F7)); colorSwap.SwapColor((int)SwapIndex.Secondary, ColorSwap.ColorFromInt(0x00FFFF)); // the player weapon energy doesn't apply but we'll just set the default and hide it if (UIEnergyBars.Instance != null) { UIEnergyBars.Instance.SetImage(UIEnergyBars.EnergyBars.PlayerWeapon, UIEnergyBars.EnergyBarTypes.PlayerLife); UIEnergyBars.Instance.SetVisibility(UIEnergyBars.EnergyBars.PlayerWeapon, false); } break; case WeaponTypes.MagnetBeam: // dark blue, light blue colorSwap.SwapColor((int)SwapIndex.Primary, ColorSwap.ColorFromInt(0x0073F7)); colorSwap.SwapColor((int)SwapIndex.Secondary, ColorSwap.ColorFromInt(0x00FFFF)); // magnet beam energy and set visible if (UIEnergyBars.Instance != null) { UIEnergyBars.Instance.SetImage(UIEnergyBars.EnergyBars.PlayerWeapon, UIEnergyBars.EnergyBarTypes.MagnetBeam); UIEnergyBars.Instance.SetValue(UIEnergyBars.EnergyBars.PlayerWeapon, weaponEnergyValue); UIEnergyBars.Instance.SetVisibility(UIEnergyBars.EnergyBars.PlayerWeapon, true); } break; case WeaponTypes.HyperBomb: // green, light gray colorSwap.SwapColor((int)SwapIndex.Primary, ColorSwap.ColorFromInt(0x009400)); colorSwap.SwapColor((int)SwapIndex.Secondary, ColorSwap.ColorFromInt(0xFCFCFC)); // bombman's hyper bomb weapon energy and set visible if (UIEnergyBars.Instance != null) { UIEnergyBars.Instance.SetImage(UIEnergyBars.EnergyBars.PlayerWeapon, UIEnergyBars.EnergyBarTypes.HyperBomb); UIEnergyBars.Instance.SetValue(UIEnergyBars.EnergyBars.PlayerWeapon, weaponEnergyValue); UIEnergyBars.Instance.SetVisibility(UIEnergyBars.EnergyBars.PlayerWeapon, true); } break; case WeaponTypes.RollingCutter: // dark gray, light gray colorSwap.SwapColor((int)SwapIndex.Primary, ColorSwap.ColorFromInt(0x747474)); colorSwap.SwapColor((int)SwapIndex.Secondary, ColorSwap.ColorFromInt(0xFCFCFC)); // cutman's rolling cutter weapon energy and set visible if (UIEnergyBars.Instance != null) { UIEnergyBars.Instance.SetImage(UIEnergyBars.EnergyBars.PlayerWeapon, UIEnergyBars.EnergyBarTypes.RollingCutter); UIEnergyBars.Instance.SetValue(UIEnergyBars.EnergyBars.PlayerWeapon, weaponEnergyValue); UIEnergyBars.Instance.SetVisibility(UIEnergyBars.EnergyBars.PlayerWeapon, true); } break; case WeaponTypes.ThunderBeam: // dark gray, light yellow colorSwap.SwapColor((int)SwapIndex.Primary, ColorSwap.ColorFromInt(0x747474)); colorSwap.SwapColor((int)SwapIndex.Secondary, ColorSwap.ColorFromInt(0xFCE4A0)); // elecman's thunderbeam weapon energy and set visible if (UIEnergyBars.Instance != null) { UIEnergyBars.Instance.SetImage(UIEnergyBars.EnergyBars.PlayerWeapon, UIEnergyBars.EnergyBarTypes.ThunderBeam); UIEnergyBars.Instance.SetValue(UIEnergyBars.EnergyBars.PlayerWeapon, weaponEnergyValue); UIEnergyBars.Instance.SetVisibility(UIEnergyBars.EnergyBars.PlayerWeapon, true); } break; case WeaponTypes.FireStorm: // dark orange, yellow gold colorSwap.SwapColor((int)SwapIndex.Primary, ColorSwap.ColorFromInt(0xD82800)); colorSwap.SwapColor((int)SwapIndex.Secondary, ColorSwap.ColorFromInt(0xF0BC3C)); // fireman's firestorm weapon energy and set visible if (UIEnergyBars.Instance != null) { UIEnergyBars.Instance.SetImage(UIEnergyBars.EnergyBars.PlayerWeapon, UIEnergyBars.EnergyBarTypes.FireStorm); UIEnergyBars.Instance.SetValue(UIEnergyBars.EnergyBars.PlayerWeapon, weaponEnergyValue); UIEnergyBars.Instance.SetVisibility(UIEnergyBars.EnergyBars.PlayerWeapon, true); } break; case WeaponTypes.SuperArm: // orange red, light gray colorSwap.SwapColor((int)SwapIndex.Primary, ColorSwap.ColorFromInt(0xC84C0C)); colorSwap.SwapColor((int)SwapIndex.Secondary, ColorSwap.ColorFromInt(0xFCFCFC)); // gutman's super arm weapon energy and set visible if (UIEnergyBars.Instance != null) { UIEnergyBars.Instance.SetImage(UIEnergyBars.EnergyBars.PlayerWeapon, UIEnergyBars.EnergyBarTypes.SuperArm); UIEnergyBars.Instance.SetValue(UIEnergyBars.EnergyBars.PlayerWeapon, weaponEnergyValue); UIEnergyBars.Instance.SetVisibility(UIEnergyBars.EnergyBars.PlayerWeapon, true); } break; case WeaponTypes.IceSlasher: // dark blue, light gray colorSwap.SwapColor((int)SwapIndex.Primary, ColorSwap.ColorFromInt(0x2038EC)); colorSwap.SwapColor((int)SwapIndex.Secondary, ColorSwap.ColorFromInt(0xFCFCFC)); // iceman's ice slasher weapon energy and set visible if (UIEnergyBars.Instance != null) { UIEnergyBars.Instance.SetImage(UIEnergyBars.EnergyBars.PlayerWeapon, UIEnergyBars.EnergyBarTypes.IceSlasher); UIEnergyBars.Instance.SetValue(UIEnergyBars.EnergyBars.PlayerWeapon, weaponEnergyValue); UIEnergyBars.Instance.SetVisibility(UIEnergyBars.EnergyBars.PlayerWeapon, true); } break; } // apply the color changes colorSwap.ApplyColor(); }
/// <summary> /// count of a given weapon type discovered /// </summary> public int NumberOfWeaponsByType(WeaponTypes type) { switch (type) { case WeaponTypes.Blaster: return NumberOfBlasters; case WeaponTypes.Railgun: return NumberOfRailguns; case WeaponTypes.RocketLauncher: return NumberOfRocketLaunchers; case WeaponTypes.Shotgun: return NumberOfShotguns; default: return 1; } }
public WeaponItem(int id, string name, EqupmentType Type, WeaponTypes weaponType, int Intelligence, int Strength, int Dexterity, int Lower, int Upper, ItemRarity rarity, string TextureName, int intreq, int strreq, int dexreq, int LevelReq, ItemTypes itemType) : base(id, name, Type, Intelligence, Strength, Dexterity, rarity, TextureName, intreq, strreq, dexreq, LevelReq, itemType) { this.weaponType = weaponType; WeaponDamageRange = new int[] { Lower, Upper }; }
void ParseWeaponType() { weaponType = weaponType.ToLower(); switch (weaponType) { case "ballistic": eWeaponType = WeaponTypes.Ballistic; break; case "cannon": eWeaponType = WeaponTypes.Cannon; break; case "laser": eWeaponType = WeaponTypes.Laser; break; } }
public Attack(float damage, Vector3 attackDir = default(Vector3), float knockbackStrength = 0, SwingTypes swingType = SwingTypes.None, WeaponTypes weaponType = WeaponTypes.None, Vector3 impactPoint = default(Vector3)) { this.damage = damage; this.attackDir = attackDir; this.knockbackStrength = knockbackStrength; this.swingType = swingType; this.weaponType = weaponType; this.impactPoint = impactPoint; }