/* * public Transform GetHandTransform() * { * return handPrefabs; * } */ public void EquipWeapon(WeaponEnum weapon) { weaponManager.GetComponent <WeaponManager>().tempReloadTime = 0; if (weapon == WeaponEnum.Pistol) { this.weapon = weaponManager.GetComponent <Pistol>(); } else if (weapon == WeaponEnum.Sedat) { this.weapon = weaponManager.GetComponent <Sedat>(); } else if (weapon == WeaponEnum.AssaultRifle) { this.weapon = weaponManager.GetComponent <AssaultRifle>(); } else if (weapon == WeaponEnum.Bazuka) { this.weapon = weaponManager.GetComponent <Bazuka>(); } else if (weapon == WeaponEnum.Shotgun) { this.weapon = weaponManager.GetComponent <Shotgun>(); } if (this.weapon != null) { this.weapon.Equip(); uiManager.UpdateAmmo(this.weapon.CurrentAmmo, this.weapon.CurrentSpare); } }
public Weapon(float damage, float speed, float range, WeaponEnum weaponEnum) { Range = range; Speed = speed; Damage = damage; MyCurrentWeapon = weaponEnum; }
public ObjectPool <GameObject> GetWeaponObjectPool(WeaponEnum weaponEnum) { switch (weaponEnum) { case WeaponEnum.Grenade: return(GrenadesPool); case WeaponEnum.HollyGrenade: return(HollyGrenadePool); case WeaponEnum.Mine: return(MinePool); case WeaponEnum.Morale: return(MoralePool); case WeaponEnum.Rose: return(RosePool); case WeaponEnum.Sheep: return(SheepPool); case WeaponEnum.SupriseBox: return(SupriseBoxPool); case WeaponEnum.Commet: return(CommetPool); case WeaponEnum.Fox: return(FoxPool); default: throw new UnityException("No object pool for this weapon"); } }
public void GiveWeapon(WeaponEnum weaponEnum) { PlayPickUpSound(); int weaponIndex = (int)weaponEnum; if (hasGun[weaponIndex]) { int ammoFilled = gunInstances[weaponIndex].GetComponent <BaseWeapon>().RefillAmmo(); // If the gun we just picked up is the same as we have in our hand // then we need to update the ammo ui if (currentGunIndex == weaponIndex) { ammoCache[weaponIndex] = ammoFilled; } else { // if it is not the same, then we just want to update the ammo for that gun, but dont update the ui // because we are refilling ammo for a gun we are not currently holding // TODO: do we want to do weapon priority. Ex when u pick up a stronger weapon, it auto switches? } } else { // Pick up that weapon for the first and set the gun's ammo ammoCache[weaponIndex] = gunInstances[weaponIndex].GetComponent <BaseWeapon>().RefillAmmo(); } hasGun[weaponIndex] = true; }
public void ReplaceWeapon(WeaponEnum newValue) { var index = GameComponentsLookup.Weapon; var component = (WeaponComponent)CreateComponent(index, typeof(WeaponComponent)); component.value = newValue; ReplaceComponent(index, component); }
public IWeapon MakeWeapon(WeaponEnum spriteType, Vector2 location, Direction dir, IPlayer player) { return(spriteType switch { WeaponEnum.Bomb => new Bomb(texture2, location, dir, game.Room), WeaponEnum.Sword => new Sword(location, dir, player), _ => throw new ArgumentException("Invalid sprite! Sprite factory failed."), });
void Update() { if (!assignedType) { type = gameObject.transform.parent.gameObject.GetComponent <WeaponGenerator>().weaponType; assignedType = true; } }
void Update() { if (!assignedType) { type = gameObject.transform.parent.gameObject.GetComponent<WeaponGenerator>().weaponType; assignedType = true; } }
public void EnableWeaponWindow() { var wep = Enum.GetValues(typeof(WeaponEnum)).Cast <WeaponEnum>().ToArray(); for (int i = 0; i < wep.Length; i++) { weaponEnum = (WeaponEnum)SetFlag((int)weaponEnum, (int)wep[i], Toggle(GetFlag((int)weaponEnum, (int)wep[i]), wep[i].ToString())); } }
public Kill(MatchPlayer killer, MatchPlayer killed, WeaponEnum weapon, DeathEnum deathType) { Killer = killer; Killed = killed; Weapon = weapon; DeathType = deathType; TimeOfEvent = DateTime.Now; }
public override void TriggerWildcardDefense(WeaponEnum weaponMod) { WorldTransformSpell spell = AbilityHandler.Instance.Defense.Spell as WorldTransformSpell; if (weaponMod != WeaponEnum.neutral) { spell.PlacementOffset = spell.BasePlacementOffset * _tierStats[Tier - 1].PlacementOffset; } }
private void Awake() { currentweapon = WeaponEnum.RocketLauncher; weaponTextUI.text = System.Enum.GetName(typeof(WeaponEnum), currentweapon); weapon[WeaponEnum.RocketLauncher] = 4; weapon[WeaponEnum.Smg] = 35; weapon[WeaponEnum.ThrowingKnife] = 5; ammoTextUI.text = weapon[currentweapon].ToString(); }
public FireProps(FireProps fp) { this.direction = fp.direction; this.position = fp.position; this.animController = fp.animController; this.bulletSpeed = fp.bulletSpeed; this.damage = fp.damage; this.weapon = fp.weapon; this.weapEnum = fp.weapEnum; }
public FireProps(Vector2 direction, Vector2 position, RuntimeAnimatorController animController, float bulletSpeed, int damage, string weapon, WeaponEnum weapEnum) { this.direction = direction; this.position = position; this.animController = animController; this.bulletSpeed = bulletSpeed; this.damage = damage; this.weapon = weapon; this.weapEnum = weapEnum; }
public GameObject BulletGenerator(WeaponEnum enu) { var definition = LoadedWeapons.First(d => d.WeaponEnum == enu); var bullet = UnityEngine.Object.Instantiate(definition.BulletPrefab, Vector3.zero, Quaternion.identity, GameObjectsProviderService.BulletsParentObject.transform); int viewId = UniqueIdHelper.GetNextForWeapon(enu); bullet.GetComponent <PhotonView>().ViewID = viewId; return(bullet.gameObject); }
public bool ShouldRoundEnd(WeaponEnum weaponEnum) { var definition = LoadedWeapons.FirstOrDefault(w => w.WeaponEnum == weaponEnum); if (definition != null) { return(definition.Shoots == 1 || definition.Shoots < 1); } return(false); }
public FireProps(FireProps fp) { this.direction = fp.direction; this.position = fp.position; this.animController = fp.animController; this.bulletSpeed = fp.bulletSpeed; this.damage = fp.damage; this.weapon = fp.weapon; this.weapEnum = fp.weapEnum; }
public void RemoveFromInventoryAllBut(WeaponEnum weapon) { for (int i = inventory.Count - 1; i >= 0; i--) { if (inventory[i].weaponType != weapon) { inventory.RemoveAt(i); } } }
public FireProps(Vector2 direction, Vector2 position, RuntimeAnimatorController animController, float bulletSpeed, int damage, string weapon, WeaponEnum weapEnum) { this.direction = direction; this.position = position; this.animController = animController; this.bulletSpeed = bulletSpeed; this.damage = damage; this.weapon = weapon; this.weapEnum = weapEnum; }
public EquipmentWeapon(SerializationInfo info, StreamingContext ctxt) : base(info, ctxt) { this.weaponEnum = (WeaponEnum)info.GetValue("weaponEnum", typeof(WeaponEnum)); this.normalDamage = (int)info.GetValue("normalDamage", typeof(int)); this.searchFlags = (List<Map.World.SearchFlags.Searchflag>)info.GetValue("searchFlags", typeof(List<Map.World.SearchFlags.Searchflag>)); this.attacks = (List<Attack.Attack>)info.GetValue("attacks", typeof(List<Attack.Attack>)); }
public EquipmentWeapon(SerializationInfo info, StreamingContext ctxt) : base(info, ctxt) { this.weaponEnum = (WeaponEnum)info.GetValue("weaponEnum", typeof(WeaponEnum)); this.normalDamage = (int)info.GetValue("normalDamage", typeof(int)); this.searchFlags = (List <Map.World.SearchFlags.Searchflag>)info.GetValue("searchFlags", typeof(List <Map.World.SearchFlags.Searchflag>)); this.attacks = (List <Attack.Attack>)info.GetValue("attacks", typeof(List <Attack.Attack>)); }
public bool IsWeaponReady(WeaponEnum weapon) { for (int i = inventory.Count - 1; i >= 0; i--) { if (inventory[i].weaponType == weapon && inventory[i].readyToFire) { return(true); } } return(false); }
public override void TriggerWildcardDefense(WeaponEnum weaponMod) { float invisChance = _tierStats[Tier - 1].InvisibilityChance; if (Random.Range(0, 1) <= invisChance) { if (weaponMod == WeaponEnum.neutral) { return; } GameObject.FindGameObjectWithTag("Player").GetComponent <StatHandler>().IsInvinsible = true; } }
public override void TriggerWildcardDefense(WeaponEnum weaponMod) { WorldTransformSpell spell = AbilityHandler.Instance.Defense.Spell as WorldTransformSpell; Debug.Log("<color=green>Trigger BadAtMath Defense</color>"); Debug.Log("<color=green>Trigger BadAtMath old lifetime: " + spell.BaseLifetime + "</color>"); if (weaponMod != WeaponEnum.neutral) { float lifetimeRange = _tierStats[Tier - 1].LifetimeRangeFactor; spell.IncreaseLifetime(spell.BaseLifetime * (Random.Range(-lifetimeRange, lifetimeRange))); } Debug.Log("<color=green>Trigger BadAtMath new lifetime: " + spell.Lifetime + "</color>"); }
void OnTriggerEnter2D(Collider2D coll) { if ((coll.gameObject.tag == "Player")) { if (!assignedType) { type = gameObject.transform.parent.gameObject.GetComponent<WeaponGenerator>().weaponType; assignedType = true; } coll.gameObject.SendMessage("AddWeapon", type); assignedType = false; gameObject.SetActive(false); } }
void OnTriggerEnter2D(Collider2D coll) { if ((coll.gameObject.tag == "Player")) { if (!assignedType) { type = gameObject.transform.parent.gameObject.GetComponent <WeaponGenerator>().weaponType; assignedType = true; } coll.gameObject.SendMessage("AddWeapon", type); assignedType = false; gameObject.SetActive(false); } }
public static Weapon getWeapon(WeaponEnum weapon) { /* start WeaponFactory */ if (weapon == WeaponEnum.WETIREDSWORD) return getWeTriedSword(); if (weapon == WeaponEnum.WETRIEDKNIFE) return getWeTriedKnife(); if (weapon == WeaponEnum.WETRIEDSTAFF) return getWeTriedStaff(); return null; }
public override void TriggerWildcardAttack(WeaponEnum weaponMod) { //Debug.Log("Trigger LookClosely Attack"); ProjectileSpell spell = AbilityHandler.Instance.Attack.Spell as ProjectileSpell; Debug.Log("<color=green>Trigger BadAtMath Attack</color>"); Debug.Log("<color=green>Trigger BadAtMath old damage range: " + spell.DamageRange + "</color>"); if (weaponMod != WeaponEnum.neutral) { spell.DamageRange = spell.BaseDamageRange + _tierStats[Tier - 1].DamageRangeFactor; } Debug.Log("<color=green>Trigger BadAtMath new damage range: " + spell.DamageRange + "</color>"); }
public void AddWeapon(WeaponEnum we) { WeaponBase weapon = weapons[we]; if (inventory.Contains(weapon)) { inventory[inventory.IndexOf(weapon)].reload(); activeWeapon = inventory[inventory.IndexOf(weapon)]; } else { weapon.recycle(); inventory.Add(weapon); activeWeapon = weapon; } SoundManager.instance.PlaySingle(addWeaponSound); }
public static Weapon FactoryWeapon(WeaponEnum type, int id, string name, Rarity rarity, int price, string desc, int damage) { switch (type) { case WeaponEnum.Bow: return(new Bow(id, name, rarity, price, desc, damage)); case WeaponEnum.Staff: return(new Staff(id, name, rarity, price, desc, damage)); case WeaponEnum.Dagger: return(new Dagger(id, name, rarity, price, desc, damage)); case WeaponEnum.Rapier: return(new Rapier(id, name, rarity, price, desc, damage)); case WeaponEnum.Axe: return(new Axe(id, name, rarity, price, desc, damage)); case WeaponEnum.Sword: return(new Sword(id, name, rarity, price, desc, damage)); case WeaponEnum.Mace: return(new Mace(id, name, rarity, price, desc, damage)); case WeaponEnum.Halberd: return(new Halberd(id, name, rarity, price, desc, damage)); case WeaponEnum.Stylet: return(new Stylet(id, name, rarity, price, desc, damage)); case WeaponEnum.Spear: return(new Spear(id, name, rarity, price, desc, damage)); case WeaponEnum.Dart: return(new Dart(id, name, rarity, price, desc, damage)); case WeaponEnum.Saber: return(new Saber(id, name, rarity, price, desc, damage)); case WeaponEnum.Tomahawk: return(new Tomahawk(id, name, rarity, price, desc, damage)); default: return(null); } }
public EquipmentWeapon createEquipmentWeaponObject(WeaponEnum _WeaponEnum) { EquipmentWeapon equipmentWeaponObject = new EquipmentWeapon(); equipmentWeaponObject.Scale = 1; equipmentWeaponObject.Velocity = new Vector3(0, 0, 0); equipmentWeaponObject.StackMax = 1; equipmentWeaponObject.Size = new Microsoft.Xna.Framework.Vector3(32, 32, 0); equipmentWeaponObject.ItemEnum = ItemEnum.Weapon; switch (_WeaponEnum) { case WeaponEnum.Sword: { equipmentWeaponObject.NormalDamage = 4; equipmentWeaponObject.WeaponEnum = _WeaponEnum; Attack var_Attack = new Attack(50, 1.0f, 20.0f, AttackType.Front); equipmentWeaponObject.Attacks.Add(var_Attack); equipmentWeaponObject.Body.MainBody.TexturePath = "Character/Sword"; equipmentWeaponObject.ItemIconGraphicPath = "Object/Item/Small/Sword1"; //equipmentWeaponObject.SearchFlags.Add(new Map.World.SearchFlags.()); break; } case WeaponEnum.Spear: { equipmentWeaponObject.NormalDamage = 2; equipmentWeaponObject.WeaponEnum = _WeaponEnum; Attack var_Attack = new Attack(80, 1.0f, 30.0f, AttackType.Front); equipmentWeaponObject.Attacks.Add(var_Attack); break; } case WeaponEnum.Paper: { equipmentWeaponObject.NormalDamage = 5; equipmentWeaponObject.WeaponEnum = _WeaponEnum; Attack var_Attack = new Attack(80, 1.0f, 20.0f, AttackType.Front); equipmentWeaponObject.Attacks.Add(var_Attack); break; } } return(equipmentWeaponObject); }
public void AddWeapon(WeaponEnum we) { WeaponBase weapon = weapons[we]; if (inventory.Contains(weapon)) { inventory[inventory.IndexOf(weapon)].reload(); activeWeapon = inventory[inventory.IndexOf(weapon)]; } else { weapon.recycle(); inventory.Add(weapon); activeWeapon = weapon; } SoundManager.instance.PlaySingle(addWeaponSound); }
public void SpawnWeapon() { var v = Enum.GetValues(typeof(WeaponEnum)); int i = UnityEngine.Random.Range(indexOfSpawnWeps, countOfWeapons); weaponType = (WeaponEnum)v.GetValue(i); i -= indexOfSpawnWeps; for (int j = 0; j < pooledAmount; j++){ if (!weapons[i][j].activeInHierarchy) { weapons[i][j].transform.position = posGenerator.GenerateRandomPosition(); weapons[i][j].SetActive(true); break; } } SoundManager.instance.PlaySingle(itemSpawnSound); }
public override void TriggerWildcardAttack(WeaponEnum weaponMod) { ProjectileSpell spell = AbilityHandler.Instance.Attack.Spell as ProjectileSpell; switch (weaponMod) { case WeaponEnum.barrel: spell.ProjectileSpread = spell.BaseProjectileSpread * _tierStats[Tier - 1].BarrelSpread; break; case WeaponEnum.blade: spell.ProjectileSpread = spell.BaseProjectileSpread + spell.BaseProjectileSpread * _tierStats[Tier - 1].BladeSpread; break; case WeaponEnum.magiccore: Debug.Log("<color=green>LookClosely Magiccore</color>"); float aimDistance = _tierStats[Tier - 1].AimDistance; Debug.Log("Aim distance: " + aimDistance); RaycastHit[] hits = Physics.SphereCastAll(GameObject.FindWithTag("Player").transform.position, _aimBotTolerance, spell.DirectionVector, aimDistance, Physics.AllLayers); RaycastHit nearestEnemy = new RaycastHit(); nearestEnemy.distance = aimDistance; foreach (RaycastHit hit in hits) { if (hit.collider.gameObject.layer == 8 && hit.collider.gameObject.CompareTag("Enemy")) { if (nearestEnemy.distance >= hit.distance) { nearestEnemy = hit; } } } if (nearestEnemy.collider != null) { Vector3 positionWithoutY = new Vector3(spell.BulletSpawn.position.x, 0, spell.BulletSpawn.position.z); Vector3 bulletVector = nearestEnemy.transform.position - positionWithoutY; spell.DirectionVector = bulletVector; } break; case WeaponEnum.neutral: break; } }
public void equipWeapon(WeaponEnum newWeaponType) { //There's already a weapon equipped, delete it if (equippedWeaponObj != null) { Destroy(equippedWeaponObj); WeaponButtonPressed.RemoveAllListeners(); WeaponButtonHeld.RemoveAllListeners(); WeaponButtonReleased.RemoveAllListeners(); } Debug.Log("Spawning weapon type: " + newWeaponType); switch (newWeaponType) { case WeaponEnum.SWORD: equippedWeaponObj = (GameObject)Instantiate(weaponSwordPrefab); break; case WeaponEnum.RAPIER: equippedWeaponObj = (GameObject)Instantiate(weaponRapierPrefab); break; case WeaponEnum.HAMMER: equippedWeaponObj = (GameObject)Instantiate(weaponHammerPrefab); break; case WeaponEnum.WHIP: equippedWeaponObj = (GameObject)Instantiate(weaponWhipPrefab); break; case WeaponEnum.GREAT_SWORD: equippedWeaponObj = (GameObject)Instantiate(weaponGreatSwordPrefab); break; default: equippedWeaponObj = (GameObject)Instantiate(weaponSwordPrefab); break; } weaponControl = equippedWeaponObj.GetComponent <WeaponControlScript>(); WeaponButtonHeld.AddListener(weaponControl.OnWeaponButtonHeld); WeaponButtonPressed.AddListener(weaponControl.OnWeaponButtonPressed); WeaponButtonReleased.AddListener(weaponControl.OnWeaponButtonReleased); }
public GameLibrary.Model.Object.Equipment.EquipmentWeapon createEquipmentWeaponObject(WeaponEnum _WeaponEnum) { GameLibrary.Model.Object.Equipment.EquipmentWeapon equipmentWeaponObject = new GameLibrary.Model.Object.Equipment.EquipmentWeapon(); equipmentWeaponObject.Scale = 1; equipmentWeaponObject.Velocity = new Vector3(0, 0, 0); equipmentWeaponObject.StackMax = 1; equipmentWeaponObject.Size = new Microsoft.Xna.Framework.Vector3(32, 32, 0); equipmentWeaponObject.ItemEnum = ItemEnum.Weapon; switch (_WeaponEnum) { case WeaponEnum.Sword: { equipmentWeaponObject.NormalDamage = 4; equipmentWeaponObject.WeaponEnum = _WeaponEnum; Model.Object.Equipment.Attack.Attack var_Attack = new Model.Object.Equipment.Attack.Attack(50, 1.0f, 20.0f, Model.Object.Equipment.Attack.AttackType.Front); equipmentWeaponObject.Attacks.Add(var_Attack); equipmentWeaponObject.Body.MainBody.TexturePath = "Character/Sword"; equipmentWeaponObject.ItemIconGraphicPath = "Object/Item/Small/Sword1"; //equipmentWeaponObject.SearchFlags.Add(new GameLibrary.Model.Map.World.SearchFlags.()); break; } case WeaponEnum.Spear: { equipmentWeaponObject.NormalDamage = 2; equipmentWeaponObject.WeaponEnum = _WeaponEnum; Model.Object.Equipment.Attack.Attack var_Attack = new Model.Object.Equipment.Attack.Attack(80, 1.0f, 30.0f, Model.Object.Equipment.Attack.AttackType.Front); equipmentWeaponObject.Attacks.Add(var_Attack); break; } case WeaponEnum.Paper: { equipmentWeaponObject.NormalDamage = 5; equipmentWeaponObject.WeaponEnum = _WeaponEnum; Model.Object.Equipment.Attack.Attack var_Attack = new Model.Object.Equipment.Attack.Attack(80, 1.0f, 20.0f, Model.Object.Equipment.Attack.AttackType.Front); equipmentWeaponObject.Attacks.Add(var_Attack); break; } } return equipmentWeaponObject; }
public void WeaponShoot(WeaponEnum weaponEnum, Vector3 position) { Debug.Log("WeaponShoot"); var pool = ObjectPoolingService.GetWeaponObjectPool(weaponEnum); var bullet = pool.GetObject(); bullet.SetActive(true); bullet.GetComponent <BulletMovementScript>().Initialize(position); var definition = LoadedWeapons.FirstOrDefault(w => w.WeaponEnum == weaponEnum); if (definition != null) { SoundService.PlayClip(definition.ClipOnShot); CameraService.SetCameraFollowTarget(bullet.transform); } CheckIfShouldEndRound(); }
public void SpawnWeapon() { var v = Enum.GetValues(typeof(WeaponEnum)); int i = UnityEngine.Random.Range(indexOfSpawnWeps, countOfWeapons); weaponType = (WeaponEnum)v.GetValue(i); i -= indexOfSpawnWeps; for (int j = 0; j < pooledAmount; j++) { if (!weapons[i][j].activeInHierarchy) { weapons[i][j].transform.position = posGenerator.GenerateRandomPosition(); weapons[i][j].SetActive(true); break; } } SoundManager.instance.PlaySingle(itemSpawnSound); }
/// <summary> /// 是否具备某个武器 /// </summary> /// <param name="weapon">武器</param> /// <returns></returns> public bool HasWeapon(WeaponEnum weapon) { bool hasNow = weapons.Contains(weapon); BuffList.ForEach(x => { WeaponBuff buff = x as WeaponBuff; if (buff != null) { if (buff.IsAdding) { hasNow = true; return; } else { hasNow = false; } } }); return(hasNow); }
public int GetWeaponPriority(WeaponEnum weapon) { if (!aiBase.weaponHandling.IsWeaponReady(weapon)) { return 0; } float distanceFromMe; System.Random rnd = new System.Random(); switch (weapon) { case WeaponEnum.pistol: return 30; case WeaponEnum.sniper: //depends on distance to the taget distanceFromMe = aiMapLogic.GetDistance(aiBase.gameObject, targetObject); float factor = aiBase.mapWidth + 2 * distanceFromMe; return (int)factor; case WeaponEnum.MP40: //depends on distance to the taget distanceFromMe = aiMapLogic.GetDistance(aiBase.gameObject, targetObject); return 80 - (int)distanceFromMe; case WeaponEnum.flamethrower: //depends on distance to the taget distanceFromMe = aiMapLogic.GetDistance(aiBase.gameObject, targetObject); return 100 - 2*(int)distanceFromMe; case WeaponEnum.specialTesla: return rnd.Next(50,100); case WeaponEnum.specialEinstein: return rnd.Next(50, 100); case WeaponEnum.specialCurie: return rnd.Next(50, 100); case WeaponEnum.mine: if (aiBase.frameCountSinceLvlLoad > lastMineDroppedFrame + 50) { return rnd.Next(30, 70); } else { return 0; } case WeaponEnum.specialNobel: //dont drop all at once, wait a while if (aiBase.frameCountSinceLvlLoad > lastMineDroppedFrame + 50) { return rnd.Next(10,60); } else { return 0; } case WeaponEnum.specialDaVinci: return rnd.Next(50, 100); } return 1; }
public WeaponItemType(WeaponEnum weaponEnum) { this._itemType = weaponEnum; }
public bool IsWeaponReady(WeaponEnum weapon) { for (int i = inventory.Count - 1; i >= 0; i--) { if (inventory[i].weaponType == weapon && inventory[i].readyToFire) return true; } return false; }
public void RemoveFromInventoryAllBut(WeaponEnum weapon) { for (int i = inventory.Count - 1; i >= 0; i--) { if (inventory[i].weaponType != weapon) inventory.RemoveAt(i); } }