Ejemplo n.º 1
0
        public void FireGun(FireModes fm)
        {
            if (isFiring)
            {
                return;
            }
            isFiring = true;

            HP_Stats.StartBothCooldown();

            float finalDegreeDirectionLocal = HP_DirectionHandler.finalDegreeDirection;

            if (airStrikeActive)
            {
                StartCoroutine(FireFlare());
                return;
            }

            if (fm == FireModes.Single)
            {
                //slowWalk = ((PlayerData.instance.equippedCharm_37 && PlayerData.instance.equippedCharm_32) || !PlayerData.instance.equippedCharm_37);
                HeroController.instance.WALK_SPEED = HP_Stats.walkSpeed;
                StartCoroutine(SingleShot());
            }
            if (fm == FireModes.Spread)
            {
                slowWalk = ((PlayerData.instance.equippedCharm_37 && PlayerData.instance.equippedCharm_32) || !PlayerData.instance.equippedCharm_37);
                HeroController.instance.WALK_SPEED = HP_Stats.walkSpeed;
                StartCoroutine(SpreadShot(5));
                StartCoroutine(KnockbackRecoil(3f, finalDegreeDirectionLocal));
                return;
            }

            //Firing below will push the player up
            float mult = (PlayerData.instance.equippedCharm_31) ? 2 : 1;

            if (finalDegreeDirectionLocal == 270)
            {
                StartCoroutine(KnockbackRecoil(1.75f * mult, 270));
            }
            else if (finalDegreeDirectionLocal < 350 && finalDegreeDirectionLocal > 190)
            {
                StartCoroutine(KnockbackRecoil(0.07f * mult, 270));
            }
        }
Ejemplo n.º 2
0
        public void Update()
        {
            //TODO: Replace weapon handler to accomodate "isUsingGun" bool instead of checking what theyre using
            if (!(HP_WeaponHandler.currentGun.gunName == "Nail") && !isFiring && HeroController.instance.CanCast())
            {
                if (HP_DirectionHandler.pressingAttack && HP_Stats.canFire)
                {
                    if (HP_Stats.currentPrimaryAmmo > 0)
                    {
                        //HP_Stats.ReduceAmmunition();
                        HP_Stats.StartBothCooldown();
                        FireGun((PlayerData.instance.equippedCharm_11) ? FireModes.Spread : FireModes.Single);
                    }

                    /*else if (PlayerData.instance.MPCharge >= HP_Stats.fireSoulCost)
                     * {
                     *  HeroController.instance.TakeMPQuick(HP_Stats.fireSoulCost);
                     *  HP_Stats.StartBothCooldown();
                     *  FireGun((PlayerData.instance.equippedCharm_11)? FireModes.Spread : FireModes.Single );
                     * }
                     */
                    else if (clickTimer <= 0)
                    {
                        clickTimer = 3f;
                        PlaySoundsMisc("cantfire");
                    }
                }
            }
            else if (!isFiring)
            {
                HeroController.instance.WALK_SPEED = 2.5f;
            }

            //TODO: Slow down the player while firing MOVE TO HP STATS LATER
            if (slowWalk)
            {
                HeroController.instance.cState.inWalkZone = true;
            }
            else
            {
                HeroController.instance.cState.inWalkZone = false;
            }
        }