GetCurrentGraphics() public method

public GetCurrentGraphics ( ) : WeaponGraphics,
return WeaponGraphics,
    void RpcDoShootEffect()
    {
        //play our particle system
        ParticleSystem pS = weaponManager.GetCurrentGraphics().muzzleFlash;

        if (!pS.isPlaying)
        {
            pS.Play();
        }

        else if (pS.isPlaying)
        {
            pS.Stop();
        }

        else if (pS.isPlaying)
        {
            pS.Stop();
        }

        else if (!pS.isPlaying)
        {
            pS.Play();
        }
    }
Beispiel #2
0
 void RpcDoShootEffect()
 {
     if (weaponManager.GetCurrentGraphics())
     {
         weaponManager.GetCurrentGraphics().muzzleFlash.Play();
     }
 }
 private void RpcDoShootEffects()
 {
     if (!weaponManager)
     {
         weaponManager = GetComponent <WeaponManager>();
     }
     weaponManager.GetCurrentGraphics().muzzleFlash.Play();
 }
Beispiel #4
0
    void RpcDoShootEffect()
    {
        weaponManager.GetCurrentGraphics().muzzleFlash.Play();
        weaponManager.GetCurrentWeapon().audioSource.Play();

        Animator anim = weaponManager.GetCurrentGraphics().gameObject.GetComponent <Animator>();

        anim.Play("Shoot", -1, 0.0f);
    }
    void RpcDoShootEffect()
    {
        weaponManager.GetCurrentGraphics().muzzleFlash.Play();
        int rand = Random.Range(-2, 2);

        if (rand == 0)
        {
            weaponManager.GetCurrentGraphics().bulletTracer.Play();
        }
    }
Beispiel #6
0
 void RpcDoShootEffect()
 {
     if (weaponManager == null)
     {
         weaponManager = GetComponent <WeaponManager>();
     }
     else
     {
         weaponManager.GetCurrentGraphics().muzzleFlash.Play();
     }
 }
Beispiel #7
0
 void RpcPlayMuzzleFlash()
 {
     try
     {
         weaponManager.GetCurrentGraphics().muzzleFlash.Play();
     }
     catch
     {
         return;
     }
 }
Beispiel #8
0
    IEnumerator DoShootEffectCoroutine()
    {
        weaponManager.GetCurrentSounds().PlayShotSound();

        WeaponGraphics weaponGraphics = weaponManager.GetCurrentGraphics();

        weaponGraphics.muzzleFlash.Play();
        weaponGraphics.laserRendered.enabled = true;
        yield return(new WaitForSeconds(weaponGraphics.laserTime));

        weaponGraphics.laserRendered.enabled = false;
    }
Beispiel #9
0
    void RpcDoShootEffects()
    {
        Debug.Log("Doing shoot effects!");
        Debug.Log(weaponManager.GetCurrentGraphics().muzzleFlash);

        ParticleSystem _ps = weaponManager.GetCurrentGraphics().muzzleFlash;

        _ps.Clear();
        if (!_ps.isPlaying)
        {
            _ps.Play();
        }
    }
Beispiel #10
0
    void Shoot()
    {
        currentWeapon.bullets--;

        weaponManager.GetCurrentGraphics().muzzleFlash.Play();

        weaponManager.GetCurrentGraphics().GetComponent <AudioSource>().Play();


        RaycastHit _hit;

        // see if draw is called
        if (!roundManager.draw)
        {
            gameManager.GameOver("You shot too early, wait until 'Draw' is called", 1);
        }
        else
        {
            Debug.Log("I may shoot");
            if (Physics.Raycast(cam.transform.position, cam.transform.forward, out _hit, 200f, mask))
            {
                if (_hit.collider.tag == "Opponent")
                {
                    if (_hit.collider.name == "Cowboy " + GameManager.data.tips[GameManager.activeTip].Answer + "(Clone)")
                    {
                        SceneManager.LoadScene("Succes");
                    }
                    else
                    {
                        gameManager.GameOver("Wrong opponent!", 2);
                        gameOver = true;
                    }
                }
                else
                {
                    if (currentWeapon.bullets == 0)
                    {
                        Debug.Log("out of bullets");
                        gameManager.GameOver("Out of bullets!", 2);
                        gameOver = true;
                        return;
                    }
                }

                GameObject _hitEffect = (GameObject)Instantiate(weaponManager.GetCurrentGraphics().hitEffectPrefab, _hit.point, Quaternion.LookRotation(_hit.normal));
                Destroy(_hitEffect, 2f);
            }
        }
    }
