public void Reload() { foreach (WeaponBase ActiveWeapon in PrimaryWeapons.ActiveWeapons) { ActiveWeapon.Reload(ActiveMovementStance, this); } }
public static void Attack(int Length) { if (!ActiveWeapon.isPistol()) { Memory.Write<int>(Memory.client + Offsets.dwForceAttack, 5); while (ShotsFired < Length) { Entity p = new Entity(CrosshairID); if (p.Dormant || p.Health <= 0) break; } Memory.Write<int>(Memory.client + Offsets.dwForceAttack, 4); Thread.Sleep(500); } else { while (ShotsFired < Length) { Entity p = new Entity(CrosshairID); if (p.Dormant || p.Health <= 0) break; if (ActiveWeapon.CanFire) Attack(); } Thread.Sleep(500); } }
void EnemyPlayer_OnTargetSelected(Player target) { myTarget = target.transform.position; ActiveWeapon.SetAimPoint(target.transform.position); ActiveWeapon.AimTargetOffset = Vector3.up * 1.5f; StartBurst(); }
public void UnholsterWeaponsIfNeeded() { if (PrimaryWeapons.HasHolsteredWeapons) { if (PrimaryWeapons.ActiveWeapons.Contains(SecondaryWeapons.ActiveWeapons[0])) { foreach (WeaponBase ActiveWeapon in PrimaryWeapons.ActiveWeapons) { RemovePartialAnimation(ActiveWeapon.GetAnimationName(ActiveMovementStance)); } PrimaryWeapons.RemoveAllActiveWeapons(); } List <WeaponBase> ListUnHolsteredWeapon = PrimaryWeapons.UseHolsteredWeapons(); foreach (WeaponBase WeaponToUse in ListUnHolsteredWeapon) { WeaponToUse.CurrentAnimation = null; WeaponToUse.ResetAnimation(ActiveMovementStance); WeaponToUse.InitiateFollowingAttack(true, ActiveMovementStance, this); if (WeaponToUse.CurrentAnimation == null) { ActivatePartialWeapon(WeaponToUse, WeaponToUse.GetAnimationName(ActiveMovementStance)); } } } }
public void ChangeWeapon(int WeaponIndex) { if (WeaponIndex == -1)//Unequip weapon { foreach (WeaponBase ActiveWeapon in PrimaryWeapons.ActiveWeapons) { RemovePartialAnimation(ActiveWeapon.GetAnimationName(ActiveMovementStance)); } PrimaryWeapons.RemoveAllActiveWeapons(); PrimaryWeapons.UseWeapon(CurrentStanceAnimations); } else { string WeaponName = PrimaryWeapons.GetWeaponName(WeaponIndex); PrimaryWeapons.RemoveAllActiveWeapons(); PrimaryWeapons.UseWeapon(WeaponName); WeaponBase WeaponToUse = PrimaryWeapons.GetWeapon(WeaponName); WeaponToUse.CurrentAnimation = null; WeaponToUse.ResetAnimation(ActiveMovementStance); WeaponToUse.InitiateFollowingAttack(true, ActiveMovementStance, this); if (WeaponToUse.CurrentAnimation == null) { ActivatePartialWeapon(WeaponToUse, WeaponToUse.GetAnimationName(ActiveMovementStance)); } } }
void Update() { if (GameManager.Instance.InputController.MouseWheelDown) { SwitchWeapon(1); } if (GameManager.Instance.InputController.MouseWheelUp) { SwitchWeapon(-1); } if (GameManager.Instance.LocalPlayer.PlayerState.MoveState == PlayerState.EMoveState.SPRINTING) { return; } if (!canFire) { return; } if (GameManager.Instance.InputController.Fire1) { ActiveWeapon.Fire(); } }
public void Reset() { transform.rotation = Quaternion.identity; transform.position = Vector3.zero; CurrentReward = 0; CurrentSpeed = 0; currentDirection = 1; CurrentHandlingClass = HandlingClass; ActivePowerPlant = new ActiveCarPart(CarPowerPlant); ActiveWeapons = new ActiveWeapon[Weapons.Length]; drivable = true; Phase = 0; Turn = 0; ManeuverState = 0; AccelerationPerformed = false; InCrash = false; CurrentManeuver = -1; RollParam = 0; CrashResultIndex = -1; for (int i = 0; i < ActiveWeapons.Length; i++) { ActiveWeapons[i] = new ActiveWeapon(Weapons[i], WeaponOrientaions[i]); } for (int i = 0; i < Tires.Length; i++) { Tires[i] = TireType.MaxDP; } for (int i = 0; i < Sides.Length; i++) { Sides[i] = SideMaxDP; } }
public static void Attack(bool auto) { if (!auto) return; if (!ActiveWeapon.isPistol()) { Memory.Write<int>(Memory.client + Offsets.dwForceAttack, 5); while (CrosshairID >= 0 && CrosshairID <= 65) { Entity p = new Entity(CrosshairID); if (p.Dormant || p.Health <= 0) break; Thread.Sleep(1); } Memory.Write<int>(Memory.client + Offsets.dwForceAttack, 4); } else { while (CrosshairID >= 0 && CrosshairID <= 65) { Entity p = new Entity(CrosshairID); if (p.Dormant || p.Health <= 0) break; if (ActiveWeapon.CanFire) Attack(); } } }
void CheckReload() { if (ActiveWeapon.reloader.RoundsRemainingInClip == 0) { ActiveWeapon.Reload(); } }
/// <summary> /// Control player weapon using behaviour /// </summary> private void PlayerShoot() { if (Input.GetButtonDown("Fire1") && !freezeInput && MVUtility.Geq(weaponPower, ActiveWeapon.WeaponUsage)) { weaponRechargeDelay = weaponRechargeDelayMax; weaponRechargeDelayStart = false; weaponCanRecharge = false; ActiveWeapon.StartUse(); weaponAttackMovingPenalty = weaponAttackMovingPenaltyMax; // animator.SetTrigger("Attack"); // animator.SetBool("HoldFire", true); } else if (Input.GetButtonUp("Fire1") || freezeInput) { weaponRechargeDelayStart = true; ActiveWeapon.EndUse(); // animator.SetBool("HoldFire", false); } else if (Input.GetButton("Fire1") && !freezeInput) { if (ActiveWeapon.chargeUse && MVUtility.Geq(weaponPower, ActiveWeapon.WeaponUsage) && ActiveWeapon.fired) { weaponRechargeDelay = weaponRechargeDelayMax; weaponRechargeDelayStart = false; weaponCanRecharge = false; weaponAttackMovingPenalty = weaponAttackMovingPenaltyMax; } else { weaponRechargeDelayStart = true; } ActiveWeapon.HoldUse(); } }
private void ActivateWeapon(int weaponIndex) { ActiveWeapon.SetActive(false); _activeWeaponIndex = weaponIndex; ActiveWeapon.SetActive(true); ActiveWeaponConfig.Value = ActiveWeapon.Config; }
// Player private void OnTriggerStay(Collider other) { ActiveWeapon activeWeapon = other.gameObject.GetComponent <ActiveWeapon>(); if (activeWeapon && activeWeapon.PickupWeapon) { if (!activeWeapon.weapon) { RaycastWeapon newWeapon = Instantiate(weaponFab); activeWeapon.Equip(newWeapon); GameEvents.events.CallUpdateAmmo(); } if (activeWeapon.weapon.weaponName != weaponName) { RaycastWeapon newWeapon = Instantiate(weaponFab); activeWeapon.Equip(newWeapon); GameEvents.events.CallUpdateAmmo(); } if (activeWeapon.weapon.weaponName == weaponName) { activeWeapon.weapon.AddAmmo(amountToAdd); GameEvents.events.CallUpdateAmmoDelayed(0.05f); } GameEvents.events.CallUpdateAmmo(); Destroy(gameObject); } }
void CheckReload() { if (ActiveWeapon.Reloader.RoundsRemainingInClip == 0) //ways to expand this: if < 3 reload, but if enemy close skip reload { ActiveWeapon.Reload(); } }
public void Load(ContentManager Content) { foreach (WeaponBase ActiveWeapon in DicWeaponByName.Values) { ActiveWeapon.Load(Content); } }
public override void Load() { sprBackground = Content.Load <Texture2D>("Triple Thunder/HUD/Menus/Weapon Selection/Background"); sprExtraWeaponBackground = Content.Load <Texture2D>("Triple Thunder/HUD/Menus/Weapon Selection/Extra Weapon Background"); sprNumber = Content.Load <Texture2D>("Triple Thunder/HUD/Menus/Weapon Selection/Number"); WeaponOutlineButton = new AnimatedSprite(Content, "Triple Thunder/HUD/Menus/Weapon Selection/Weapon Button Outline", new Vector2(0, 0), 0, 1, 4); WeaponOutlineButton.SetFrame(2); ListDefaultWeapon.Add(new WeaponSelectionItem("AK-47")); ListDefaultWeapon.Add(new WeaponSelectionItem("Ingram MAC 10")); ListDefaultWeapon.Add(new WeaponSelectionItem("Scout")); ListDefaultWeapon.Add(new WeaponSelectionItem("M3")); ListDefaultWeapon.Add(new WeaponSelectionItem("M79")); ListDefaultWeapon.Add(new WeaponSelectionItem("MG42")); SelectedWeapon = ListDefaultWeapon[0]; foreach (WeaponSelectionItem ActiveWeapon in ListDefaultWeapon) { ActiveWeapon.Load(Content); } foreach (WeaponMenuEquipment ActiveWeapon in Owner.Equipment.ArrayEquipedPrimaryWeapon) { ListPersonalWeapon.Add(new WeaponSelectionItem(ActiveWeapon.Name)); } foreach (WeaponSelectionItem ActiveWeapon in ListPersonalWeapon) { ActiveWeapon.Load(Content); } }
protected override void OnStart() { ragdoll = GetComponent <Ragdoll>(); weapons = GetComponent <ActiveWeapon>(); aiming = GetComponent <CharacterAiming>(); postProcessing = FindObjectOfType <PostProcessVolume>().profile; camManagaer = FindObjectOfType <CameraManager>(); }
void Update() { if (!shouldFire || !CanFire || !enemyPlayer.EnemyHealth.IsAlive) { return; } ActiveWeapon.Fire(); }
// Start is called before the first frame update void Start() { mainCamera = Camera.main; Cursor.visible = false; Cursor.lockState = CursorLockMode.Locked; animator = GetComponent <Animator>(); activeWeapon = GetComponent <ActiveWeapon>(); }
// Start is called before the first frame update void Start() { animator = GetComponent <Animator>(); cc = GetComponent <CharacterController>(); activeWeapon = GetComponent <ActiveWeapon>(); reloadWeapon = GetComponent <ReloadWeapon>(); characterAiming = GetComponent <CharacterAiming>(); }
void checkReload() { if (ActiveWeapon.reloader.RoundsRemainingInClip == 0) { CrouchState(); ActiveWeapon.Reload(); } }
void CheckForRealoed() { if (ActiveWeapon.reloader.RoundsRemainingInClip == 0) { ActiveWeapon.Reload(); } CrouchState(); }
void Update() { if (!shootFire || !canFire || !enemy.EnemyHealth.isAlive) { return; } ActiveWeapon.Fire(); }
protected override void OnStart() { _weapon = GetComponent <ActiveWeapon>(); _aiming = GetComponent <CharacterAiming>(); _animator = GetComponent <Animator>(); _healthEffectController = GetComponent <PlayerHealthEffectController>(); _equipment = GetComponent <Equipment>(); _player = GetComponent <PlayerController>(); }
public void UpdateSkills(string RequirementName) { CurrentLayer.SetRobotContext(this); foreach (WeaponBase ActiveWeapon in PrimaryWeapons.ActiveWeapons) { ActiveWeapon.UpdateSkills(RequirementName); } }
private void OnTriggerStay(Collider other) { activeWeapon = other.gameObject.GetComponent <ActiveWeapon>(); if (activeWeapon && Input.GetButtonDown("Equip")) { RaycastWeapon newWeapon = Instantiate(weaponPrefab); activeWeapon.Equip(newWeapon); } }
public void Logic() { if (AreaOfVision.IntersectsWith(BelongsToLevel.Player.HitBox) && ActiveWeapon != null && !ActiveWeapon.InAction) { ActiveWeapon.LightAttack(); } ChangeMonsterPosition(); }
public override ISpecialAction NextSpecialAction() { if (next == null) { next = new ActiveWeapon(this); } return(next); }
public void InitiateAttack(GameTime gameTime, AttackInputs AttackInput) { foreach (WeaponBase ActiveWeapon in PrimaryWeapons.ActiveWeapons) { if (ActiveWeapon.InitiateAttack(gameTime, AttackInput, CurrentMovementInput, ActiveMovementStance, false, this)) { break; } } }
public void UpdateAllWeaponsAngle(Vector2 Target) { int W = 0; foreach (WeaponBase ActiveWeapon in PrimaryWeapons.ActiveWeapons) { bool RotateTowardMouse = ActiveWeapon.CanRotateTowardMouse(ActiveMovementStance); float Angle = 0; if (RotateTowardMouse) { Angle = (float)Math.Atan2(Target.Y, Target.X); } ActiveWeapon.WeaponAngle = Angle; if (Angle <= -MathHelper.PiOver2 || Angle >= MathHelper.PiOver2) { ActiveSpriteEffects = SpriteEffects.None; } else { ActiveSpriteEffects = SpriteEffects.FlipHorizontally; Angle = MathHelper.Pi - Angle; } UpdatePrimaryWeaponAngle(Angle + MathHelper.Pi, W++); } W = 0; foreach (WeaponBase ActiveWeapon in SecondaryWeapons.ActiveWeapons) { bool RotateTowardMouse = ActiveWeapon.CanRotateTowardMouse(ActiveMovementStance); float Angle = 0; if (RotateTowardMouse) { Angle = (float)Math.Atan2(Target.Y, Target.X); } ActiveWeapon.WeaponAngle = Angle; if (Angle <= -MathHelper.PiOver2 || Angle >= MathHelper.PiOver2) { ActiveSpriteEffects = SpriteEffects.None; } else { ActiveSpriteEffects = SpriteEffects.FlipHorizontally; Angle = MathHelper.Pi - Angle; } UpdateSecondaryWeaponAngle(Angle, W++); } }
public void ProcessAttack(PlayerCmd pCmd, float delta) { if (pCmd.attack == 1) { ActiveWeapon.ShootPressed = true; ActiveWeapon.Shoot(pCmd, delta); return; } ActiveWeapon.ShootPressed = false; }