Ejemplo n.º 1
0
    private bool IsBulletWhizzLot(RaycastHit hitInfo, Ray ray)
    {
        if (hitInfo.collider.gameObject == PlayerCharacterNew.Instance.bulletWhizzLot)
        {
            Vector3    startingPoint = hitInfo.point + (ray.direction * 0.001f);
            Ray        checkingRay   = new Ray(startingPoint, ray.direction);
            RaycastHit CheckinHitInfo;

            bool hitToPlayer = false;

            if (Physics.Raycast(checkingRay, out CheckinHitInfo, BulletWhizzRadius, generalInfoHandler.HitLayer))
            {
                //Debug.DrawLine(checkingRay.origin,(checkingRay.origin+checkingRay.direction*BulletWhizzRadius), Color.blue,10f);
                //Check if hit to player
                if (CheckinHitInfo.collider.gameObject == PlayerCharacterNew.Instance.gameObject)
                {
                    //Nothing Happened
                    hitToPlayer = true;
                }
            }
            if (!hitToPlayer)
            {
                audioInfo.PlayClip(WhizzSounds);
            }
            return(true);
        }
        return(false);
    }
Ejemplo n.º 2
0
    void Update()
    {
        if (isPlaying)
        {
            timeCounter = MathfPlus.DecByDeltatimeToZero(timeCounter);

            if (timeCounter == 0)
            {
                if (nextIndex >= audioClips.Length)
                {
                    isPlaying = false;
                }
                else
                {
                    timeCounter = audioClipTimes[nextIndex];

                    if (audioClips[nextIndex] != null)
                    {
                        audioInfo.PlayClip(audioClips[nextIndex]);
                    }

                    nextIndex++;
                }
            }
        }
    }
Ejemplo n.º 3
0
    void PlaySound(AudioClip[] _audios, bool _randomPitch)
    {
        AudioClip[] audios      = _audios;
        bool        randomPitch = _randomPitch;

        if (randomPitch)
        {
            audioInfo_Main.SetCustomPitch(Random.Range(soundMinPitch, soundMaxPitch));
        }
        else
        {
            audioInfo_Main.SetCustomPitch(1);
        }

        audioInfo_Main.PlayClip(audios);
    }
Ejemplo n.º 4
0
    void PlayExplosionEffects()
    {
        particleRoot.SetActiveRecursively(true);

        curPar = particleRoot.GetComponent <ParticleSystem>();

        audioInfo.PlayClip(clips);
    }
Ejemplo n.º 5
0
    // Update is called once per frame
    void Update()
    {
        if (!isFirstRun)
        {
            if (shouldPlayVoice)
            {
                shouldPlayVoice = false;

                if (playerCharNew.isCampPlayer)
                {
                    dieVoicesToPlay = initialInfo.voiceInfo.CampModeDie;
                }
                else
                {
                    dieVoicesToPlay = initialInfo.voiceInfo.Die;
                }

                AudioInfo dieNewAudInf = GameObject.Instantiate(dieAudioInfo, transform.position, transform.rotation) as AudioInfo;
                dieNewAudInf.Init();
                dieNewAudInf.PlayClip(dieVoicesToPlay);

                DieInTime dieAudInfDieInTime = dieNewAudInf.gameObject.AddComponent <DieInTime>();
                dieAudInfDieInTime.time = SoldierStats.MaxTimeOfDeadSoldVoice;
            }
        }

        if (isFirstRun)
        {
            isFirstRun = false;
        }

        if (isEnabled)
        {
            if (!startingAnimDone)
            {
                timeCounter += Time.deltaTime;
                if (timeCounter > delayToStartDeadAnim)
                {
                    startingAnimDone = true;

                    animation[initialInfo.deadSoldAnim.animName].time = 0;
                    animation.CrossFade(initialInfo.deadSoldAnim.animName, initialInfo.deadSoldAnim.initialCrossfadeTime);
                }
            }
            else
            {
                if (GeneralStats.IsUnloopedAnimFinishedOnObject(gameObject, initialInfo.deadSoldAnim.animName, 0))
                {
                    StopThisZombie();
                }
            }
        }
    }
Ejemplo n.º 6
0
    public void PlayVoiceWithAdditionalBusyTime(AudioClip _audioClip, float _minBusyTime, float _maxBusyTime)
    {
        AudioClip clip        = _audioClip;
        float     minBusyTime = _minBusyTime + clip.length;
        float     maxBusyTime = _maxBusyTime + clip.length;

        //soundPlay_VoiceMain.PlaySound_Voice(clip);
        voiceAudioInfo.PlayClip(clip);

        voiceLengthCounter = clip.length + 0.05f;


        SetVoiceBusyTime(minBusyTime, maxBusyTime);
    }
Ejemplo n.º 7
0
    void Update()
    {
        if (isStarted)
        {
            if (shouldStop && !audio.isPlaying)
            {
                StopIt();
            }

            if (!audio.isPlaying)
            {
                timer = MathfPlus.DecByDeltatimeToZero(timer);
            }

            if (timer == 0)
            {
                audio.PlayClip(soundClips);

                timer = Random.RandomRange(minTimeDelay, maxTimeDelay);
            }
        }
    }
