protected Quat GetFireRotation( WeaponType.WeaponMode typeMode ) { Quat rot = setForceFireRotation ? forceFireRotation : Rotation; return rot * typeMode.StartOffsetRotation; }
protected Vec3 GetFirePosition( WeaponType.WeaponMode typeMode ) { Quat rot = setForceFireRotation ? forceFireRotation : Rotation; return Position + rot * typeMode.StartOffsetPosition; }
//Incin - give weapons to players public bool GiveWeapon(WeaponType weaponType, Unit unit) { Weapon weapon = null; PlayerCharacter playerCharacter = null; playerCharacter = unit as PlayerCharacter; int index = GetWeaponIndex(weaponType); if (index == -1) return false; if (weapons[index].exists) return true; weapons[index].exists = true; SetActiveWeapon(index); if (playerCharacter != null) { weapon = playerCharacter.ActiveWeapon; } else return false; Gun gun = weapon as Gun; if (gun != null) { if (gun.Type.NormalMode != null && (gun.Type.NormalMode.BulletType != null && gun.Type.NormalMode.BulletCapacity != 0)) { gun.AddBullets(gun.Type.NormalMode.BulletType, gun.Type.NormalMode.BulletCapacity); TakeBullets(gun.Type.NormalMode.BulletType, gun.Type.NormalMode.BulletCapacity); //BulletItem bullet = (Bullet)gun.Type.NormalMode.BulletType.GetType(); //bullet.GiveBullets(unit); } else { ; } if (gun.Type.AlternativeMode != null && (gun.Type.AlternativeMode.BulletType != null && gun.Type.AlternativeMode.BulletCapacity != 0)) { gun.AddBullets(gun.Type.AlternativeMode.BulletType, gun.Type.AlternativeMode.BulletCapacity); TakeBullets(gun.Type.AlternativeMode.BulletType, gun.Type.AlternativeMode.BulletCapacity); } else { ; } } return true; }
public bool TakeWeapon(WeaponType weaponType) { int index = GetWeaponIndex(weaponType); if (index == -1) return false; if (weapons[index].exists) return true; weapons[index].exists = true; SetActiveWeapon(index); return true; }
public int GetWeaponIndex(WeaponType weaponType) { for (int n = 0; n < Type.Weapons.Count; n++) if (Type.Weapons[n].WeaponType == weaponType) return n; return -1; }