Beispiel #1
0
    void ShootMachineGun()
    {
        RaycastHit mHit;

        nextTimeToFire = Time.time + 1f / fireRate;
        anim.SetTrigger("RifleShoot");
        crosshairAnim.SetTrigger("Expand");
        camAnim.SetTrigger("camShake3");
        Instantiate(rifleShell, shellEjectPt.transform.position, transform.rotation);
        weaponShoot.Play();
        if (play.dontLoseAmmo == false)
        {
            currAmmoM--;
        }
        PlayerPrefs.SetInt("Machinegun_Ammo", currAmmoM);
        if (Physics.Raycast(cam.transform.position, cam.transform.forward, out mHit, dist, layers))
        {
            Debug.Log(mHit.transform.name);
            Instantiate(impact, mHit.point, Quaternion.identity);
            PointGiver point = mHit.transform.GetComponent <PointGiver>();
            if (point != null)
            {
                point.GivePoint(point.targetPoints);
                if (play.canInstaKill == false)
                {
                    point.TakeDamage(damage);
                }
                if (play.canInstaKill == true)
                {
                    point.TakeDamage(1000);
                }
                if (point.health.health <= 0)
                {
                    achieve.rifleKill++;
                }
                if (enableCon == false)
                {
                    Instantiate(blood, mHit.point, Quaternion.identity);
                }
                if (enableCon == true)
                {
                    Instantiate(confetti, mHit.point, Quaternion.identity);
                }
            }
            BossDrone bossDrone = mHit.transform.GetComponent <BossDrone>();
            if (bossDrone != null)
            {
                bossDrone.TakeDamage(damage);
                if (enableCon == false)
                {
                    Instantiate(blood, mHit.point, Quaternion.identity);
                }
                if (enableCon == true)
                {
                    Instantiate(confetti, mHit.point, Quaternion.identity);
                }
            }
        }
    }
Beispiel #2
0
    void Explode()
    {
        Collider[] colliders = Physics.OverlapSphere(transform.position, radius);

        foreach (Collider near in colliders)
        {
            PointGiver point = near.GetComponent <PointGiver>();
            if (point != null)
            {
                point.GivePoint(point.targetPoints);
                if (play.canInstaKill == false)
                {
                    point.TakeDamage(damage);
                }
                if (play.canInstaKill == true)
                {
                    point.TakeDamage(1000);
                }
                if (point.health.health <= 0)
                {
                    achieve.grenadeKill++;
                }
                if (mouse.enableCon == false)
                {
                    Instantiate(blood, near.transform.position, Quaternion.identity);
                }
                if (mouse.enableCon == true)
                {
                    Instantiate(confetti, near.transform.position, Quaternion.identity);
                }

                Debug.Log("Got some points");
            }
            PlayerMovement playerMove = near.GetComponent <PlayerMovement>();
            if (playerMove != null)
            {
                playerMove.mouse.camAnim.SetTrigger("camShake2");
            }
            BossDrone bossDrone = near.transform.GetComponent <BossDrone>();
            if (bossDrone != null)
            {
                bossDrone.TakeDamage(damage);
                if (mouse.enableCon == false)
                {
                    Instantiate(blood, near.transform.position, Quaternion.identity);
                }
                if (mouse.enableCon == true)
                {
                    Instantiate(confetti, near.transform.position, Quaternion.identity);
                }
            }
        }

        Instantiate(effect, transform.position, transform.rotation);
        Destroy(gameObject);
    }
