Beispiel #1
0
    void Shoot()
    {
        if (!isPickable && isActive)
        {
            if (Time.time > nextShotTime)
            {
                if (!isReloading && Time.time > nextShotTime && cartridgeAmmo > 0)
                {
                    if (fireMode == FireMode.Burst)
                    {
                        if (burstShotsRemaining == 0)
                        {
                            return;
                        }
                        burstShotsRemaining--;
                        recoilMoveSettleTime    = msBetweenShootsBurst / 1000;
                        originalNsBetweenShoots = msBetweenShootsBurst;
                    }

                    else if (fireMode == FireMode.Single)
                    {
                        if (!triggerReleasedSinceLastShot)
                        {
                            return;
                        }
                    }

                    if (fireMode != FireMode.Burst)
                    {
                        recoilMoveSettleTime    = msBetweenShootsAuto / 1000;
                        originalNsBetweenShoots = msBetweenShootsAuto;
                    }

                    TypeShoot();

                    Instantiate(shell, shellEjection.position, shellEjection.rotation);
                    muzzleflash.GetComponent <MuzzleFlash>().Activate();

                    transform.localPosition -= Vector3.forward * Random.Range(kickMinMax.x, kickMinMax.y);
                }
            }
        }
    }
    void Start()
    {
        cam    = GetComponentInChildren <Camera>();
        rb     = GetComponent <Rigidbody>();
        auds   = GetComponent <AudioSource>();
        pc     = GetComponent <PlayerController>();
        line   = GetComponent <LineRenderer>();
        muzzle = MuzzleFlash.GetComponent <ParticleSystem>();

        GunStartPos      = Gun.transform.localPosition.z;
        GrappleStartPos  = Grapple.transform.localPosition.z;
        GrappleChargePos = Grapple.transform.localPosition.z + .7f;
    }
Beispiel #3
0
 void Start()
 {
     muzzleFlash.GetComponent <MuzzleFlash> ();
     shotsRemainingInBurst     = burstCount;
     projectilesRemainingInMag = projectilesPerMag;
 }