Beispiel #11
0
 void RpcDoShootEffect()
 {
     weaponManager.GetCurrentGraphics().muzzleFlash.Play();
     if (firstShot)
     {
         firstShot = false;
         playerAudio.PlayOneShot(currentWeapon.firstShot, 0.25f);
         playerAudio.PlayOneShot(currentWeapon.tailSound, 0.25f);
     }
     else
     {
         playerAudio.PlayOneShot(currentWeapon.midShots[Random.Range(0, currentWeapon.midShots.Length)], 0.25f);
         playerAudio.PlayOneShot(currentWeapon.tailSound, 0.25f);
     }
 }
Beispiel #12
0
    private void FireWeapon()
    {
        RaycastHit hitInfo;
        Vector3    dir = camForShootRaycast.transform.forward + Random.insideUnitSphere * currentWeapon.accuracy;

        if (Physics.Raycast(camForShootRaycast.transform.position, dir, out hitInfo, currentWeapon.range, layerMask))
        {
            if (hitInfo.collider.tag == "Player")
            {
                CmdPlayerWasShot(hitInfo.collider.name, currentWeapon.damage);
            }
            SpawnWeaponImpact(hitInfo.point, hitInfo.normal);
        }
        AudioClip clip = currentWeapon.singleShotSound;

        if (clip)
        {
            audioSource.clip  = clip;
            audioSource.pitch = Random.Range(0.9f, 1.2f);
            audioSource.Play();
        }

        WeaponGraphics gfx = weaponManager.GetCurrentGraphics();

        gfx.TriggerVisualFireEffect();

        //TODO: apply a recoil
    }
Beispiel #13
0
    void RpcDoShootEffect()
    {
        if (Vector3.Distance(transform.position, audioPosition) < 20f)
        {
            audioSource.Play();
        }
        else if (Vector3.Distance(transform.position, audioPosition) < 50f)
        {
            audioSource.volume = 0.35f;
            audioSource.Play();
        }
        else if (Vector3.Distance(transform.position, audioPosition) < 100f)
        {
            audioSource.volume = 0.1f;
            audioSource.Play();
        }

        weaponManager.GetCurrentGraphics().muzzleFlash.Play();
    }
Beispiel #14
0
 void RpcDoMuzzleFlash()
 {
     weaponManager.GetCurrentGraphics().muzzleFlash.Play();
 }
Beispiel #15
0
 void RpcDoShootEffect()
 {
     _weaponManager.GetCurrentGraphics().MuzzleFlash.Play();
 }
