Ejemplo n.º 1
0
    public void LaunchPlayer()
    {
        if (LaunchCooldown > 0)
        {
            Debug.Log("Is on Launch Cooldown");
            return;
        }

        if (SFX)
        {
            SFX.volume = VolumeControl.GetVolume(EAudioType.EFFECT);
            SFX.PlayOneShot(DashSound);
        }

        /*
         * //Launch player in direction of movement                   //Launch in direction of mouse cursor if not moving
         * Vector3 launchVelocity = PhysBody.velocity.magnitude > 1 ? PhysBody.velocity.normalized * 500 : transform.forward * 500;
         *
         *
         * PhysBody.AddForce(launchVelocity, ForceMode.Impulse);*/
        LaunchCooldown = LaunchCooldownTime;

        InvokeRepeating("AllowLaunch", launchCooldownRate, launchCooldownRate);

        PlayerController.GetHealth.EnableInvulnerability(invulnerabilityTime);

        launchStart = transform.position;
        GetLaunchPosition();
        GetLaunchRate();
        InvokeRepeating("Launch", 0, launchRate);
        isDashing = true;
    }
Ejemplo n.º 2
0
    void Damaged(int Damage, int Health, GameObject Instigator)
    {
        //Cam.CameraShake.Shake();
        CameraShake.Shake(0.15f, 0.3f);

        SFX.volume = VolumeControl.GetVolume(EAudioType.EFFECT);
        SFX.Play();
    }
Ejemplo n.º 3
0
    void OnTriggerEnter(Collider other)
    {
        OnHit(other.gameObject);

        if (SFX)
        {
            SFX.volume = VolumeControl.GetVolume(EAudioType.EFFECT);
        }
    }
Ejemplo n.º 4
0
    void adjustVolume()
    {
        //Debug.Log("Adjust Volume Called");

        if (source)
        {
            source.volume = VolumeControl.GetVolume(EAudioType.MUSIC);
        }
        else
        {
            //Debug.Log("SOURCE NOT VALID");
        }
    }
Ejemplo n.º 5
0
    // Use this for initialization
    void Start()
    {
        VFX = GetComponent <ParticleSystem>();
        FX  = GetComponent <AudioSource>();

        FX.volume = FX.volume * VolumeControl.GetVolume(EAudioType.EFFECT);

        VFX.Play();

        FX.pitch = Random.Range(PitchRange.x, PitchRange.y);
        FX.Play();

        Destroy(gameObject, lifeTime);
    }
Ejemplo n.º 6
0
    void PlayWeaponSound()
    {
        if (SFX.enabled == false)
        {
            return;
        }

        SFX.volume = VolumeControl.GetVolume(EAudioType.EFFECT);

        float basePitch = SFX.pitch;

        SFX.pitch = Random.Range(SFX.pitch - .1f, SFX.pitch + .1f);
        SFX.Play();

        SFX.pitch = basePitch;
    }
Ejemplo n.º 7
0
    void Awake()
    {
        if (clip == null)
        {
            Destroy(gameObject);
            return;
        }

        source = GetComponent <AudioSource>();

        float _volume = 1;

        if (VolumeControl.instance)
        {
            _volume = VolumeControl.GetVolume(audioType);
        }

        source.volume = _volume;

        source.PlayOneShot(clip);

        StartCoroutine(DestroySound());
        //Destroy(gameObject, clip.length);
    }