Ejemplo n.º 8
0
    //

    public void AllyB_PlayLeftFoot01()
    {
        AllyB_SetRandomPitch();
        audioInfo_AllyB.PlayClip(footStep_Left01);
    }
Ejemplo n.º 9
0
    void Update()
    {
        minLifeTimeCounter = MathfPlus.DecByDeltatimeToZero(minLifeTimeCounter);

        if (minLifeTimeCounter == 0)
        {
            if (!IsInPlayerView())
            {
                DestroyIt();
                return;
            }
        }

        maxLifeTimeCounter = MathfPlus.DecByDeltatimeToZero(maxLifeTimeCounter);

        if (!isPhysicsSleeped)
        {
            if (maxLifeTimeCounter <= GeneralStats.deadNash_maxLifeTime - timeToSleepPhysics)
            {
                isPhysicsSleeped = true;

                Rigidbody[] rigids = GetComponentsInChildren <Rigidbody>();

                for (int i = 0; i < rigids.Length; i++)
                {
                    rigids[i].active = false;
                }
            }
        }

        //if (!isGoingToHideBecauseOfHittingNewNash)
        //{
        //    if (maxLifeTimeCounter <= GeneralStats.deadNash_maxLifeTime - GeneralStats.deadNash_minLifeTimeWhileTouchingAnotherNash)
        //    {
        //        for (int i = 0; i < mapLogic.mapDeadSoldierBMWs.Count; i++)
        //        {
        //            if (mapLogic.mapDeadSoldierBMWs[i] == this)
        //                continue;

        //            if (mapLogic.mapDeadSoldierBMWs[i].isGoingToHideBecauseOfHittingNewNash)
        //                continue;

        //            if (Vector3.Magnitude(transform.position - mapLogic.mapDeadSoldierBMWs[i].transform.position) <= GeneralStats.deadNash_HittingNewNashMaxDist)
        //            {
        //                isGoingToHideBecauseOfHittingNewNash = true;
        //                hittingNewNashStartingTime = maxLifeTimeCounter;
        //                break;
        //            }
        //        }
        //    }
        //}
        //else
        //{
        //    if (maxLifeTimeCounter <= hittingNewNashStartingTime - GeneralStats.deadNash_maxLifeTimeAfterTouchingAnotherNash)
        //    {
        //        DestroyIt();
        //        return;
        //    }
        //}

        if (maxLifeTimeCounter == 0)
        {
            DestroyIt();
            return;
        }

        if (!isFirstRun)
        {
            if (shouldPlayVoice)
            {
                shouldPlayVoice = false;

                if (playerCharNew.isCampPlayer)
                {
                    dieVoicesToPlay = initialInfo.voiceInfo.CampModeDie;
                }
                else
                {
                    dieVoicesToPlay = initialInfo.voiceInfo.Die;
                }

                AudioInfo dieNewAudInf = GameObject.Instantiate(dieAudioInfo, transform.position, transform.rotation) as AudioInfo;
                dieNewAudInf.Init();
                dieNewAudInf.PlayClip(dieVoicesToPlay);

                DieInTime dieAudInfDieInTime = dieNewAudInf.gameObject.AddComponent <DieInTime>();
                dieAudInfDieInTime.time = SoldierStats.MaxTimeOfDeadSoldVoice;
            }
        }

        if (isFirstRun)
        {
            isFirstRun = false;
        }
    }
Ejemplo n.º 10
0
    void Update()
    {
        #region Wait For Delay Time
        if (step == 0)
        {
            timer = MathfPlus.DecByDeltatimeToZero(timer);

            if (timer == 0)
            {
                step = 1;
            }
        }
        #endregion

        #region Start
        if (step == 1)
        {
            if (isParticle)
            {
                particleRoot.Play(true);

                particleSounds.PlayClip(clips);
            }

            if (isSound)
            {
                soundsToPlay.PlayClip(clips);
            }

            timer = Random.Range(minTimeBetweenRun, maxTimeBetweenRun);

            SetStep(2);
        }
        #endregion

        #region Wait to finish
        if (step == 2)
        {
            if (isParticle)
            {
                timerForEnd = MathfPlus.DecByDeltatimeToZero(timerForEnd);

                if (timerForEnd == 0)
                {
                    SetStep(3);
                }
            }

            if (isSound)
            {
                if (!soundsToPlay.isPlaying)
                {
                    SetStep(3);
                }
            }
        }
        #endregion

        #region Wait for between time
        if (step == 3)
        {
            timer = MathfPlus.DecByDeltatimeToZero(timer);

            if (timer == 0)
            {
                SetStep(1);

                timerForEnd = particleDuration;
            }
        }
        #endregion
    }
Ejemplo n.º 11
0
 public void PlayLeftFoot01()
 {
     SetRandomPitch();
     audioInfo.PlayClip(footStep_Left01);
 }
Ejemplo n.º 12
0
 public void PlayReloadSound()
 {
     audioInfo.SetCustomPitch(1);
     audioInfo.continuePlayingAfterDie = false;
     audioInfo.PlayClip(soundsReload);
 }