public GameObject Build(weaponType type) { GameObject go = WeaponFactory.instance.Create(type); switch (type) { case weaponType.pistol: ProjectileWeapon pistol = go.AddComponent <ProjectileWeapon> (); pistol.automatic = false; pistol.weaponName = "Pistol"; pistol.ammoType = 0; break; case weaponType.submachine: ProjectileWeapon smg = go.AddComponent <ProjectileWeapon> (); smg.automatic = true; smg.fireRate = 0.1f; smg.weaponName = "SMG"; smg.ammoType = 0; break; case weaponType.rocket: ProjectileWeapon rl = go.AddComponent <ProjectileWeapon>(); rl.automatic = true; rl.fireRate = 0.25f; rl.weaponName = "Rocket launcher"; rl.ammoType = 1; break; } return(go); }
public WEAPONS(bool buyable, bool sellable, string name, string description, Type type, int buyPrice, int sellPrice, float damage, float FireDam, float MagicDam, float ArtDam, bool offHand, scaleBonus Stats, bool twoHand, float manaOrStaminaChange, float Distance, weaponType wpType, int StrReq, int SkiReq, int PreReq, int IntReq, char Scaling, weaponClass WpClass, bool CanBuff, int Level, float time, float StrongTime) : base(buyable, sellable, false, name, description, true, Type.Weapon, buyPrice, sellPrice, false, 1, 1, ITEMS.StatBoost.None, 0, 0, ITEMS.typeOfItem.None) { baseDamage = curDamage = damage; isOffHand = offHand; status = Stats; isTwoHand = twoHand; decreaseStamina = manaOrStaminaChange; this.Distance = Distance; this.type = wpType; scaling = Scaling; strReq = StrReq; skiReq = SkiReq; intReq = IntReq; preReq = PreReq; wpClass = WpClass; canBuff = CanBuff; baseFireDamage = fireDamage = FireDam; baseMagicDamage = magicDamage = MagicDam; baseArtDamage = artDamage = ArtDam; level = Level; animTime = time; strongTime = StrongTime; }
public override void Import(ClientEffect importObject, IEnumerable <FieldInfo> getters) { base.Import(importObject, getters); base.Import(importObject, typeof(WeaponStatboostEffect), 1, 0, 3, 2, 5, Stat.None); this.weapon = Utility.GetWeaponType(importObject.reserved[4]); }
public WEAPONS(string name, float damage, float pInc, float FireDam, float fInc, float MagicDam, float mInc, float ArtDam, float aInc, bool offHand, bool twoHand, float manaOrStaminaChange, float Distance, weaponType type, weaponClass WpClass, bool CanBuff, int Level, float time, float StrongTime) : base(false, false, false, name, "", true, Type.Weapon, 0, 0, false, 1, 1, ITEMS.StatBoost.None, 0, 0, ITEMS.typeOfItem.None) { baseDamage = curDamage = damage; isOffHand = offHand; status = scaleBonus.none; isTwoHand = twoHand; decreaseStamina = manaOrStaminaChange; this.Distance = Distance; this.type = type; scaling = 'X'; strReq = 0; skiReq = 0; intReq = 0; preReq = 0; this.wpClass = WpClass; canBuff = CanBuff; baseFireDamage = fireDamage = FireDam; baseMagicDamage = magicDamage = MagicDam; baseArtDamage = artDamage = ArtDam; level = Level; animTime = time; strongTime = StrongTime; phyInc = pInc; fireInc = fInc; magicInc = mInc; artInc = aInc; }
void Awake() { coldDown = 1; weapontype = weaponType.laserNormal; laserRate = preTime + flyingTime + mcoldDown; laserPath = "Prefabs/bullets/normalLaser"; }
/// change the type of gun gust void ChangeTypeFire() { if (Input.GetKeyDown(KeyCode.B)) { switch (typeOfGun) { case weaponType.Machinegun: typeOfGun = weaponType.Burst; if (TypeFireText != null) { s_TypeFire = "Semi"; } break; case weaponType.Burst: typeOfGun = weaponType.Pistol; if (TypeFireText != null) { s_TypeFire = "Single"; } break; case weaponType.Pistol: typeOfGun = weaponType.Machinegun; if (TypeFireText != null) { s_TypeFire = "Full"; } break; } GetComponent <AudioSource>().clip = ReloadSound;//create a custom swicht sound GetComponent <AudioSource>().Play(); } }
//Run this in Start method in Unit and Enemy classes public static Weapon create(weaponType WeaponType, GameObject _weaponPrefab, Transform unitPosition) { switch (WeaponType) { case weaponType.Ak47: _weaponPrefab = (GameObject)Instantiate(Resources.Load("Weapons/Ak-47"), unitPosition); _weaponPrefab.transform.Translate(_weaponPrefab.transform.localPosition.x + 3f, _weaponPrefab.transform.localPosition.y + 1, _weaponPrefab.transform.localPosition.z + 4); break; case weaponType.Shotgun: _weaponPrefab = (GameObject)Instantiate(Resources.Load("Weapons/Shotgun"), unitPosition); _weaponPrefab.transform.Translate(_weaponPrefab.transform.localPosition.x + 2.8f, _weaponPrefab.transform.localPosition.y, _weaponPrefab.transform.localPosition.z + 3.3f); break; case weaponType.UMP45: _weaponPrefab = (GameObject)Instantiate(Resources.Load("Weapons/UMP-45"), unitPosition); _weaponPrefab.transform.Translate(_weaponPrefab.transform.localPosition.x + 2.5f, _weaponPrefab.transform.localPosition.y - 1, _weaponPrefab.transform.localPosition.z + 2); break; case weaponType.M4A1: _weaponPrefab = (GameObject)Instantiate(Resources.Load("Weapons/M4A1"), unitPosition); _weaponPrefab.transform.Translate(_weaponPrefab.transform.localPosition.x - 3f, _weaponPrefab.transform.localPosition.y, _weaponPrefab.transform.localPosition.z - 4); break; case weaponType.Sniper: _weaponPrefab = (GameObject)Instantiate(Resources.Load("Weapons/SniperRifle"), unitPosition); _weaponPrefab.transform.Translate(_weaponPrefab.transform.localPosition.x + 3f, _weaponPrefab.transform.localPosition.y + 1, _weaponPrefab.transform.localPosition.z); break; default: throw new ArgumentException(); } return(_weaponPrefab.GetComponent <Weapon>()); }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.W)) { if (currWeapon == weaponType.Spring) { currWeapon = weaponType.Rod; } else { currWeapon = weaponType.Spring; } } if (Input.GetKeyDown(KeyCode.Return)) { if (currWeapon == weaponType.Spring) { shootSpring(); } else { shootRod(); } } foreach (var link in mLinks) { link.CreateContacts(GameManager.Instance.mContacts); } }
public bool switchWeapon(weaponItem_property weapon) { weaponType weapontype = weapon.mType; switch (weapontype) { default: break; case weaponType.bulletNormal: disableAllWeapon(); enableComponent(bulletNormal); break; case weaponType.laserNormal: disableAllWeapon(); enableComponent(laserNormal); break; return(false); break; } upgradeShootProperties(weapon); return(true); }
void Start() { Random.seed = (int)System.DateTime.Now.Ticks; _secondsBetweenShots = 60 / rpm; currentType = weaponType.Gun; tracer = GetComponent <LineRenderer>(); }
void Awake() { checkForget(); weapontype = weaponType.bulletNormal; if (bulletName != "") { bulletPath = "Prefabs/bullets/" + bulletName; } }
public void init(string n, int l, float s, float rs, string t, weaponType w) { shipName = n; levelUnlocked = l; speed = s; rotationSpeed = rs; textureName = t; weapon = w; }
public void checkWeapon() { _currentWeaponInstance = FindObjectOfType <PlayerInventory>().currnetWeapon; current = _currentWeaponInstance.weapontype; damage = _currentWeaponInstance.damage; reloadSpeed = _currentWeaponInstance.reloadSpeed; totalAmmo = _currentWeaponInstance.totalAmmo; magSize = _currentWeaponInstance.magSize; stability = _currentWeaponInstance.stability; ammoInMag = _currentWeaponInstance.ammoInMag; fireRate = _currentWeaponInstance.fireRate; bulletVelocity = _currentWeaponInstance.bulletVelocity; projectile = _currentWeaponInstance.ammo; //// switch (current) // { //each value is set in scriptable object // case weaponType.pistol: // damage = 10; // reloadSpeed = 2; // totalAmmo = 60; // magSize = 6; // ammoInMag = 6; // fireRate = 1; // bulletVelocity = 500; // break; // // case weaponType.shotgun: // damage = 5; // reloadSpeed = 5; // totalAmmo = 25; // magSize = 5; // ammoInMag = 5; // fireRate = 1; // bulletVelocity = 500; // break; // case weaponType.assaultRifle: // damage = 10; // reloadSpeed = 5; // totalAmmo = 35; // magSize = 20; // ammoInMag = 20; // fireRate = .1f; // bulletVelocity = 500; // break; // case weaponType.DMR: // damage = 10; // reloadSpeed = 6; // totalAmmo = 15; // magSize = 3; // ammoInMag = 3; // fireRate = 3; // bulletVelocity = 700; // break; // default: // break; ////} }
public weapon(string name, double value, double weight, string damage, string Dtype, string Wtype) { this.name = name; this.value = value; this.weight = weight; this.damage = damage; this.dType = helpers.stringToDamageType(Dtype); this.wType = weapon.stringToType(Wtype); }
// Set the type of weapon public void setWeaponType(weaponType w) { if (this.iTypeMain == itemType.WEAPON || this.iTypeSub == itemType.WEAPON) { this.wType = w; this.aType = armorType.WEAPON; } return; }
public void init(string n, int l, float s, float rs, string t, weaponType w) { shipName = n; levelUnlocked= l; speed = s; rotationSpeed = rs; textureName = t; weapon= w; }
//when player grabs a weapon this changes attack stats public void setWeapon(weaponType _weapon) { //Weapon active = this.activeWeapon; //attack = active.getAttackBonus(ab); activeWeapon = _weapon; //not perfectly implemented yet //will also change other aspects of weapon including type and animation }
public Weapon(string name) : base(name) { var index = System.Array.IndexOf(weaponAttribs, name); type = (weaponType)System.Enum.Parse(typeof(weaponType), weaponAttribs[index + 1]); impact = float.Parse(weaponAttribs[index + 2], System.Globalization.CultureInfo.InvariantCulture.NumberFormat); endurance = float.Parse(weaponAttribs[index + 3], System.Globalization.CultureInfo.InvariantCulture.NumberFormat); cadence = float.Parse(weaponAttribs[index + 4], System.Globalization.CultureInfo.InvariantCulture.NumberFormat); speed = float.Parse(weaponAttribs[index + 5], System.Globalization.CultureInfo.InvariantCulture.NumberFormat); }
public void Copy(WeaponInfo other) { type = other.type; weaponSprite = other.weaponSprite; bulletSprite = other.bulletSprite; shotEffectSprite = other.shotEffectSprite; numOfBullets = other.numOfBullets; coolDown = other.coolDown; shotEffectSpeed = other.shotEffectSpeed; throwBackAmount = other.throwBackAmount; }
//被外部调用修改子弹的属性 public void setProperty(weaponType weapon, int damage, int knock, float damamgeRate, bulletSpeStruct bulletStruct, constant.BattleType battleType) { //Debug.Log ("子弹击退效果: " + knock); weapontype = weapon; bulletDamage = damage; bulletknock = knock; bulletDamageRate = damamgeRate; bulletSpe = bulletStruct; mBattleType = battleType; //Debug.Log ("子弹类型: " + weapontype); }
public WeaponInfo(weaponType _type, Sprite gunS, Sprite bulletS, Sprite shotEffectS, int bulletNum, float _coolDown, float shotEfSpeed, float trwBack) { type = _type; weaponSprite = gunS; bulletSprite = bulletS; shotEffectSprite = shotEffectS; numOfBullets = bulletNum; coolDown = _coolDown; shotEffectSpeed = shotEfSpeed; throwBackAmount = trwBack; }
void switchGun() { if (gun == weaponType.MISSILE) { gun = weaponType.SEMI; } else { gun += 1; } }
/// <summary> /// Allows the player to select which weapon they want to use. /// </summary> /// <param name="type">The weapon they would like to use. Check the weaponType enum for possible options.</param> public void SelectWeapon(weaponType type) { switch (type) { case weaponType.explosive: this.Weapon = new ExplodeAmmo(); break; case weaponType.piercing: this.Weapon = new PiercingAmmo(); break; } }
// Get all weapons of a given weapon type public List <Item> getWeapon(weaponType a) { List <Item> weapons = new List <Item>(); for (int i = 0; i < this.inventory.Count; i++) { if (this.inventory[i].getMain() == itemType.WEAPON && this.inventory[i].getWeaponType() == a && this.inventory[i].getAmt() > 0) { weapons.Add(this.inventory[i]); } } return(weapons); }
public override void Import(ClientEffect importObject, IEnumerable <FieldInfo> getters) { base.Import(importObject, getters); this.weapon = Utility.GetWeaponType(importObject.reserved[4]); this.change = new ChangeList(); var change = new Change(); change.stat = modifiersenum.PHYSICAL_ATTACK; change.value = Int32.Parse(importObject.reserved[1]); change.delta = Int32.Parse(importObject.reserved[0]); change.func = StatFunc.PERCENT; this.change.Add(change); }
public void switchWeapon() { if (currentType == weaponType.Gun) { minigunTransform.SetActive(false); swordTransform.GetComponent <Renderer>().enabled = true; currentType = weaponType.Melee; } else { minigunTransform.SetActive(true); swordTransform.GetComponent <Renderer>().enabled = false; currentType = weaponType.Gun; } }
public void selectWeapon(weaponType weapontype) { switch (weapontype) { default: break; case weaponType.bulletNormal: gameObject.AddComponent <robotShotNormalBullet>(); break; case weaponType.laserNormal: break; break; } }
int attack, defense, speed, health, max_health; //Bonuses from items // player has an attack, speed, and health or hp stat // a small weapon inventory, size is to be decided // or a system of active/secondary weapons can be used /// <summary> /// Constructor for a Player object /// </summary> /// <param name="xLoc">Input the initial x coordinate of the player</param> /// <param name="yLoc">Input the initial y coordinate of the player</param> public Player(int xLoc, int yLoc, int pWidth, int pHeight) { last_x = x = xLoc; last_y = y = yLoc; width = pWidth; height = pHeight; // set player position max_health = health = 100; // give the user 100 "units" of health speed = 3; // move at 3 pixels/frame attack = defense = 0; // no additional boosts by default activeWeapon = weaponType.NONE; // user starts with no weapons by default dir = PlayerDir.UP; // facing up by default moving = false; // users not moving by default col_tok = null; inventory = new List <Item>(); // has no inventory by default hurt = false; // user has not been hurt yet }
/// <summary> /// Constructor for a Player object /// </summary> /// <param name="xLoc">Input the initial x coordinate of the player</param> /// <param name="yLoc">Input the initial y coordinate of the player</param> // player has an attack, speed, and health or hp stat // a small weapon inventory, size is to be decided // or a system of active/secondary weapons can be used public Player(int xLoc, int yLoc, int pWidth, int pHeight) { last_x = x = xLoc; last_y = y = yLoc; width = pWidth; height = pHeight; max_health = health = 100; speed = 3; attack = defense = 0; activeWeapon = weaponType.NONE; //secondaryWeapon = null; dir = PlayerDir.UP; moving = false; col_tok = null; inventory = new List <Item>(); hurt = false; }
// Update is called once per frame void Update() { gunAmmoUIStr = returnUpdates(); if (Input.GetKeyDown(KeyCode.Mouse0) || Input.GetKeyDown(KeyCode.LeftShift)) { Pew(); } if (Input.GetKey(KeyCode.Mouse0) && currentWeapon == weaponType.machineGun && fired == false && ammo[1] != 0) { StartCoroutine(PewMachineGun()); } if (Input.GetKeyDown(KeyCode.E)) { currentWeapon = (currentWeapon != weaponType.mine) ? currentWeapon + 1 : weaponType.pistol; } if (Input.GetKeyDown(KeyCode.Q)) { currentWeapon = (currentWeapon != weaponType.pistol) ? currentWeapon - 1 : weaponType.mine; } switch (currentWeapon) { case weaponType.pistol: m_animator.SetInteger("Gun", 1); break; case weaponType.shotgun: m_animator.SetInteger("Gun", 2); break; case weaponType.machineGun: m_animator.SetInteger("Gun", 3); break; case weaponType.mine: m_animator.SetInteger("Gun", 4); break; default: Debug.Log("ERROR: Invalid Weapon Type"); return; } }
public WEAPONS() { baseDamage = 0; isOffHand = false; status = scaleBonus.none; isTwoHand = false; decreaseStamina = 0; this.Distance = 0; this.type = weaponType.Edge; scaling = 'S'; strReq = 0; skiReq = 0; intReq = 0; wpClass = weaponClass.Sword; canBuff = false; baseFireDamage = 0; baseMagicDamage = 0; baseArtDamage = 0; level = 0; animTime = 0f; strongTime = 0f; }
/// <summary> /// Constructor for a Player object /// </summary> /// <param name="xLoc">Input the initial x coordinate of the player</param> /// <param name="yLoc">Input the initial y coordinate of the player</param> // player has an attack, speed, and health or hp stat // a small weapon inventory, size is to be decided // or a system of active/secondary weapons can be used public Player(int xLoc, int yLoc, int pWidth, int pHeight) { last_x = x = xLoc; last_y = y = yLoc; width = pWidth; height = pHeight; max_health = health = 100; speed = 3; attack = defense = 0; activeWeapon = weaponType.NONE; //secondaryWeapon = null; dir = PlayerDir.UP; moving = false; col_tok = null; inventory = new List<Item>(); hurt = false; }
/// change the type of gun gust void ChangeTypeFire() { if (Input.GetKeyDown(KeyCode.B)) { switch (typeOfGun) { case weaponType.Machinegun: typeOfGun = weaponType.Burst; if (TypeFireText != null) s_TypeFire = "Semi"; break; case weaponType.Burst: typeOfGun = weaponType.Pistol; if (TypeFireText != null) s_TypeFire = "Single"; break; case weaponType.Pistol: typeOfGun = weaponType.Machinegun; if (TypeFireText != null) s_TypeFire = "Full"; break; } GetComponent<AudioSource>().clip = ReloadSound;//create a custom swicht sound GetComponent<AudioSource>().Play(); } }
int y; // y position #endregion Fields #region Constructors // player has an attack, speed, and health or hp stat // a small weapon inventory, size is to be decided // or a system of active/secondary weapons can be used /// <summary> /// Constructor for a Player object /// </summary> /// <param name="xLoc">Input the initial x coordinate of the player</param> /// <param name="yLoc">Input the initial y coordinate of the player</param> public Player(int xLoc, int yLoc, int pWidth, int pHeight) { last_x = x = xLoc; last_y = y = yLoc; width = pWidth; height = pHeight; // set player position max_health = health = 100; // give the user 100 "units" of health speed = 3; // move at 3 pixels/frame attack = defense = 0; // no additional boosts by default activeWeapon = weaponType.NONE; // user starts with no weapons by default dir = PlayerDir.UP; // facing up by default moving = false; // users not moving by default col_tok = null; inventory = new List<Item>(); // has no inventory by default hurt = false; // user has not been hurt yet }
//when player grabs a weapon this changes attack stats public void setWeapon(weaponType _weapon) { activeWeapon = _weapon; }
public override void Import(ClientEffect importObject, IEnumerable<FieldInfo> getters) { base.Import(importObject, getters); this.weapon = Utility.GetWeaponType(importObject.reserved[4]); this.change = new ChangeList(); var change = new Change(); change.stat = modifiersenum.PHYSICAL_ATTACK; change.value = Int32.Parse(importObject.reserved[1]); change.delta = Int32.Parse(importObject.reserved[0]); change.func = StatFunc.PERCENT; this.change.Add(change); }
public override void Import(ClientEffect importObject, IEnumerable<FieldInfo> getters) { base.Import(importObject, getters); base.Import(importObject, typeof(WeaponStatupEffect), 1, 0, 1, 0, 5, Stat.None); this.weapon = Utility.GetWeaponType(importObject.reserved[4]); }
public WeaponMasteryEffect(weaponType weapon) { this.weapon = weapon; }
public void setActiveWeapon(weaponType w) { activeWeapon = (int)w; }