private void onWeaponChanged(GameObject o, Weapon.WeaponData previous, Weapon.WeaponData current) { if (previous != null) { if (previous.param.type == Weapon.Type.SMG) { previous.param.reload *= SMG_BONUS; unit.speed /= SMG_BONUS; } else if (previous.param.type == Weapon.Type.PISTOL) { previous.param.reload *= PISTOL_BONUS; previous.param.aim *= PISTOL_AIM_BONUS; unit.speed /= PISTOL_BONUS; } } if (current != null) { if (current.param.type == Weapon.Type.SMG) { current.param.reload /= SMG_BONUS; unit.speed *= SMG_BONUS; } else if (current.param.type == Weapon.Type.PISTOL) { current.param.reload /= PISTOL_BONUS; current.param.aim /= PISTOL_AIM_BONUS; unit.speed *= PISTOL_BONUS; } } }
override public void init(GameObject cst, object param = null) { base.init(cst, param); Soldier soldier = caster.GetComponent <Soldier>(); grenade = soldier.grenade; }
public void setWeapon(Weapon.WeaponData wd) { Debug.Assert(wd != null && wd.param != null, "[WeaponPickup] Attempt to set a null weapon to pickup."); wdata = wd; spriteRenderer.sprite = sprites[wdata.param.sprite]; }
public bool takeWeapon(Weapon.WeaponData wdata) { if (weapons[wdata.param.category] != null) { return(false); } weapons[wdata.param.category] = wdata; return(true); }
public bool switchSecondary() { Weapon.WeaponData wdata = weapons[wIndex]; if (wdata == null || wdata.secondary == null) { return(false); } weapon.weapon = weapon.weapon == wdata ? wdata.secondary : wdata; return(true); }
void Start() { animator = GetComponent <Animator> (); weapon = GetComponent <Weapon> (); for (int i = 0; i < weapons.Length; i++) { Weapon.WeaponData wdata = weapons[i]; wdata.init(); wdata.applyAtachments(); } weaponIndex = 0; }
private void LoadWeapons() { Weapons = new Dictionary <string, Weapon.WeaponData>(); XmlDocument gamedata = Resource.GetXmlFromResource("data.weapons.xml", Assembly); foreach (XmlNode node in gamedata.SelectNodes("/weapons/weapon")) { Weapon.WeaponData weapon = new Weapon.WeaponData(node, Lua); Weapons.Add(weapon.ID, weapon); } }
override public void init(GameObject cst, object param = null) { base.init(cst, param); switch_to = soldier.weaponIndex; for (int i = 0; i < soldier.weapons.Length; i++) { Weapon.WeaponData wdata = soldier.weapons[i]; if (soldier.weaponIndex != i && wdata != null && (wdata.ammo > 0 || wdata.clip > 0)) { switch_to = i; break; } } }
public Weapon.WeaponData getGun() { Weapon.WeaponData data = new Weapon.WeaponData(guns[gunDD.value]); List <string> list = new List <string>(); if (scopeDD.value != 0) { list.Add(getAttachment(Attachment.SCOPE)); } if (undersulgDD.value != 0) { list.Add(getAttachment(Attachment.UNDERSLUG)); } data.attachments = list.ToArray(); return(data); }
public void setWeapons(Weapon.WeaponData[] value) { for (int i = 0; i < weapons.Length; i++) { Weapon.WeaponData wdata = weapons[i]; wdata.removeAtachments(); } weapons = value; for (int i = 0; i < weapons.Length; i++) { Weapon.WeaponData wdata = weapons[i]; wdata.init(); wdata.applyAtachments(); } wIndex = -1; weaponIndex = 0; }
override public void onAnimation(int param = 0) { AnimatorStateInfo info = animator.GetCurrentAnimatorStateInfo(0); if (animState != info.shortNameHash) return; if(param == 1) { Soldier soldier = caster.GetComponent<Soldier>(); Weapon.WeaponData wdata = soldier.melee; Collider[] hitColliders = Physics.OverlapSphere(caster.transform.position, RANGE*10, 1, QueryTriggerInteraction.Ignore); foreach (Collider collider in hitColliders) { GameObject other = collider.gameObject; Unit unit = other.GetComponent<Unit>(); Health health = other.GetComponent<Health>(); if (unit != null && health != null && other != caster && Quaternion.Angle(caster.transform.rotation, Quaternion.LookRotation(other.transform.position - caster.transform.position)) <= ANGLE) { Damage damage = wdata.getDamage(caster); health.receiveDamage(damage.getDamageValue(0, 0)); } } } else { complete(); } }
override public void add(Weapon.WeaponData wdata) { wdata.secondary = new Weapon.WeaponData("M870MCS"); }
virtual public void add(Weapon.WeaponData wdata) { }
virtual public void remove(Weapon.WeaponData wdata) { }
override public void add(Weapon.WeaponData wdata) { wdata.param.aim *= AIM; wdata.param.aimFallTurn *= AIM_TURN; wdata.param.aimFallWalk *= AIM_WALK; }
override public void remove(Weapon.WeaponData wdata) { wdata.param.aim /= AIM; wdata.param.aimFallTurn /= AIM_TURN; wdata.param.aimFallWalk /= AIM_WALK; }
override public void remove(Weapon.WeaponData wdata) { wdata.secondary = null; }