Esempio n. 1
0
    protected override void RangedAttack()
    {
        for (int pellet = 0; pellet < 25; pellet++)
        {
            //calculate the normal distribution of the pellet
            float   angleRadians = Random.Range(0.0f, 2.0f * Mathf.PI);
            Vector3 randomOffset = new Vector3(Mathf.Cos(angleRadians), Mathf.Sin(angleRadians), Mathf.Sin(angleRadians));
            randomOffset *= MathFunc.ApproximateNormalDistribution() * SpreadAmount;

            //calcualte the direction offset for the current pellet shot
            Vector3 directionOffset = new Vector3();
            directionOffset.x += randomOffset.x;
            directionOffset.y += randomOffset.y;
            directionOffset.z += randomOffset.z;

            directionOffset = m_FirstPersonCamera.transform.forward + m_FirstPersonCamera.transform.TransformDirection(directionOffset);

            photonView.RPC("FireSingleTargetMultipleHitscan", PhotonTargets.All, m_FirstPersonCamera.transform.position, directionOffset, (BoostedRangedDamage) * m_NumOfAttacks, PlayerNumber,
                           m_Range, m_IgnoreMask, m_WeaponLayerMask, GunLocation.transform.position, pellet * 3, pellet * 3 + 1);
        }
        SoundManager.GetInstance().photonView.RPC("PlaySFXRandomizedPitchNetworked", PhotonTargets.All, "BoomstickShot", GunLocation.transform.position);

        ResetAnimationTriggers();
        m_IsAttacking = true;
    }