Beispiel #3
0
    void shootShotgun()
    {
        RaycastHit sHit;
        RaycastHit sHit2;
        RaycastHit sHit3;
        RaycastHit sHit4;
        RaycastHit sHit5;

        anim.SetTrigger("ShotgunShoot");
        crosshairAnim.SetTrigger("Expand");
        camAnim.SetTrigger("camShake2");
        weaponShoot.Play();
        Instantiate(shell, shellEjectPt.transform.position, transform.rotation);
        StartCoroutine(reload());
        currAmmoS--;
        PlayerPrefs.SetInt("Shotgun_Ammo", currAmmoS);

        if (Physics.Raycast(cam.transform.position, cam.transform.forward, out sHit, dist, layers))
        {
            Debug.Log(sHit.transform.name);
            Instantiate(impact, sHit.point, Quaternion.identity);
            Debug.DrawRay(transform.position, cam.transform.forward, Color.green);
            PointGiver point = sHit.transform.GetComponent <PointGiver>();
            if (point != null)
            {
                point.GivePoint(point.targetPoints);
                if (play.canInstaKill == false)
                {
                    point.TakeDamage(damage);
                }
                if (play.canInstaKill == true)
                {
                    point.TakeDamage(1000);
                }
                if (point.health.health <= 0)
                {
                    achieve.shotGunKill++;
                }
                if (enableCon == false)
                {
                    Instantiate(blood, sHit.point, Quaternion.identity);
                }
                if (enableCon == true)
                {
                    Instantiate(confetti, sHit.point, Quaternion.identity);
                }
            }
            BossDrone bossDrone = sHit.transform.GetComponent <BossDrone>();
            if (bossDrone != null)
            {
                bossDrone.TakeDamage(damage);
                if (enableCon == false)
                {
                    Instantiate(blood, sHit.point, Quaternion.identity);
                }
                if (enableCon == true)
                {
                    Instantiate(confetti, sHit.point, Quaternion.identity);
                }
            }
        }

        if (Physics.Raycast(cam.transform.position, cam.transform.forward + new Vector3(-.2f, 0f, -.2f), out sHit2, dist, layers))
        {
            Debug.Log(sHit2.transform.name);
            Instantiate(impact, sHit2.point, Quaternion.LookRotation(sHit2.normal));
            PointGiver point = sHit2.transform.GetComponent <PointGiver>();
            if (point != null)
            {
                point.GivePoint(point.targetPoints);
                if (play.canInstaKill == false)
                {
                    point.TakeDamage(damage);
                }
                if (play.canInstaKill == true)
                {
                    point.TakeDamage(1000);
                }
                if (point.health.health <= 0)
                {
                    achieve.shotGunKill++;
                }
                if (enableCon == false)
                {
                    Instantiate(blood, sHit2.point, Quaternion.identity);
                }
                if (enableCon == true)
                {
                    Instantiate(confetti, sHit2.point, Quaternion.identity);
                }
            }
            BossDrone bossDrone = sHit2.transform.GetComponent <BossDrone>();
            if (bossDrone != null)
            {
                bossDrone.TakeDamage(damage);
                if (enableCon == false)
                {
                    Instantiate(blood, sHit2.point, Quaternion.identity);
                }
                if (enableCon == true)
                {
                    Instantiate(confetti, sHit2.point, Quaternion.identity);
                }
            }
        }

        if (Physics.Raycast(cam.transform.position, cam.transform.forward + new Vector3(0f, .2f, 0f), out sHit3, dist, layers))
        {
            Debug.Log(sHit3.transform.name);
            Instantiate(impact, sHit3.point, Quaternion.identity);
            PointGiver point = sHit3.transform.GetComponent <PointGiver>();
            if (point != null)
            {
                point.GivePoint(point.targetPoints);
                if (play.canInstaKill == false)
                {
                    point.TakeDamage(damage);
                }
                if (play.canInstaKill == true)
                {
                    point.TakeDamage(1000);
                }
                if (point.health.health <= 0)
                {
                    achieve.shotGunKill++;
                }
                if (enableCon == false)
                {
                    Instantiate(blood, sHit3.point, Quaternion.identity);
                }
                if (enableCon == true)
                {
                    Instantiate(confetti, sHit3.point, Quaternion.identity);
                }
            }
            BossDrone bossDrone = sHit3.transform.GetComponent <BossDrone>();
            if (bossDrone != null)
            {
                bossDrone.TakeDamage(damage);
                if (enableCon == false)
                {
                    Instantiate(blood, sHit3.point, Quaternion.identity);
                }
                if (enableCon == true)
                {
                    Instantiate(confetti, sHit3.point, Quaternion.identity);
                }
            }
        }

        if (Physics.Raycast(cam.transform.position, cam.transform.forward + new Vector3(0f, -.2f, 0f), out sHit4, dist, layers))
        {
            Debug.Log(sHit4.transform.name);
            Instantiate(impact, sHit4.point, Quaternion.identity);
            PointGiver point = sHit4.transform.GetComponent <PointGiver>();
            if (point != null)
            {
                point.GivePoint(point.targetPoints);
                if (play.canInstaKill == false)
                {
                    point.TakeDamage(damage);
                }
                if (play.canInstaKill == true)
                {
                    point.TakeDamage(1000);
                }
                if (point.health.health <= 0)
                {
                    achieve.shotGunKill++;
                }
                if (enableCon == false)
                {
                    Instantiate(blood, sHit4.point, Quaternion.identity);
                }
                if (enableCon == true)
                {
                    Instantiate(confetti, sHit4.point, Quaternion.identity);
                }
            }
            BossDrone bossDrone = sHit4.transform.GetComponent <BossDrone>();
            if (bossDrone != null)
            {
                bossDrone.TakeDamage(damage);
                if (enableCon == false)
                {
                    Instantiate(blood, sHit4.point, Quaternion.identity);
                }
                if (enableCon == true)
                {
                    Instantiate(confetti, sHit4.point, Quaternion.identity);
                }
            }
        }

        if (Physics.Raycast(cam.transform.position, cam.transform.forward + new Vector3(.2f, 0f, .2f), out sHit5, dist, layers))
        {
            Debug.Log(sHit5.transform.name);
            Instantiate(impact, sHit5.point, Quaternion.LookRotation(sHit5.normal));
            PointGiver point = sHit5.transform.GetComponent <PointGiver>();
            if (point != null)
            {
                point.GivePoint(point.targetPoints);
                if (play.canInstaKill == false)
                {
                    point.TakeDamage(damage);
                }
                if (play.canInstaKill == true)
                {
                    point.TakeDamage(1000);
                }
                if (point.health.health <= 0)
                {
                    achieve.shotGunKill++;
                }
                if (enableCon == false)
                {
                    Instantiate(blood, sHit5.point, Quaternion.identity);
                }
                if (enableCon == true)
                {
                    Instantiate(confetti, sHit5.point, Quaternion.identity);
                }
            }
            BossDrone bossDrone = sHit5.transform.GetComponent <BossDrone>();
            if (bossDrone != null)
            {
                bossDrone.TakeDamage(damage);
                if (enableCon == false)
                {
                    Instantiate(blood, sHit5.point, Quaternion.identity);
                }
                if (enableCon == true)
                {
                    Instantiate(confetti, sHit5.point, Quaternion.identity);
                }
            }
        }
    }
Beispiel #4
0
    void ShootPistol()
    {
        RaycastHit hit;

        anim.SetTrigger("PistolShoot");
        crosshairAnim.SetTrigger("Expand");
        camAnim.SetTrigger("camShake1");
        weaponShoot.Play();
        StartCoroutine(reload());
        if (play.dontLoseAmmo == false)
        {
            currAmmoP--;
        }
        PlayerPrefs.SetInt("Pistol_Ammo", currAmmoP);
        if (Physics.Raycast(cam.transform.position, cam.transform.forward, out hit, dist, layers))
        {
            Debug.Log(hit.transform.name);
            Instantiate(impact, hit.point, Quaternion.identity);
            //GameObject bH = Instantiate(bulletHole, hit.point, Quaternion.LookRotation(-hit.normal));
            PointGiver point = hit.transform.GetComponent <PointGiver>();
            if (point != null)
            {
                point.GivePoint(point.targetPoints);
                if (play.canInstaKill == false)
                {
                    point.TakeDamage(damage);
                }
                if (play.canInstaKill == true)
                {
                    point.TakeDamage(1000);
                }
                if (point.health.health <= 0)
                {
                    achieve.pistolKill++;
                }
                if (enableCon == false)
                {
                    Instantiate(blood, hit.point, Quaternion.identity);
                }
                if (enableCon == true)
                {
                    Instantiate(confetti, hit.point, Quaternion.identity);
                }

                Debug.Log("Got some points");
            }
            BossDrone bossDrone = hit.transform.GetComponent <BossDrone>();
            if (bossDrone != null)
            {
                bossDrone.TakeDamage(damage);
                if (enableCon == false)
                {
                    Instantiate(blood, hit.point, Quaternion.identity);
                }
                if (enableCon == true)
                {
                    Instantiate(confetti, hit.point, Quaternion.identity);
                }
            }
        }
    }
Beispiel #5
0
    void StabKnife()
    {
        RaycastHit kHit;

        anim.SetTrigger("ShivShoot");
        crosshairAnim.SetTrigger("Expand");
        camAnim.SetTrigger("camShake3");
        weaponShoot.Play();
        StartCoroutine(reload());
        if (Physics.Raycast(cam.transform.position, cam.transform.forward, out kHit, dist, layers))
        {
            Debug.Log(kHit.transform.name);
            Instantiate(impact, kHit.point, Quaternion.identity);
            PointGiver point = kHit.transform.GetComponent <PointGiver>();
            if (point != null)
            {
                point.GivePoint(point.targetPoints);
                if (play.canInstaKill == false)
                {
                    point.TakeDamage(damage);
                }
                if (play.canInstaKill == true)
                {
                    point.TakeDamage(1000);
                }
                secondarySound.Play();
                if (point.health.health <= 0)
                {
                    achieve.knifeKill++;
                }
                if (enableCon == false)
                {
                    Instantiate(blood, kHit.point, Quaternion.identity);
                }
                if (enableCon == true)
                {
                    Instantiate(confetti, kHit.point, Quaternion.identity);
                }
                if (point.health.health <= 0)
                {
                    currAmmoP += 5;
                    currAmmoS += 2;
                    currAmmoM += 5;
                    currAmmoF += 1;
                    currAmmoG += 1;
                    Instantiate(ammoEffect, kHit.point, Quaternion.identity);
                    StartCoroutine(flashAmmo());
                }
            }
            BossDrone bossDrone = kHit.transform.GetComponent <BossDrone>();
            if (bossDrone != null)
            {
                bossDrone.TakeDamage(damage);
                secondarySound.Play();
                if (enableCon == false)
                {
                    Instantiate(blood, kHit.point, Quaternion.identity);
                }
                if (enableCon == true)
                {
                    Instantiate(confetti, kHit.point, Quaternion.identity);
                }
            }
        }
    }