Beispiel #16
0
    void Shoot()
    {
        if (Shop.activeSelf || pause.activeSelf)
        {
            return;
        }

        if (!infinity)
        {
            CurrentAmmo--;
        }

        if (CurrentAmmo <= 0)
        {
            CurrentAmmo = 0;


            // empty magazine sound
            weaponManager.GetCurrentGraphics().PlaySound(1);

            // weapon reload animation
            if (Ammo > 0)
            {
                Reload();
            }

            return;
        }

        // muzzleflash effect, called every time we shoot
        weaponManager.GetCurrentGraphics().muzzleFlash.Play();

        // shoot sound
        weaponManager.GetCurrentGraphics().PlaySound(0);

        // weapon shoot animation
        weaponAnimation.Fire();


        Vector3 FirePos = cam.transform.position;

        FirePosForward = cam.transform.forward + (Random.Range(-Add, Add) * Vector3.Cross(cam.transform.up, cam.transform.forward)) + (Random.Range(-Add, Add) * cam.transform.up);


        RaycastHit hit;

        // checking what collider we shoot
        if (Physics.Raycast(FirePos, FirePosForward, out hit, currentWeapon.range, mask))
        {
            // particales affect, whatever we hit
            GameObject _hitEffect = (GameObject)Instantiate(weaponManager.GetCurrentGraphics().hitEffect, hit.point, Quaternion.LookRotation(hit.normal));
            Destroy(_hitEffect, 1f);

            GameObject _BulletHole = (GameObject)Instantiate(BulletHole, hit.point, Quaternion.FromToRotation(Vector3.up, hit.normal));
            _BulletHole.transform.SetParent(hit.transform);
            Destroy(_BulletHole, 5f);

            if (hit.rigidbody != null)
            {
                hit.rigidbody.AddForce(-hit.normal * impactForce);
            }


            // we hit enemy?
            if (hit.collider.tag == "Enemy")
            {
                // check the enemy we hit
                for (int i = 0; i < enemies.Length; i++)
                {
                    if (hit.transform.name == ("Enemy" + i))
                    {
                        enemy = enemies[i].GetComponent <Enemy>();
                    }
                }

                // shoot method
                ShootPlayer(currentWeapon.damage);
            }
            else if (hit.collider.tag == "EnemyAI")
            {
                hit.transform.gameObject.GetComponent <AIHealth>().TakeDamamge(currentWeapon.damage);
                Destroy(_BulletHole);
            }
            else if (hit.collider.tag == "Explosive")
            {
                hit.transform.GetComponent <explosive>().Damage(10f);
            }
            else if (hit.collider.tag == "Box")
            {
                hit.transform.GetComponent <crate>().Damage(10f);
            }
            else if (hit.collider.tag == "zombie")
            {
                Destroy(_BulletHole);
                hit.transform.gameObject.GetComponent <ZombieAI>().ApplyDamage(currentWeapon.damage);
                GameObject _blood = (GameObject)Instantiate(blood, hit.point, Quaternion.FromToRotation(Vector3.up, hit.normal));
                hit.transform.gameObject.GetComponent <ZombieAI>().bloodList.Add(_blood);
                _blood.transform.SetParent(hit.transform);

                Destroy(_blood, 3f);
            }
            else if (hit.collider.tag == "zombieHead")
            {
                Destroy(_BulletHole);
                hit.transform.gameObject.GetComponent <ZombieAI>().ApplyDamage(currentWeapon.damage * 3); // headShot
                GameObject _blood = (GameObject)Instantiate(blood, hit.point, Quaternion.FromToRotation(Vector3.up, hit.normal));
                hit.transform.gameObject.GetComponent <ZombieAI>().bloodList.Add(_blood);
                _blood.transform.SetParent(hit.transform);
                Destroy(_blood, 3f);
            }
            else if (hit.collider.tag == "Beast")
            {
                Destroy(_BulletHole);
                hit.transform.gameObject.GetComponent <BeastAI>().ApplyDamage(currentWeapon.damage);
                hit.transform.gameObject.GetComponent <BeastAI>().anim.CrossFade("hit");
                GameObject _blood = (GameObject)Instantiate(blood, hit.point, Quaternion.FromToRotation(Vector3.up, hit.normal));
                hit.transform.gameObject.GetComponent <BeastAI>().bloodList.Add(_blood);
                _blood.transform.SetParent(hit.transform);
                Destroy(_blood, 3f);
            }
            else if (hit.collider.tag == "BeastHead")
            {
                Destroy(_BulletHole);
                hit.transform.gameObject.GetComponent <BeastAI>().ApplyDamage(currentWeapon.damage * 3); // headShot
                hit.transform.gameObject.GetComponent <BeastAI>().anim.CrossFade("hit");
                GameObject _blood = (GameObject)Instantiate(blood, hit.point, Quaternion.FromToRotation(Vector3.up, hit.normal));
                hit.transform.gameObject.GetComponent <BeastAI>().bloodList.Add(_blood);
                _blood.transform.SetParent(hit.transform);
                Destroy(_blood, 3f);
            }
        }
    }
Beispiel #17
0
 void RpcDoShootEffect()
 {
     motor.RotateCamera(currentWeapon.recoil * BurstLong * 10);
     audioManager.ShootEffect.Play();
     weaponManager.GetCurrentGraphics().muzzleFlash.Play();
 }
Beispiel #18
0
 private void RpcDoShootEffect()
 {
     weaponManager.GetCurrentGraphics().muzzleFlash.Play();
     weaponManager.GetCurrentGraphics().gunAnimator.Play("Shoot");
 }
Beispiel #19
0
    void RpcDoHitEffect(Vector3 _pos, Vector3 _normal)
    {
        GameObject hitEffect = (GameObject)Instantiate(weaponManager.GetCurrentGraphics().hitEffectPrefab, _pos, Quaternion.LookRotation(_normal));

        Destroy(hitEffect, 2f);
    }
Beispiel #20
0
    private void RPC_PlayHitEffect(Vector3 _position, Vector3 _normal)
    {
        GameObject _hitEffectIns = Instantiate(weaponManager.GetCurrentGraphics().hitEffectPrefab, _position, Quaternion.LookRotation(_normal));

        Destroy(_hitEffectIns, 2f);
    }
Beispiel #21
0
    void RpcDoAttackAnimate()
    {
        _weaponManager.GetCurrentGraphics().effect.Play();

        _animator.SetTrigger("Attacking");
    }
Beispiel #22
0
 [ClientRpc]                                                //Attribute that can be put on methods of networkbehaviour classes to allow them to be onvoked by the clients of a server.
 //Its called on all clients when the shoot effect is needed.
 void RpcDoShootEffect()                                    //It will control the behaviour of the muzzle effect
 {
     weaponManager.GetCurrentGraphics().muzzleFlash.Play(); //Reference to the muzzleflash attribute on weaponManager and enable to play it.
 }
 void RpcDoShootEffect()
 {
     // Show the weapon's MuzzleFlash particles.
     weaponManager.GetCurrentGraphics().muzzleFlash.Play();
 }
Beispiel #24
0
 void RpcShootEffects()
 {
     weaponMannger.GetCurrentGraphics().muzzleFlash.Play();
 }