Ejemplo n.º 1
0
 public void Reload()
 {
     foreach (WeaponBase ActiveWeapon in PrimaryWeapons.ActiveWeapons)
     {
         ActiveWeapon.Reload(ActiveMovementStance, this);
     }
 }
Ejemplo n.º 2
0
        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);
            }
        }
Ejemplo n.º 3
0
 void EnemyPlayer_OnTargetSelected(Player target)
 {
     myTarget = target.transform.position;
     ActiveWeapon.SetAimPoint(target.transform.position);
     ActiveWeapon.AimTargetOffset = Vector3.up * 1.5f;
     StartBurst();
 }
Ejemplo n.º 4
0
        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));
                    }
                }
            }
        }
Ejemplo n.º 5
0
        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));
                }
            }
        }
Ejemplo n.º 6
0
    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();
        }
    }
Ejemplo n.º 7
0
 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;
     }
 }
Ejemplo n.º 8
0
        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();
                }
            }
        }
Ejemplo n.º 9
0
 void CheckReload()
 {
     if (ActiveWeapon.reloader.RoundsRemainingInClip == 0)
     {
         ActiveWeapon.Reload();
     }
 }
Ejemplo n.º 10
0
        /// <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;
 }
Ejemplo n.º 12
0
    // 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);
        }
    }
Ejemplo n.º 13
0
 void CheckReload()
 {
     if (ActiveWeapon.Reloader.RoundsRemainingInClip == 0)         //ways to expand this: if < 3 reload, but if enemy close skip reload
     {
         ActiveWeapon.Reload();
     }
 }
Ejemplo n.º 14
0
 public void Load(ContentManager Content)
 {
     foreach (WeaponBase ActiveWeapon in DicWeaponByName.Values)
     {
         ActiveWeapon.Load(Content);
     }
 }
Ejemplo n.º 15
0
        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>();
 }
Ejemplo n.º 17
0
 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>();
 }
Ejemplo n.º 20
0
 void checkReload()
 {
     if (ActiveWeapon.reloader.RoundsRemainingInClip == 0)
     {
         CrouchState();
         ActiveWeapon.Reload();
     }
 }
Ejemplo n.º 21
0
    void CheckForRealoed()
    {
        if (ActiveWeapon.reloader.RoundsRemainingInClip == 0)
        {
            ActiveWeapon.Reload();
        }

        CrouchState();
    }
Ejemplo n.º 22
0
    void Update()
    {
        if (!shootFire || !canFire || !enemy.EnemyHealth.isAlive)
        {
            return;
        }

        ActiveWeapon.Fire();
    }
Ejemplo n.º 23
0
 protected override void OnStart()
 {
     _weapon   = GetComponent <ActiveWeapon>();
     _aiming   = GetComponent <CharacterAiming>();
     _animator = GetComponent <Animator>();
     _healthEffectController = GetComponent <PlayerHealthEffectController>();
     _equipment = GetComponent <Equipment>();
     _player    = GetComponent <PlayerController>();
 }
Ejemplo n.º 24
0
        public void UpdateSkills(string RequirementName)
        {
            CurrentLayer.SetRobotContext(this);

            foreach (WeaponBase ActiveWeapon in PrimaryWeapons.ActiveWeapons)
            {
                ActiveWeapon.UpdateSkills(RequirementName);
            }
        }
Ejemplo n.º 25
0
 private void OnTriggerStay(Collider other)
 {
     activeWeapon = other.gameObject.GetComponent <ActiveWeapon>();
     if (activeWeapon && Input.GetButtonDown("Equip"))
     {
         RaycastWeapon newWeapon = Instantiate(weaponPrefab);
         activeWeapon.Equip(newWeapon);
     }
 }
Ejemplo n.º 26
0
 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);
        }
Ejemplo n.º 28
0
 public void InitiateAttack(GameTime gameTime, AttackInputs AttackInput)
 {
     foreach (WeaponBase ActiveWeapon in PrimaryWeapons.ActiveWeapons)
     {
         if (ActiveWeapon.InitiateAttack(gameTime, AttackInput, CurrentMovementInput, ActiveMovementStance, false, this))
         {
             break;
         }
     }
 }
Ejemplo n.º 29
0
        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++);
            }
        }
Ejemplo n.º 30
0
    public void ProcessAttack(PlayerCmd pCmd, float delta)
    {
        if (pCmd.attack == 1)
        {
            ActiveWeapon.ShootPressed = true;
            ActiveWeapon.Shoot(pCmd, delta);
            return;
        }

        ActiveWeapon.ShootPressed = false;
    }