This commit is contained in:
2022-12-01 22:41:35 +05:30
parent c64a4d6814
commit 786cd95f19
5848 changed files with 19818945 additions and 23842 deletions

View File

@@ -0,0 +1,60 @@
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
namespace EpicToonFX
{
public class ETFXButtonScript : MonoBehaviour
{
public GameObject Button;
Text MyButtonText;
string projectileParticleName; // The variable to update the text component of the button
ETFXFireProjectile effectScript; // A variable used to access the list of projectiles
ETFXProjectileScript projectileScript;
public float buttonsX;
public float buttonsY;
public float buttonsSizeX;
public float buttonsSizeY;
public float buttonsDistance;
void Start ()
{
effectScript = GameObject.Find("ETFXFireProjectile").GetComponent<ETFXFireProjectile>();
getProjectileNames();
MyButtonText = Button.transform.Find("Text").GetComponent<Text>();
MyButtonText.text = projectileParticleName;
}
void Update ()
{
MyButtonText.text = projectileParticleName;
// print(projectileParticleName);
}
public void getProjectileNames() // Find and diplay the name of the currently selected projectile
{
// Access the currently selected projectile's 'ProjectileScript'
projectileScript = effectScript.projectiles[effectScript.currentProjectile].GetComponent<ETFXProjectileScript>();
projectileParticleName = projectileScript.projectileParticle.name; // Assign the name of the currently selected projectile to projectileParticleName
}
public bool overButton() // This function will return either true or false
{
Rect button1 = new Rect(buttonsX, buttonsY, buttonsSizeX, buttonsSizeY);
Rect button2 = new Rect(buttonsX + buttonsDistance, buttonsY, buttonsSizeX, buttonsSizeY);
if(button1.Contains(new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y)) ||
button2.Contains(new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y)))
{
return true;
}
else
return false;
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 20f8572b34f163644821787ce4450d60
timeCreated: 1498765306
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,163 @@
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
namespace EpicToonFX
{
public class ETFXEffectController : MonoBehaviour
{
public GameObject[] effects;
private int effectIndex = 0;
[Space(10)]
[Header("Spawn Settings")]
public bool disableLights = true;
public bool disableSound = true;
public float startDelay = 0.2f;
public float respawnDelay = 0.5f;
public bool slideshowMode = false;
public bool autoRotation = false;
[Range(0.001f, 0.5f)]
public float autoRotationSpeed = 0.1f;
private GameObject currentEffect;
private Text effectNameText;
private Text effectIndexText;
private ETFXMouseOrbit etfxMouseOrbit;
private void Awake()
{
effectNameText = GameObject.Find("EffectName").GetComponent<Text>();
effectIndexText = GameObject.Find("EffectIndex").GetComponent<Text>();
etfxMouseOrbit = Camera.main.GetComponent<ETFXMouseOrbit>();
etfxMouseOrbit.etfxEffectController = this;
}
void Start()
{
etfxMouseOrbit = Camera.main.GetComponent<ETFXMouseOrbit>();
etfxMouseOrbit.etfxEffectController = this;
Invoke("InitializeLoop", startDelay);
}
void Update()
{
if (Input.GetKeyDown(KeyCode.RightArrow) || Input.GetKeyDown(KeyCode.D))
{
NextEffect();
}
if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.LeftArrow))
{
PreviousEffect();
}
}
private void FixedUpdate()
{
if (autoRotation)
{
etfxMouseOrbit.SetAutoRotationSpeed(autoRotationSpeed);
if (!etfxMouseOrbit.isAutoRotating)
etfxMouseOrbit.InitializeAutoRotation();
}
}
public void InitializeLoop()
{
StartCoroutine(EffectLoop());
}
public void NextEffect()
{
if (effectIndex < effects.Length - 1)
{
effectIndex++;
}
else
{
effectIndex = 0;
}
CleanCurrentEffect();
}
public void PreviousEffect()
{
if (effectIndex > 0)
{
effectIndex--;
}
else
{
effectIndex = effects.Length - 1;
}
CleanCurrentEffect();
}
private void CleanCurrentEffect()
{
StopAllCoroutines();
if (currentEffect != null)
{
Destroy(currentEffect);
}
StartCoroutine(EffectLoop());
}
private IEnumerator EffectLoop()
{
//Instantiating effect
GameObject effect = Instantiate(effects[effectIndex], transform.position, Quaternion.identity);
currentEffect = effect;
if (disableLights && effect.GetComponent<Light>())
{
effect.GetComponent<Light>().enabled = false;
}
if (disableSound && effect.GetComponent<AudioSource>())
{
effect.GetComponent<AudioSource>().enabled = false;
}
//Update GUIText with effect name
effectNameText.text = effects[effectIndex].name;
effectIndexText.text = (effectIndex + 1) + " of " + effects.Length;
ParticleSystem particleSystem = effect.GetComponent<ParticleSystem>();
while (true)
{
yield return new WaitForSeconds(particleSystem.main.duration + respawnDelay);
if (!slideshowMode)
{
if (!particleSystem.main.loop)
{
currentEffect.SetActive(false);
currentEffect.SetActive(true);
}
}
else
{
//Double delay for looping effects
if (particleSystem.main.loop)
{
yield return new WaitForSeconds(respawnDelay);
}
NextEffect();
}
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0c95d8506f0df6044a130ad7fd7ce51b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,176 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace EpicToonFX
{
public class ETFXEffectControllerPooled : MonoBehaviour
{
public GameObject[] effects;
private List<GameObject> effectsPool;
private int effectIndex = 0;
[Space(10)]
[Header("Spawn Settings")]
public bool disableLights = true;
public bool disableSound = true;
public float startDelay = 0.2f;
public float respawnDelay = 0.5f;
public bool slideshowMode = false;
public bool autoRotation = false;
[Range(0.001f, 0.5f)]
public float autoRotationSpeed = 0.1f;
private GameObject currentEffect;
private Text effectNameText;
private Text effectIndexText;
private ETFXMouseOrbit etfxMouseOrbit;
//Caching components
private void Awake()
{
effectNameText = GameObject.Find("EffectName").GetComponent<Text>();
effectIndexText = GameObject.Find("EffectIndex").GetComponent<Text>();
etfxMouseOrbit = Camera.main.GetComponent<ETFXMouseOrbit>();
etfxMouseOrbit.etfxEffectControllerPooled = this;
//Pooling
effectsPool = new List<GameObject>();
for (int i = 0; i < effects.Length; i++)
{
GameObject effect = Instantiate(effects[i], transform.position, Quaternion.identity);
effect.transform.parent = transform;
effectsPool.Add(effect);
effect.SetActive(false);
}
}
private void Start()
{
Invoke("InitializeLoop", startDelay);
}
private void Update()
{
if (Input.GetKeyDown(KeyCode.RightArrow) || Input.GetKeyDown(KeyCode.D))
{
NextEffect();
}
if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.LeftArrow))
{
PreviousEffect();
}
}
private void FixedUpdate()
{
if (autoRotation)
{
etfxMouseOrbit.SetAutoRotationSpeed(autoRotationSpeed);
if (!etfxMouseOrbit.isAutoRotating)
etfxMouseOrbit.InitializeAutoRotation();
}
}
public void InitializeLoop()
{
StartCoroutine(EffectLoop());
}
public void NextEffect()
{
if (effectIndex < effects.Length - 1)
{
effectIndex++;
}
else
{
effectIndex = 0;
}
CleanCurrentEffect();
}
public void PreviousEffect()
{
if (effectIndex > 0)
{
effectIndex--;
}
else
{
effectIndex = effects.Length - 1;
}
CleanCurrentEffect();
}
private void CleanCurrentEffect()
{
StopAllCoroutines();
if (currentEffect != null)
{
currentEffect.SetActive(false);
}
StartCoroutine(EffectLoop());
}
private IEnumerator EffectLoop()
{
//Pooling effect
currentEffect = effectsPool[effectIndex];
currentEffect.SetActive(true);
if (disableLights && currentEffect.GetComponent<Light>())
{
currentEffect.GetComponent<Light>().enabled = false;
}
if (disableSound && currentEffect.GetComponent<AudioSource>())
{
currentEffect.GetComponent<AudioSource>().enabled = false;
}
//Update UI
effectNameText.text = effects[effectIndex].name;
effectIndexText.text = (effectIndex + 1) + " of " + effects.Length;
ParticleSystem particleSystem = currentEffect.GetComponent<ParticleSystem>();
while (true)
{
yield return new WaitForSeconds(particleSystem.main.duration + respawnDelay);
if (!slideshowMode)
{
if (!particleSystem.main.loop)
{
currentEffect.SetActive(false);
currentEffect.SetActive(true);
}
}
else
{
//Double delay for looping effects
if (particleSystem.main.loop)
{
yield return new WaitForSeconds(respawnDelay);
}
NextEffect();
}
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 037f0e92f195f6747a0518801f99686e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,63 @@
using UnityEngine;
using UnityEngine.EventSystems;
using System.Collections;
using System.Collections.Generic;
namespace EpicToonFX
{
public class ETFXEffectCycler : MonoBehaviour
{
public List<GameObject> listOfEffects;
int effectIndex = 0;
[Header("Spawn Settings")]
[SerializeField]
[Space(10)]
public float loopLength = 1.0f;
public float startDelay = 1.0f;
public bool disableLights = true;
public bool disableSound = true;
void Start ()
{
Invoke("PlayEffect", startDelay);
}
public void PlayEffect()
{
StartCoroutine("EffectLoop");
if (effectIndex < listOfEffects.Count - 1)
{
effectIndex++;
}
else
{
effectIndex = 0;
}
}
private IEnumerator EffectLoop()
{
GameObject instantiatedEffect = (GameObject) Instantiate(listOfEffects[effectIndex], transform.position, transform.rotation * Quaternion.Euler (0, 0, 0));
if (disableLights && instantiatedEffect.GetComponent<Light>())
{
instantiatedEffect.GetComponent<Light>().enabled = false;
}
if (disableSound && instantiatedEffect.GetComponent<AudioSource>())
{
instantiatedEffect.GetComponent<AudioSource>().enabled = false;
}
yield return new WaitForSeconds(loopLength);
Destroy(instantiatedEffect);
PlayEffect();
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d9bf9ff1f66de9d459d3a13350fbfc36
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,86 @@
using UnityEngine;
using UnityEngine.EventSystems;
using System.Collections;
namespace EpicToonFX
{
public class ETFXFireProjectile : MonoBehaviour
{
[SerializeField]
public GameObject[] projectiles;
[Header("Missile spawns at attached game object")]
public Transform spawnPosition;
[HideInInspector]
public int currentProjectile = 0;
public float speed = 500;
// MyGUI _GUI;
ETFXButtonScript selectedProjectileButton;
void Start()
{
selectedProjectileButton = GameObject.Find("Button").GetComponent<ETFXButtonScript>();
}
RaycastHit hit;
void Update()
{
if (Input.GetKeyDown(KeyCode.RightArrow))
{
nextEffect();
}
if (Input.GetKeyDown(KeyCode.D))
{
nextEffect();
}
if (Input.GetKeyDown(KeyCode.A))
{
previousEffect();
}
else if (Input.GetKeyDown(KeyCode.LeftArrow))
{
previousEffect();
}
if (Input.GetKeyDown(KeyCode.Mouse0)) //On left mouse down-click
{
if (!EventSystem.current.IsPointerOverGameObject()) //Checks if the mouse is not over a UI part
{
if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit, 100f)) //Finds the point where you click with the mouse
{
GameObject projectile = Instantiate(projectiles[currentProjectile], spawnPosition.position, Quaternion.identity) as GameObject; //Spawns the selected projectile
projectile.transform.LookAt(hit.point); //Sets the projectiles rotation to look at the point clicked
projectile.GetComponent<Rigidbody>().AddForce(projectile.transform.forward * speed); //Set the speed of the projectile by applying force to the rigidbody
}
}
}
Debug.DrawRay(Camera.main.ScreenPointToRay(Input.mousePosition).origin, Camera.main.ScreenPointToRay(Input.mousePosition).direction * 100, Color.yellow);
}
public void nextEffect() //Changes the selected projectile to the next. Used by UI
{
if (currentProjectile < projectiles.Length - 1)
currentProjectile++;
else
currentProjectile = 0;
selectedProjectileButton.getProjectileNames();
}
public void previousEffect() //Changes selected projectile to the previous. Used by UI
{
if (currentProjectile > 0)
currentProjectile--;
else
currentProjectile = projectiles.Length - 1;
selectedProjectileButton.getProjectileNames();
}
public void AdjustSpeed(float newSpeed) //Used by UI to set projectile speed
{
speed = newSpeed;
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 9ccaaa7728d800946bf8d084ae03e400
timeCreated: 1498765306
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,46 @@
using UnityEngine;
using System.Collections;
namespace EpicToonFX
{
public class ETFXLoopScript : MonoBehaviour
{
public GameObject chosenEffect;
public float loopTimeLimit = 2.0f;
[Header("Spawn without")]
public bool disableLights = true;
public bool disableSound = true;
void Start ()
{
PlayEffect();
}
public void PlayEffect()
{
StartCoroutine("EffectLoop");
}
IEnumerator EffectLoop()
{
GameObject effectPlayer = (GameObject) Instantiate(chosenEffect, transform.position, transform.rotation);
if (disableLights && effectPlayer.GetComponent<Light>())
{
effectPlayer.GetComponent<Light>().enabled = false;
}
if (disableSound && effectPlayer.GetComponent<AudioSource>())
{
effectPlayer.GetComponent<AudioSource>().enabled = false;
}
yield return new WaitForSeconds(loopTimeLimit);
Destroy (effectPlayer);
PlayEffect();
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 69093af5dcdce7b4ab5bbf82d06dbdb4
timeCreated: 1494265210
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,138 @@
using UnityEngine;
using System.Collections;
namespace EpicToonFX
{
public class ETFXMouseOrbit : MonoBehaviour
{
public Transform target;
public float distance = 12.0f;
public float xSpeed = 120.0f;
public float ySpeed = 120.0f;
public float yMinLimit = -20f;
public float yMaxLimit = 80f;
public float distanceMin = 8f;
public float distanceMax = 15f;
public float smoothTime = 2f;
private float rotationYAxis = 0.0f;
private float rotationXAxis = 0.0f;
private float velocityX = 0.0f;
private float maxVelocityX = 0.1f;
private float velocityY = 0.0f;
private readonly float autoRotationSmoothing = 0.02f;
[HideInInspector] public bool isAutoRotating = false;
[HideInInspector] public ETFXEffectController etfxEffectController;
[HideInInspector] public ETFXEffectControllerPooled etfxEffectControllerPooled;
private void Start()
{
Vector3 angles = transform.eulerAngles;
rotationYAxis = angles.y;
rotationXAxis = angles.x;
// Make the rigid body not change rotation
if (GetComponent<Rigidbody>())
{
GetComponent<Rigidbody>().freezeRotation = true;
}
}
private void Update()
{
if(target)
{
if (Input.GetMouseButton(1))
{
velocityX += xSpeed * Input.GetAxis("Mouse X") * distance * 0.02f;
velocityY += ySpeed * Input.GetAxis("Mouse Y") * 0.02f;
if (isAutoRotating)
{
StopAutoRotation();
}
}
distance = Mathf.Clamp(distance - Input.GetAxis("Mouse ScrollWheel") * 15, distanceMin, distanceMax);
}
}
private void FixedUpdate()
{
if (target)
{
rotationYAxis += velocityX;
rotationXAxis -= velocityY;
rotationXAxis = ClampAngle(rotationXAxis, yMinLimit, yMaxLimit);
Quaternion toRotation = Quaternion.Euler(rotationXAxis, rotationYAxis, 0);
Quaternion rotation = toRotation;
if (Physics.Linecast(target.position, transform.position, out RaycastHit hit))
{
distance -= hit.distance;
}
Vector3 negDistance = new Vector3(0.0f, 0.0f, -distance);
Vector3 position = Vector3.Lerp(transform.position, rotation * negDistance + target.position, 0.6f);
transform.rotation = rotation;
transform.position = position;
velocityX = Mathf.Lerp(velocityX, 0, Time.deltaTime * smoothTime);
velocityY = Mathf.Lerp(velocityY, 0, Time.deltaTime * smoothTime);
}
}
public static float ClampAngle(float angle, float min, float max)
{
if (angle < -360F)
angle += 360F;
if (angle > 360F)
angle -= 360F;
return Mathf.Clamp(angle, min, max);
}
public void InitializeAutoRotation()
{
isAutoRotating = true;
StartCoroutine(AutoRotate());
}
public void SetAutoRotationSpeed(float rotationSpeed)
{
maxVelocityX = rotationSpeed;
}
private void StopAutoRotation()
{
if (etfxEffectController != null)
etfxEffectController.autoRotation = false;
if (etfxEffectControllerPooled != null)
etfxEffectControllerPooled.autoRotation = false;
isAutoRotating = false;
StopAllCoroutines();
}
IEnumerator AutoRotate()
{
int lerpSteps = 0;
while (lerpSteps < 30)
{
velocityX = Mathf.Lerp(velocityX, maxVelocityX, autoRotationSmoothing);
yield return new WaitForFixedUpdate();
}
while (isAutoRotating)
{
velocityX = maxVelocityX;
yield return new WaitForFixedUpdate();
}
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 9ca5afe5c4377094597336e19503f797
timeCreated: 1494196995
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,74 @@
using UnityEngine;
using System.Collections;
namespace EpicToonFX
{
public class ETFXProjectileScript : MonoBehaviour
{
public GameObject impactParticle; // Effect spawned when projectile hits a collider
public GameObject projectileParticle; // Effect attached to the gameobject as child
public GameObject muzzleParticle; // Effect instantly spawned when gameobject is spawned
[Header("Adjust if not using Sphere Collider")]
public float colliderRadius = 1f;
[Range(0f, 1f)] // This is an offset that moves the impact effect slightly away from the point of impact to reduce clipping of the impact effect
public float collideOffset = 0.15f;
void Start()
{
projectileParticle = Instantiate(projectileParticle, transform.position, transform.rotation) as GameObject;
projectileParticle.transform.parent = transform;
if (muzzleParticle)
{
muzzleParticle = Instantiate(muzzleParticle, transform.position, transform.rotation) as GameObject;
Destroy(muzzleParticle, 1.5f); // 2nd parameter is lifetime of effect in seconds
}
}
void FixedUpdate()
{
if (GetComponent<Rigidbody>().velocity.magnitude != 0)
{
transform.rotation = Quaternion.LookRotation(GetComponent<Rigidbody>().velocity); // Sets rotation to look at direction of movement
}
RaycastHit hit;
float radius; // Sets the radius of the collision detection
if (transform.GetComponent<SphereCollider>())
radius = transform.GetComponent<SphereCollider>().radius;
else
radius = colliderRadius;
Vector3 direction = transform.GetComponent<Rigidbody>().velocity; // Gets the direction of the projectile, used for collision detection
if (transform.GetComponent<Rigidbody>().useGravity)
direction += Physics.gravity * Time.deltaTime; // Accounts for gravity if enabled
direction = direction.normalized;
float detectionDistance = transform.GetComponent<Rigidbody>().velocity.magnitude * Time.deltaTime; // Distance of collision detection for this frame
if (Physics.SphereCast(transform.position, radius, direction, out hit, detectionDistance)) // Checks if collision will happen
{
transform.position = hit.point + (hit.normal * collideOffset); // Move projectile to point of collision
GameObject impactP = Instantiate(impactParticle, transform.position, Quaternion.FromToRotation(Vector3.up, hit.normal)) as GameObject; // Spawns impact effect
ParticleSystem[] trails = GetComponentsInChildren<ParticleSystem>(); // Gets a list of particle systems, as we need to detach the trails
//Component at [0] is that of the parent i.e. this object (if there is any)
for (int i = 1; i < trails.Length; i++) // Loop to cycle through found particle systems
{
ParticleSystem trail = trails[i];
if (trail.gameObject.name.Contains("Trail"))
{
trail.transform.SetParent(null); // Detaches the trail from the projectile
Destroy(trail.gameObject, 2f); // Removes the trail after seconds
}
}
Destroy(projectileParticle, 3f); // Removes particle effect after delay
Destroy(impactP, 3.5f); // Removes impact effect after delay
Destroy(gameObject); // Removes the projectile
}
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: acd27932048c3254597a02078fa2cb26
timeCreated: 1498765306
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,165 @@
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
namespace EpicToonFX
{
public class ETFXSceneManager : MonoBehaviour
{
public bool GUIHide = false;
public bool GUIHide2 = false;
public bool GUIHide3 = false;
public bool GUIHide4 = false;
public void LoadScene2DDemo() {
SceneManager.LoadScene ("etfx_2ddemo");
}
public void LoadSceneCards() {
SceneManager.LoadScene ("etfx_cards");
}
public void LoadSceneCombat() {
SceneManager.LoadScene ("etfx_combat");
}
public void LoadSceneDecals() {
SceneManager.LoadScene ("etfx_decals");
}
public void LoadSceneDecals2() {
SceneManager.LoadScene ("etfx_decals2");
}
public void LoadSceneEmojis() {
SceneManager.LoadScene ("etfx_emojis");
}
public void LoadSceneEmojis2() {
SceneManager.LoadScene ("etfx_emojis2");
}
public void LoadSceneExplosions() {
SceneManager.LoadScene ("etfx_explosions");
}
public void LoadSceneExplosions2() {
SceneManager.LoadScene ("etfx_explosions2");
}
public void LoadSceneFire() {
SceneManager.LoadScene ("etfx_fire");
}
public void LoadSceneOnomatopoeia() {
SceneManager.LoadScene ("etfx_onomatopoeia");
}
public void LoadSceneFireworks() {
SceneManager.LoadScene ("etfx_fireworks");
}
public void LoadSceneFlares() {
SceneManager.LoadScene ("etfx_flares");
}
public void LoadSceneMagic() {
SceneManager.LoadScene ("etfx_magic");
}
public void LoadSceneMagic2() {
SceneManager.LoadScene ("etfx_magic2");
}
public void LoadSceneMagic3() {
SceneManager.LoadScene ("etfx_magic3");
}
public void LoadSceneMainDemo() {
SceneManager.LoadScene ("etfx_maindemo");
}
public void LoadSceneMissiles() {
SceneManager.LoadScene ("etfx_missiles");
}
public void LoadScenePortals() {
SceneManager.LoadScene ("etfx_portals");
}
public void LoadScenePortals2() {
SceneManager.LoadScene ("etfx_portals2");
}
public void LoadScenePowerups() {
SceneManager.LoadScene ("etfx_powerups");
}
public void LoadScenePowerups2() {
SceneManager.LoadScene ("etfx_powerups2");
}
public void LoadScenePowerups3() {
SceneManager.LoadScene ("etfx_powerups3");
}
public void LoadSceneSparkles() {
SceneManager.LoadScene ("etfx_sparkles");
}
public void LoadSceneSwordCombat() {
SceneManager.LoadScene ("etfx_swordcombat");
}
public void LoadSceneSwordCombat2() {
SceneManager.LoadScene ("etfx_swordcombat2");
}
public void LoadSceneMoney() {
SceneManager.LoadScene ("etfx_money");
}
public void LoadSceneHealing() {
SceneManager.LoadScene ("etfx_healing");
}
public void LoadSceneWind() {
SceneManager.LoadScene ("etfx_wind");
}
public void LoadSceneWater() {
SceneManager.LoadScene ("etfx_water");
}
void Update ()
{
if(Input.GetKeyDown(KeyCode.L))
{
GUIHide = !GUIHide;
if (GUIHide)
{
GameObject.Find("CanvasSceneSelect").GetComponent<Canvas> ().enabled = false;
}
else
{
GameObject.Find("CanvasSceneSelect").GetComponent<Canvas> ().enabled = true;
}
}
if(Input.GetKeyDown(KeyCode.J))
{
GUIHide2 = !GUIHide2;
if (GUIHide2)
{
GameObject.Find("Canvas").GetComponent<Canvas> ().enabled = false;
}
else
{
GameObject.Find("Canvas").GetComponent<Canvas> ().enabled = true;
}
}
if(Input.GetKeyDown(KeyCode.H))
{
GUIHide3 = !GUIHide3;
if (GUIHide3)
{
GameObject.Find("ParticleSysDisplayCanvas").GetComponent<Canvas> ().enabled = false;
}
else
{
GameObject.Find("ParticleSysDisplayCanvas").GetComponent<Canvas> ().enabled = true;
}
}
if(Input.GetKeyDown(KeyCode.K))
{
GUIHide4 = !GUIHide4;
if (GUIHide3)
{
GameObject.Find("CanvasTips").GetComponent<Canvas> ().enabled = false;
}
else
{
GameObject.Find("CanvasTips").GetComponent<Canvas> ().enabled = true;
}
}
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 08babb817a4cfd443ac41b418ffd8387
timeCreated: 1494197047
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,52 @@
using UnityEngine;
using System.Collections;
namespace EpicToonFX
{
public class ETFXTarget : MonoBehaviour
{
[Header("Effect shown on target hit")]
public GameObject hitParticle;
[Header("Effect shown on target respawn")]
public GameObject respawnParticle;
private Renderer targetRenderer;
private Collider targetCollider;
void Start()
{
targetRenderer = GetComponent<Renderer>();
targetCollider = GetComponent<Collider>();
}
void SpawnTarget()
{
targetRenderer.enabled = true; //Shows the target
targetCollider.enabled = true; //Enables the collider
GameObject respawnEffect = Instantiate(respawnParticle, transform.position, transform.rotation) as GameObject; //Spawns attached respawn effect
Destroy(respawnEffect, 3.5f); //Removes attached respawn effect after x seconds
}
void OnTriggerEnter(Collider col)
{
if (col.tag == "Missile") // If collider is tagged as missile
{
if (hitParticle)
{
//Debug.Log("Target hit!");
GameObject destructibleEffect = Instantiate(hitParticle, transform.position, transform.rotation) as GameObject; // Spawns attached hit effect
Destroy(destructibleEffect, 2f); // Removes hit effect after x seconds
targetRenderer.enabled = false; // Hides the target
targetCollider.enabled = false; // Disables target collider
StartCoroutine(Respawn()); // Sets timer for respawning the target
}
}
}
IEnumerator Respawn()
{
yield return new WaitForSeconds(3);
SpawnTarget();
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: cf5b82cbe2647f24c9f1b44ee43b95b1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 80c67088b1c81154b9484036b9de2d6b
folderAsset: yes
timeCreated: 1454420857
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,43 @@
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.EventSystems;
namespace ETFXPEL
{
public enum ButtonTypes {
NotDefined,
Previous,
Next
}
public class PEButtonScript : MonoBehaviour, IEventSystemHandler, IPointerEnterHandler, IPointerExitHandler {
#pragma warning disable 414
private Button myButton;
#pragma warning disable 414
public ButtonTypes ButtonType = ButtonTypes.NotDefined;
// Use this for initialization
void Start () {
myButton = gameObject.GetComponent<Button> ();
}
public void OnPointerEnter(PointerEventData eventData) {
// Used for Tooltip
UICanvasManager.GlobalAccess.MouseOverButton = true;
UICanvasManager.GlobalAccess.UpdateToolTip (ButtonType);
}
public void OnPointerExit(PointerEventData eventData) {
// Used for Tooltip
UICanvasManager.GlobalAccess.MouseOverButton = false;
UICanvasManager.GlobalAccess.ClearToolTip ();
}
public void OnButtonClicked () {
// Button Click Actions
UICanvasManager.GlobalAccess.UIButtonClick(ButtonType);
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 4eed3eee8b1748946ab71bf4a26ce94c
timeCreated: 1454422495
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,120 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace ETFXPEL
{
public class ParticleEffectsLibrary : MonoBehaviour {
public static ParticleEffectsLibrary GlobalAccess;
void Awake () {
GlobalAccess = this;
currentActivePEList = new List<Transform> ();
TotalEffects = ParticleEffectPrefabs.Length;
CurrentParticleEffectNum = 1;
// Warn About Lengths of Arrays not matching
if (ParticleEffectSpawnOffsets.Length != TotalEffects) {
Debug.LogError ("ParticleEffectsLibrary-ParticleEffectSpawnOffset: Not all arrays match length, double check counts.");
}
if (ParticleEffectPrefabs.Length != TotalEffects) {
Debug.LogError ("ParticleEffectsLibrary-ParticleEffectPrefabs: Not all arrays match length, double check counts.");
}
// Setup Starting PE Name String
effectNameString = ParticleEffectPrefabs [CurrentParticleEffectIndex].name + " (" + CurrentParticleEffectNum.ToString() + " of " + TotalEffects.ToString() + ")";
}
// Stores total number of effects in arrays - NOTE: All Arrays must match length.
public int TotalEffects = 0;
public int CurrentParticleEffectIndex = 0;
public int CurrentParticleEffectNum = 0;
// public string[] ParticleEffectDisplayNames;
public Vector3[] ParticleEffectSpawnOffsets;
// How long until Particle Effect is Destroyed - 0 = never
public float[] ParticleEffectLifetimes;
public GameObject[] ParticleEffectPrefabs;
// Storing for deleting if looping particle effect
#pragma warning disable 414
private string effectNameString = "";
#pragma warning disable 414
private List<Transform> currentActivePEList;
void Start () {
}
public string GetCurrentPENameString() {
return ParticleEffectPrefabs [CurrentParticleEffectIndex].name + " (" + CurrentParticleEffectNum.ToString() + " of " + TotalEffects.ToString() + ")";
}
public void PreviousParticleEffect() {
// Destroy Looping Particle Effects
if (ParticleEffectLifetimes [CurrentParticleEffectIndex] == 0) {
if (currentActivePEList.Count > 0) {
for (int i = 0; i < currentActivePEList.Count; i++) {
if (currentActivePEList [i] != null) {
Destroy (currentActivePEList [i].gameObject);
}
}
currentActivePEList.Clear ();
}
}
// Select Previous Particle Effect
if (CurrentParticleEffectIndex > 0) {
CurrentParticleEffectIndex -= 1;
} else {
CurrentParticleEffectIndex = TotalEffects - 1;
}
CurrentParticleEffectNum = CurrentParticleEffectIndex + 1;
// Update PE Name String
effectNameString = ParticleEffectPrefabs [CurrentParticleEffectIndex].name + " (" + CurrentParticleEffectNum.ToString() + " of " + TotalEffects.ToString() + ")";
}
public void NextParticleEffect() {
// Destroy Looping Particle Effects
if (ParticleEffectLifetimes [CurrentParticleEffectIndex] == 0) {
if (currentActivePEList.Count > 0) {
for (int i = 0; i < currentActivePEList.Count; i++) {
if (currentActivePEList [i] != null) {
Destroy (currentActivePEList [i].gameObject);
}
}
currentActivePEList.Clear ();
}
}
// Select Next Particle Effect
if (CurrentParticleEffectIndex < TotalEffects - 1) {
CurrentParticleEffectIndex += 1;
} else {
CurrentParticleEffectIndex = 0;
}
CurrentParticleEffectNum = CurrentParticleEffectIndex + 1;
// Update PE Name String
effectNameString = ParticleEffectPrefabs [CurrentParticleEffectIndex].name + " (" + CurrentParticleEffectNum.ToString() + " of " + TotalEffects.ToString() + ")";
}
private Vector3 spawnPosition = Vector3.zero;
public void SpawnParticleEffect(Vector3 positionInWorldToSpawn) {
// Spawn Currently Selected Particle Effect
spawnPosition = positionInWorldToSpawn + ParticleEffectSpawnOffsets[CurrentParticleEffectIndex];
GameObject newParticleEffect = GameObject.Instantiate(ParticleEffectPrefabs[CurrentParticleEffectIndex], spawnPosition, ParticleEffectPrefabs[CurrentParticleEffectIndex].transform.rotation) as GameObject;
newParticleEffect.name = "PE_" + ParticleEffectPrefabs[CurrentParticleEffectIndex];
// Store Looping Particle Effects Systems
if (ParticleEffectLifetimes [CurrentParticleEffectIndex] == 0) {
currentActivePEList.Add (newParticleEffect.transform);
}
currentActivePEList.Add(newParticleEffect.transform);
// Destroy Particle Effect After Lifetime expired
if (ParticleEffectLifetimes [CurrentParticleEffectIndex] != 0) {
Destroy(newParticleEffect, ParticleEffectLifetimes[CurrentParticleEffectIndex]);
}
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 1a383f6b4f1b4ec4a9288e14968803f9
timeCreated: 1454421017
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,102 @@
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
namespace ETFXPEL
{
public class UICanvasManager : MonoBehaviour {
public static UICanvasManager GlobalAccess;
void Awake () {
GlobalAccess = this;
}
public bool MouseOverButton = false;
public Text PENameText;
public Text ToolTipText;
// Use this for initialization
void Start () {
if (PENameText != null)
PENameText.text = ParticleEffectsLibrary.GlobalAccess.GetCurrentPENameString();
}
// Update is called once per frame
void Update () {
// Mouse Click - Check if mouse over button to prevent spawning particle effects while hovering or using UI buttons.
if (!MouseOverButton) {
// Left Button Click
if (Input.GetMouseButtonUp (0)) {
// Spawn Currently Selected Particle System
SpawnCurrentParticleEffect();
}
}
if (Input.GetKeyUp (KeyCode.A)) {
SelectPreviousPE ();
}
if (Input.GetKeyUp (KeyCode.D)) {
SelectNextPE ();
}
}
public void UpdateToolTip(ButtonTypes toolTipType) {
if (ToolTipText != null) {
if (toolTipType == ButtonTypes.Previous) {
ToolTipText.text = "Select Previous Particle Effect";
}
else if (toolTipType == ButtonTypes.Next) {
ToolTipText.text = "Select Next Particle Effect";
}
}
}
public void ClearToolTip() {
if (ToolTipText != null) {
ToolTipText.text = "";
}
}
private void SelectPreviousPE() {
// Previous
ParticleEffectsLibrary.GlobalAccess.PreviousParticleEffect();
if (PENameText != null)
PENameText.text = ParticleEffectsLibrary.GlobalAccess.GetCurrentPENameString();
}
private void SelectNextPE() {
// Next
ParticleEffectsLibrary.GlobalAccess.NextParticleEffect();
if (PENameText != null)
PENameText.text = ParticleEffectsLibrary.GlobalAccess.GetCurrentPENameString();
}
private RaycastHit rayHit;
private void SpawnCurrentParticleEffect() {
// Spawn Particle Effect
Ray mouseRay = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast (mouseRay, out rayHit)) {
ParticleEffectsLibrary.GlobalAccess.SpawnParticleEffect (rayHit.point);
}
}
/// <summary>
/// User interfaces the button click.
/// </summary>
/// <param name="buttonTypeClicked">Button type clicked.</param>
public void UIButtonClick(ButtonTypes buttonTypeClicked) {
switch (buttonTypeClicked) {
case ButtonTypes.Previous:
// Select Previous Prefab
SelectPreviousPE();
break;
case ButtonTypes.Next:
// Select Next Prefab
SelectNextPE();
break;
default:
// Nothing
break;
}
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 678219500b099a742ab7e7957116755c
timeCreated: 1454420980
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: