From c2bd265e42de556d7f10ecbab8a492c92907485f Mon Sep 17 00:00:00 2001 From: HH Date: Fri, 9 Jul 2021 16:12:57 -0700 Subject: [PATCH] remove unneeded scripts --- .../Dodgeball/Input/DodgeBallInputActions.cs | 2 +- Assets/Dodgeball/Scripts/GunController.cs | 213 ------------------ .../Dodgeball/Scripts/GunController.cs.meta | 11 - .../Dodgeball/Scripts/MultiGunAlternating.cs | 91 -------- .../Scripts/MultiGunAlternating.cs.meta | 11 - Assets/Dodgeball/Scripts/Weapons.meta | 8 - Assets/Dodgeball/Scripts/Weapons/GunSFX.cs | 35 --- .../Dodgeball/Scripts/Weapons/GunSFX.cs.meta | 11 - 8 files changed, 1 insertion(+), 381 deletions(-) delete mode 100644 Assets/Dodgeball/Scripts/GunController.cs delete mode 100644 Assets/Dodgeball/Scripts/GunController.cs.meta delete mode 100644 Assets/Dodgeball/Scripts/MultiGunAlternating.cs delete mode 100644 Assets/Dodgeball/Scripts/MultiGunAlternating.cs.meta delete mode 100644 Assets/Dodgeball/Scripts/Weapons.meta delete mode 100644 Assets/Dodgeball/Scripts/Weapons/GunSFX.cs delete mode 100644 Assets/Dodgeball/Scripts/Weapons/GunSFX.cs.meta diff --git a/Assets/Dodgeball/Input/DodgeBallInputActions.cs b/Assets/Dodgeball/Input/DodgeBallInputActions.cs index bcdeeb9..98155bd 100644 --- a/Assets/Dodgeball/Input/DodgeBallInputActions.cs +++ b/Assets/Dodgeball/Input/DodgeBallInputActions.cs @@ -2,7 +2,7 @@ // // This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator // version 1.1.0 -// from Assets/ML-Agents/Examples/Dodgeball/Input/DodgeBallInputActions.inputactions +// from Assets/Dodgeball/Input/DodgeBallInputActions.inputactions // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. diff --git a/Assets/Dodgeball/Scripts/GunController.cs b/Assets/Dodgeball/Scripts/GunController.cs deleted file mode 100644 index 0478535..0000000 --- a/Assets/Dodgeball/Scripts/GunController.cs +++ /dev/null @@ -1,213 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using Cinemachine; - -[RequireComponent(typeof(AudioSource))] - -public class GunController : MonoBehaviour -{ - public bool AllowKeyboardInput = true; //this mode ignores player input - public bool initialized; //has this robot been initialized - public KeyCode shootKey = KeyCode.J; - [Header("AUTOSHOOT")] public bool autoShootEnabled; - - - //SHOOTING RATE - [Header("SHOOTING RATE")] - public float shootingRate = .02f; //can shoot every shootingRate seconds. ex: .5 can shoot every .5 seconds - private float shootTimer; - public bool coolDownWait; - - //PROJECTILES - [Header("PROJECTILE")] - public GameObject projectilePrefab; - public int numberOfProjectilesToPool = 25; - public Transform projectileOrigin; //the transform the projectile will originate from - // public List projectilePoolList = new List(); //projectiles to shoot - public List projectilePoolList = new List(); //projectiles to shoot - - //FORCES - [Header("FORCES")] - public float forceToUse; - - [Header("MUZZLE FLASH")] - public bool UseMuzzleFlash; - - [Header("SOUND")] - public bool PlaySound; - public ForceMode forceMode; - public GunSFX GunSFX; - private AudioSource m_AudioSource; - - [Header("SCREEN SHAKE")] - public bool UseScreenShake; - - [Header("TRANSFORM SHAKE")] public bool ShakeTransform; - public float ShakeDuration = .1f; - public float ShakeAmount = .1f; - private Vector3 startPos; - private bool m_TransformIsShaking; - - CinemachineImpulseSource impulseSource; - public GameObject MuzzleFlashObject; - - // Start is called before the first frame update - void Awake() - { - if (!initialized) - { - Initialize(); - } - } - - void OnEnable() - { - if (!initialized) - { - Initialize(); - } - } - - void Initialize() - { - projectilePoolList.Clear(); //clear list in case it's not empty - for (var i = 0; i < numberOfProjectilesToPool; i++) - { - impulseSource = GetComponent(); - GameObject obj = Instantiate(projectilePrefab, transform.position, Quaternion.identity); - Rigidbody p = obj.GetComponent(); - projectilePoolList.Add(p); - p.transform.position = projectileOrigin.position; - // p.projectileController = this; - p.gameObject.SetActive(false); - } - if (MuzzleFlashObject) - { - MuzzleFlashObject.SetActive(false); - } - m_AudioSource = GetComponent(); - - initialized = true; - } - - void Update() - { - if (!AllowKeyboardInput) - { - return; - } - if (Input.GetKeyDown(shootKey)) - { - Shoot(); - // ShootQuantity(1); - } - } - - void FixedUpdate() - { - coolDownWait = shootTimer > shootingRate ? false : true; - shootTimer += Time.fixedDeltaTime; - if (autoShootEnabled) - { - Shoot(); - } - } - - // public void ShootQuantity(int num) - // { - // var i = 0; - // while (i < num) - // { - // //shoot first available projectile in the pool - // foreach (var item in projectilePoolList) - // { - // if (!item.gameObject.activeInHierarchy) - // { - // FireProjectile(item.rb); - // impulseSource.GenerateImpulse(); - // break; - // } - // } - // - // i++; - // } - // } - - public void Shoot() - { - if (coolDownWait || !gameObject.activeSelf) - { - return; - } - - shootTimer = 0; //reset timer - - //shoot first available projectile in the pool - foreach (var item in projectilePoolList) - { - if (!item.gameObject.activeInHierarchy) - { - FireProjectile(item); - // FireProjectile(item.rb); - break; - } - } - - } - - public void FireProjectile(Rigidbody rb) - { - rb.transform.position = projectileOrigin.position; - rb.transform.rotation = projectileOrigin.rotation; - // rb.position = projectileOrigin.position; - // rb.rotation = projectileOrigin.rotation; - - rb.velocity = Vector3.zero; - rb.angularVelocity = Vector3.zero; - rb.gameObject.SetActive(true); - rb.AddForce(projectileOrigin.forward * forceToUse, forceMode); - if (UseScreenShake && impulseSource) - { - impulseSource.GenerateImpulse(); - } - if (ShakeTransform && !m_TransformIsShaking) - { - StartCoroutine(I_ShakeTransform()); - } - if (PlaySound) - { - m_AudioSource.PlayOneShot(m_AudioSource.clip); - - // GunSFX.PlayAudio(); - } - } - - IEnumerator I_ShakeTransform() - { - m_TransformIsShaking = true; - WaitForFixedUpdate wait = new WaitForFixedUpdate(); - - if (UseMuzzleFlash && MuzzleFlashObject) - { - MuzzleFlashObject.transform.localScale = Random.Range(.5f, 1.5f) * Vector3.one; - MuzzleFlashObject.SetActive(true); - } - float timer = 0; - startPos = transform.localPosition; - while (timer < ShakeDuration) - { - var pos = startPos + (Random.insideUnitSphere * ShakeAmount); - transform.localPosition = pos; - timer += Time.fixedDeltaTime; - yield return wait; - } - transform.localPosition = startPos; - if (UseMuzzleFlash && MuzzleFlashObject) - { - MuzzleFlashObject.SetActive(false); - } - m_TransformIsShaking = false; - } - -} diff --git a/Assets/Dodgeball/Scripts/GunController.cs.meta b/Assets/Dodgeball/Scripts/GunController.cs.meta deleted file mode 100644 index b1a2ecd..0000000 --- a/Assets/Dodgeball/Scripts/GunController.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 839028af332e14618a5c21629d48371c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Dodgeball/Scripts/MultiGunAlternating.cs b/Assets/Dodgeball/Scripts/MultiGunAlternating.cs deleted file mode 100644 index 80fe091..0000000 --- a/Assets/Dodgeball/Scripts/MultiGunAlternating.cs +++ /dev/null @@ -1,91 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.UI; - -public class MultiGunAlternating : MonoBehaviour -{ - - [Header("INPUT")] public bool AllowKeyboardInput = true; - public KeyCode shootKey = KeyCode.J; - - [Header("AUTOSHOOT")] public bool autoShootEnabled; - - [Header("GUNS")] public List gunList = new List(); - public int currentGunIndex; - - [Header("TIMING")] - public float shootingRate = .02f; //can shoot every shootingRate seconds. ex: .5 can shoot every .5 seconds - private float shootTimer; - public bool coolDownComplete; - - [Header("COOLDOWN & RELOAD")] - public float CurrentPercentage = 100; //the amount of ammo we currently have on a scale between 0-100 - public float DepletionRate = 5f; //constant rate at which ammo depletes when being used - public float RegenRate = .25f; //constant rate at which ammo regenerates - - public Slider UISlider; - // Start is called before the first frame update - void Start() - { - CurrentPercentage = 100; - if (UISlider) - { - UISlider.value = CurrentPercentage; - } - } - - - void ShootGunAtIndex(int i) - { - currentGunIndex = i >= gunList.Count - 1 ? 0 : i + 1; - gunList[currentGunIndex].Shoot(); - shootTimer = 0; - } - - public void Shoot() - { - coolDownComplete = shootTimer > shootingRate; - if (coolDownComplete) - { - ShootGunAtIndex(currentGunIndex); - CurrentPercentage = Mathf.Clamp(CurrentPercentage - DepletionRate, 0, 100); - } - - } - - void Update() - { - if (UISlider) - { - UISlider.value = CurrentPercentage; - } - - } - - void FixedUpdate() - { - // coolDownComplete = shootTimer > shootingRate; - // if (coolDownComplete) - // { - if (autoShootEnabled) - { - // ShootGunAtIndex(currentGunIndex); - Shoot(); - } - if (AllowKeyboardInput && Input.GetKey(shootKey)) - { - // ShootGunAtIndex(currentGunIndex); - Shoot(); - } - // } - shootTimer += Time.fixedDeltaTime; - CurrentPercentage = Mathf.Clamp(CurrentPercentage + RegenRate, 0, 100); - } - - - // IEnumerator HandleShooting() - // { - // WaitForFixedUpdate wait = new WaitForFixedUpdate(); - // } -} diff --git a/Assets/Dodgeball/Scripts/MultiGunAlternating.cs.meta b/Assets/Dodgeball/Scripts/MultiGunAlternating.cs.meta deleted file mode 100644 index 088a3ab..0000000 --- a/Assets/Dodgeball/Scripts/MultiGunAlternating.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 0759b2416b6374748b3c4bc904d0bdb7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Dodgeball/Scripts/Weapons.meta b/Assets/Dodgeball/Scripts/Weapons.meta deleted file mode 100644 index f1212b3..0000000 --- a/Assets/Dodgeball/Scripts/Weapons.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: ab8d5017850634a23b597e0d658dd74c -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Dodgeball/Scripts/Weapons/GunSFX.cs b/Assets/Dodgeball/Scripts/Weapons/GunSFX.cs deleted file mode 100644 index ea109cd..0000000 --- a/Assets/Dodgeball/Scripts/Weapons/GunSFX.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -[RequireComponent(typeof(AudioSource))] -[RequireComponent(typeof(GunController))] - -public class GunSFX : MonoBehaviour -{ - - - public AudioClip BackgroundSong; - - private AudioSource m_AudioSource; - public Vector2 SoundScaleRandomRange = new Vector2(.2f, .4f); - void Awake() - { - if (m_AudioSource == null) - { - m_AudioSource = GetComponent(); - // m_AudioSource = gameObject.AddComponent(); - } - } - - // Update is called once per frame - void Update() - { - - } - - public void PlayAudio() - { - m_AudioSource.PlayOneShot(m_AudioSource.clip); - } -} diff --git a/Assets/Dodgeball/Scripts/Weapons/GunSFX.cs.meta b/Assets/Dodgeball/Scripts/Weapons/GunSFX.cs.meta deleted file mode 100644 index d83856d..0000000 --- a/Assets/Dodgeball/Scripts/Weapons/GunSFX.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ed5c9f45176ce4bbeb07979f182471e2 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: