This commit is contained in:
SoulliesOfficial
2025-10-23 00:49:44 -04:00
parent 9b1b5ca93f
commit 61a397dd4c
9846 changed files with 2618439 additions and 793547 deletions

View File

@@ -0,0 +1,32 @@
using UnityEngine;
using UnityEngine.UI;
namespace AllIn1VfxToolkit.Demo.Scripts
{
[RequireComponent(typeof(Dropdown))]
public class All1DemoDropdownScroller : MonoBehaviour
{
[SerializeField] private int dropdownElementCount;
[SerializeField] private KeyCode nextDropdownElementKey = KeyCode.M;
private Dropdown dropdown;
private void Start()
{
dropdown = GetComponent<Dropdown>();
}
private void Update()
{
if(Input.GetKeyDown(nextDropdownElementKey)) NextDropdownElements();
}
private void NextDropdownElements()
{
int nextValue = dropdown.value + 1;
if(nextValue < 0) nextValue = dropdownElementCount - 1;
if(nextValue >= dropdownElementCount) nextValue = 0;
dropdown.value = nextValue;
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: cd7dbf44b409e5842b87f3b4b85ed77c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 206665
packageName: All In 1 Vfx Toolkit
packageVersion: 2.1
assetPath: Assets/Plugins/AllIn1VfxToolkit/Demo & Assets/Demo/Scripts/All1DemoDropdownScroller.cs
uploadId: 701632

View File

@@ -0,0 +1,47 @@
using UnityEngine;
using UnityEngine.UI;
namespace AllIn1VfxToolkit.Demo.Scripts
{
[RequireComponent(typeof(AllIn1MouseRotate))]
public class All1DemoMouseLocker : MonoBehaviour
{
[SerializeField] private KeyCode mouseLockerKey = KeyCode.L;
[SerializeField] private Image lockButtonImage;
[SerializeField] private Color lockButtonColor;
private AllIn1MouseRotate allIn1MouseRotate;
private AllIn1DemoScaleTween lockedTween;
private Text pausedButtonText;
private bool currentlyLocked = false;
private void Start()
{
allIn1MouseRotate = GetComponent<AllIn1MouseRotate>();
lockedTween = lockButtonImage.GetComponent<AllIn1DemoScaleTween>();
pausedButtonText = lockButtonImage.GetComponentInChildren<Text>();
}
private void Update()
{
if(Input.GetKeyDown(mouseLockerKey)) DoMouseLockToggle();
}
public void DoMouseLockToggle()
{
currentlyLocked = !currentlyLocked;
allIn1MouseRotate.enabled = !currentlyLocked;
lockedTween.ScaleUpTween();
if(currentlyLocked)
{
pausedButtonText.text = "Unlock Camera";
lockButtonImage.color = lockButtonColor;
}
else
{
pausedButtonText.text = "Lock Camera";
lockButtonImage.color = Color.white;
}
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 8bc4796a3da17eb49b15bf7a2b28d5b2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 206665
packageName: All In 1 Vfx Toolkit
packageVersion: 2.1
assetPath: Assets/Plugins/AllIn1VfxToolkit/Demo & Assets/Demo/Scripts/All1DemoMouseLocker.cs
uploadId: 701632

View File

@@ -0,0 +1,27 @@
using UnityEngine;
using UnityEngine.UI;
namespace AllIn1VfxToolkit.Demo.Scripts
{
public class All1DemoProjectileObstacle : MonoBehaviour
{
[SerializeField] private GameObject[] projectileObstacles;
private Dropdown projectileObstacleDropdown;
private void Start()
{
projectileObstacleDropdown = GetComponent<Dropdown>();
DropdownValueChanged();
}
public void DropdownValueChanged()
{
SetProjectileObstacleN(projectileObstacleDropdown.value);
}
private void SetProjectileObstacleN(int nIndex)
{
for(int i = 0; i < projectileObstacles.Length; i++) projectileObstacles[i].SetActive(i == nIndex);
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 1256cc62dc417df4ab000150dee22a50
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 206665
packageName: All In 1 Vfx Toolkit
packageVersion: 2.1
assetPath: Assets/Plugins/AllIn1VfxToolkit/Demo & Assets/Demo/Scripts/All1DemoProjectileObstacle.cs
uploadId: 701632

View File

@@ -0,0 +1,38 @@
using UnityEngine;
using UnityEngine.UI;
namespace AllIn1VfxToolkit.Demo.Scripts
{
[RequireComponent(typeof(Dropdown))]
public class All1DemoSceneColor : MonoBehaviour
{
[SerializeField] private Color[] sceneColors;
[SerializeField] private Camera targetCamera;
[SerializeField] private float cameraColorMult = 1f;
[SerializeField] private MeshRenderer floorMeshRenderer;
[SerializeField] private float floorColorMult = 1f;
[SerializeField] private float fogColorMult = 1f;
private Dropdown sceneColorDropdown;
private Material floorMaterial;
private void Start()
{
sceneColorDropdown = GetComponent<Dropdown>();
floorMaterial = floorMeshRenderer.material;
DropdownValueChanged();
}
public void DropdownValueChanged()
{
SetSceneColor(sceneColorDropdown.value);
}
private void SetSceneColor(int nIndex)
{
targetCamera.backgroundColor = sceneColors[nIndex] * cameraColorMult;
floorMaterial.color = sceneColors[nIndex] * floorColorMult;
RenderSettings.fogColor = sceneColors[nIndex] * fogColorMult;
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 4171112584e5c674bbdf4d6196c9b5a9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 206665
packageName: All In 1 Vfx Toolkit
packageVersion: 2.1
assetPath: Assets/Plugins/AllIn1VfxToolkit/Demo & Assets/Demo/Scripts/All1DemoSceneColor.cs
uploadId: 701632

View File

@@ -0,0 +1,36 @@
using UnityEngine;
namespace AllIn1VfxToolkit.Demo.Scripts
{
[CreateAssetMenu(fileName = "All1VfxDemoEffect", menuName = "AllIn1Vfx/DemoEffect")]
public class All1VfxDemoEffect : ScriptableObject
{
[Header("Can be replayed?")]
public bool onlyOneAtATime;
public bool canBePlayedAgain = true;
public float randomSpreadRadius;
public float cooldown = 0.25f;
[Space, Header("Chooses between Static Effect and Shoot Projectile")]
public bool isShootProjectile;
[Space, Header("Static Effect Property")]
public GameObject effectPrefab;
public bool spawnTouchingFloor;
[Space, Header("Shoot Projectile Properties")]
public float projectileSpeed = 15f;
public GameObject projectilePrefab;
public GameObject muzzleFlashPrefab;
public GameObject impactPrefab;
[Space, Header("Camera Shake")]
public bool doCameraShake;
public float mainEffectShakeAmount = 1f;
[Header("Only if Shoot Projectile")] public float projectileImpactShakeAmount = 1f;
[Space, Header("Other Properties")]
public Vector3 positionOffset;
public float scaleMultiplier = 1f;
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 68c1d07ca14386b448937146f73392cb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 1206586993520771344, guid: 0000000000000000d000000000000000, type: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 206665
packageName: All In 1 Vfx Toolkit
packageVersion: 2.1
assetPath: Assets/Plugins/AllIn1VfxToolkit/Demo & Assets/Demo/Scripts/All1VfxDemoEffect.cs
uploadId: 701632

View File

@@ -0,0 +1,10 @@
using UnityEngine;
namespace AllIn1VfxToolkit.Demo.Scripts
{
[CreateAssetMenu(fileName = "All1VfxDemoEffectCollection", menuName = "AllIn1Vfx/DemoEffectCollection")]
public class All1VfxDemoEffectCollection : ScriptableObject
{
public All1VfxDemoEffect[] demoEffectCollection;
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 84c0ec397cb4d8f4c958b7f0bc3f545c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2488908585195742037, guid: 0000000000000000d000000000000000, type: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 206665
packageName: All In 1 Vfx Toolkit
packageVersion: 2.1
assetPath: Assets/Plugins/AllIn1VfxToolkit/Demo & Assets/Demo/Scripts/All1VfxDemoEffectCollection.cs
uploadId: 701632

View File

@@ -0,0 +1,3 @@
{
"name": "AllIn1VfxDemoScriptAssemblies"
}

View File

@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 1c0c083734c01cf44babf216202af25f
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 206665
packageName: All In 1 Vfx Toolkit
packageVersion: 2.1
assetPath: Assets/Plugins/AllIn1VfxToolkit/Demo & Assets/Demo/Scripts/All1VfxDemoScriptsAssembly.asmdef
uploadId: 701632

View File

@@ -0,0 +1,15 @@
using UnityEngine;
namespace AllIn1VfxToolkit.Demo.Scripts
{
public class AllIn1AutoRotate : MonoBehaviour
{
[SerializeField] private float rotationSpeed = 30f;
[SerializeField] private Vector3 rotationAxis = Vector3.up;
private void Update()
{
transform.Rotate(rotationAxis * (rotationSpeed * Time.deltaTime), Space.Self);
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 6f1ec618d02f6424491b8b7d827470d6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 206665
packageName: All In 1 Vfx Toolkit
packageVersion: 2.1
assetPath: Assets/Plugins/AllIn1VfxToolkit/Demo & Assets/Demo/Scripts/AllIn1AutoRotate.cs
uploadId: 701632

View File

@@ -0,0 +1,53 @@
using UnityEngine;
namespace AllIn1VfxToolkit.Demo.Scripts
{
public class AllIn1CanvasFader : MonoBehaviour
{
[SerializeField] private KeyCode fadeToggleKey = KeyCode.U;
[SerializeField] private float tweenSpeed = 1f;
[SerializeField] private AllIn1DemoScaleTween hideUiButtonTween;
private bool isTweening = false;
private float currentAlpha = 1f;
private float targetAlpha = 1f;
private CanvasGroup canvasGroup;
private bool hideUiButtonTweenNotNull;
private void Start()
{
canvasGroup = GetComponent<CanvasGroup>();
canvasGroup.alpha = 1f;
hideUiButtonTweenNotNull = hideUiButtonTween != null;
}
private void Update()
{
if(Input.GetKeyDown(fadeToggleKey)) HideUiButtonPressed();
if(!isTweening) return;
currentAlpha = Mathf.MoveTowards(currentAlpha, targetAlpha, Time.unscaledDeltaTime * tweenSpeed);
canvasGroup.alpha = currentAlpha;
if(targetAlpha == currentAlpha) isTweening = false;
}
public void HideUiButtonPressed()
{
if(currentAlpha < 0.01f) MakeCanvasVisibleTween();
else MakeCanvasInvisibleTween();
if(hideUiButtonTweenNotNull) hideUiButtonTween.ScaleUpTween();
}
private void MakeCanvasVisibleTween()
{
isTweening = true;
targetAlpha = 1f;
}
private void MakeCanvasInvisibleTween()
{
isTweening = true;
targetAlpha = 0f;
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 012bc27bc55024e439de4c5b3d88d2a9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 206665
packageName: All In 1 Vfx Toolkit
packageVersion: 2.1
assetPath: Assets/Plugins/AllIn1VfxToolkit/Demo & Assets/Demo/Scripts/AllIn1CanvasFader.cs
uploadId: 701632

View File

@@ -0,0 +1,23 @@
using UnityEngine;
using UnityEngine.UI;
namespace AllIn1VfxToolkit.Demo.Scripts
{
public class AllIn1ChangeAllChildTextFonts : MonoBehaviour
{
[SerializeField] private Font newFont;
[SerializeField] private bool changeFontOnStart;
private void Start()
{
if(changeFontOnStart) ChangeFonts();
}
[ContextMenu("ChangeFonts")]
private void ChangeFonts()
{
Text[] canvasTexts = GetComponentsInChildren<Text>();
for(int i = 0; i < canvasTexts.Length; i++) canvasTexts[i].font = newFont;
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 4522919cf8f417c47ad5eebc5843b2c7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 206665
packageName: All In 1 Vfx Toolkit
packageVersion: 2.1
assetPath: Assets/Plugins/AllIn1VfxToolkit/Demo & Assets/Demo/Scripts/AllIn1ChangeAllChildTextFonts.cs
uploadId: 701632

View File

@@ -0,0 +1,51 @@
using UnityEngine;
namespace AllIn1VfxToolkit.Demo.Scripts
{
public class AllIn1DemoProjectile : MonoBehaviour
{
[SerializeField] private float inaccurateAmount = 0.05f;
private GameObject currentImpactPrefab;
private Transform currentHierarchyParent;
private bool doImpactSpawn;
private bool doShake = false;
private float shakeAmountOnImpact, impactScaleSize;
public void Initialize(Transform hierarchyParent, Vector3 projectileDir, float speed, GameObject impactPrefab, float impactScaleSize)
{
currentHierarchyParent = hierarchyParent;
currentImpactPrefab = impactPrefab;
doImpactSpawn = currentImpactPrefab != null;
this.impactScaleSize = impactScaleSize;
ApplyPrecisionOffsetToProjectileDir(ref projectileDir);
GetComponent<Rigidbody>().linearVelocity = projectileDir * speed;
}
public void AddScreenShakeOnImpact(float projectileImpactShakeAmount)
{
doShake = true;
shakeAmountOnImpact = projectileImpactShakeAmount;
}
private void ApplyPrecisionOffsetToProjectileDir(ref Vector3 projectileDir)
{
projectileDir.x += Random.Range(-inaccurateAmount, inaccurateAmount);
projectileDir.y += Random.Range(-inaccurateAmount, inaccurateAmount);
projectileDir.z += Random.Range(-inaccurateAmount, inaccurateAmount);
}
private void OnTriggerEnter(Collider other)
{
if(doImpactSpawn)
{
Transform t = Instantiate(currentImpactPrefab, transform.position, Quaternion.identity).transform;
t.parent = currentHierarchyParent;
t.localScale *= impactScaleSize;
}
if(doShake) AllIn1Shaker.i.DoCameraShake(shakeAmountOnImpact);
Destroy(gameObject);
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 2948a53b53338fb49aa0621342e062b6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 206665
packageName: All In 1 Vfx Toolkit
packageVersion: 2.1
assetPath: Assets/Plugins/AllIn1VfxToolkit/Demo & Assets/Demo/Scripts/AllIn1DemoProjectile.cs
uploadId: 701632

View File

@@ -0,0 +1,49 @@
using UnityEngine;
namespace AllIn1VfxToolkit.Demo.Scripts
{
public class AllIn1DemoScaleTween : MonoBehaviour
{
[SerializeField] private float maxTweenScale = 2.0f;
[SerializeField] private float minTweenScale = 0.8f;
[SerializeField] private float tweenSpeed = 15f;
private bool isTweening = false;
private float currentScale = 1f;
private Vector3 scaleToApply = Vector3.one;
private void Update()
{
if(!isTweening) return;
currentScale = Mathf.Lerp(currentScale, 1f, Time.unscaledDeltaTime * tweenSpeed);
UpdateScaleToApply();
ApplyScale();
if(Mathf.Abs(currentScale - 1f) < 0.02f) isTweening = false;
}
private void UpdateScaleToApply()
{
scaleToApply.x = currentScale;
scaleToApply.y = currentScale;
}
private void ApplyScale()
{
transform.localScale = scaleToApply;
}
public void ScaleUpTween()
{
isTweening = true;
currentScale = maxTweenScale;
UpdateScaleToApply();
}
public void ScaleDownTween()
{
isTweening = true;
currentScale = minTweenScale;
UpdateScaleToApply();
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 4ba1410cf17367744ae1d60819318cfa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 206665
packageName: All In 1 Vfx Toolkit
packageVersion: 2.1
assetPath: Assets/Plugins/AllIn1VfxToolkit/Demo & Assets/Demo/Scripts/AllIn1DemoScaleTween.cs
uploadId: 701632

View File

@@ -0,0 +1,26 @@
using UnityEngine;
namespace AllIn1VfxToolkit.Demo.Scripts
{
public class AllIn1DoShake : MonoBehaviour
{
[SerializeField] private float shakeAmount = 0.15f;
[SerializeField] private bool doShakeOnStart;
[SerializeField] private float shakeOnStartDelay;
private void Start()
{
if(doShakeOnStart)
{
if(shakeOnStartDelay < Time.deltaTime) DoShake();
else Invoke(nameof(DoShake), shakeOnStartDelay);
}
}
public void DoShake()
{
if(AllIn1Shaker.i != null) AllIn1Shaker.i.DoCameraShake(shakeAmount);
else Debug.LogError($"No AllIn1Shaker found. Please add one to the scene");
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 588a08fbd7cc6f64cbd1faa6039392b4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 206665
packageName: All In 1 Vfx Toolkit
packageVersion: 2.1
assetPath: Assets/Plugins/AllIn1VfxToolkit/Demo & Assets/Demo/Scripts/AllIn1DoShake.cs
uploadId: 701632

View File

@@ -0,0 +1,98 @@
using UnityEngine;
using UnityEngine.UI;
namespace AllIn1VfxToolkit.Demo.Scripts
{
public class AllIn1MouseRotate : MonoBehaviour
{
[SerializeField] private Transform objectToRotate;
[SerializeField] private float rotationSpeedHorizontal = 10f;
[SerializeField] private float translateVerticalSpeed = 5f;
[SerializeField] private float translateScrollSpeed = 2f;
[Space, Header("Lock Cursor")]
[SerializeField] private bool lockCursor;
[SerializeField] private KeyCode lockCursorKeyCode;
[SerializeField] private AllIn1DemoScaleTween hideUiButtonTween;
[SerializeField] private Image lockedButtonImage;
[SerializeField] private Text lockedButtonText;
[SerializeField] private Color lockedButtonColor;
private bool cursorIsLocked;
[Space, Header("Movement Bounds")]
[SerializeField] private float maxHeight = 40f;
[SerializeField] private float maxZoom = 2f;
[SerializeField] private float minZoom = 40f;
private Vector3 currPosition = Vector3.zero;
private float dt;
private void Start()
{
if(lockCursor) cursorIsLocked = false;
else cursorIsLocked = true;
ToggleCursorLocked();
}
private void Update()
{
if(Time.timeSinceLevelLoad < 0.5f) return; //We wait a few moments to allow scene to fully load up
dt = Time.unscaledDeltaTime;
CamRotateAroundYAxis();
currPosition = objectToRotate.position;
CamHeightTranslate();
CamZoom();
if(Input.GetKeyDown(lockCursorKeyCode)) ToggleCursorLocked();
}
private void CamRotateAroundYAxis()
{
float mouseInputX = Input.GetAxis("Mouse X") * dt * 10f * rotationSpeedHorizontal;
objectToRotate.RotateAround(transform.position, Vector3.up, mouseInputX);
}
private void CamHeightTranslate()
{
float mouseInputY = Input.GetAxis("Mouse Y") * dt * translateVerticalSpeed;
currPosition.y = Mathf.Clamp(currPosition.y + mouseInputY, 0.25f, maxHeight);
objectToRotate.position = currPosition;
objectToRotate.LookAt(transform);
}
private void CamZoom()
{
float mouseInputWheel = Input.GetAxis("Mouse ScrollWheel") * dt * 100f * translateScrollSpeed;
Vector3 currZoomVector = objectToRotate.forward * mouseInputWheel;
if(mouseInputWheel > 0 && Vector3.Distance(transform.position, objectToRotate.position) <= maxZoom) currZoomVector = Vector3.zero;
else if(mouseInputWheel < 0 && Vector3.Distance(transform.position, objectToRotate.position) >= minZoom) currZoomVector = Vector3.zero;
currPosition += currZoomVector;
objectToRotate.position = currPosition;
}
public void ToggleCursorLocked()
{
cursorIsLocked = !cursorIsLocked;
hideUiButtonTween.ScaleUpTween();
if(cursorIsLocked)
{
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
lockedButtonImage.color = lockedButtonColor;
lockedButtonText.text = "Unlock Cursor";
}
else
{
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
lockedButtonImage.color = Color.white;
lockedButtonText.text = "Lock Cursor";
}
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 3591cc958989dc14ebfd7a1a63112382
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 206665
packageName: All In 1 Vfx Toolkit
packageVersion: 2.1
assetPath: Assets/Plugins/AllIn1VfxToolkit/Demo & Assets/Demo/Scripts/AllIn1MouseRotate.cs
uploadId: 701632

View File

@@ -0,0 +1,63 @@
using UnityEngine;
using UnityEngine.Serialization;
namespace AllIn1VfxToolkit.Demo.Scripts
{
public class AllIn1Shaker : MonoBehaviour
{
[SerializeField] Vector3 maximumTranslationShake = Vector3.one;
[SerializeField] Vector3 maximumAngularShake = Vector3.one * 15;
[SerializeField] float shakeFrequency = 25;
[SerializeField] float shakeSmoothingExponent = 1;
[SerializeField] float shakeRecoverPerSecond = 1;
public static AllIn1Shaker i;
private float currentShakeAmount;
private float seed;
private void Awake()
{
if (i != null && i != this) Destroy(gameObject);
else i = this;
seed = Random.value;
}
private void Update()
{
float shake = SmoothShakeToApply();
ShakePosition(shake);
ShakeRotation(shake);
currentShakeAmount = Mathf.Clamp01(currentShakeAmount - shakeRecoverPerSecond * Time.deltaTime);
}
private float SmoothShakeToApply()
{
float shake = Mathf.Pow(currentShakeAmount, shakeSmoothingExponent);
return shake;
}
private void ShakeRotation(float shake)
{
transform.localRotation = Quaternion.Euler(new Vector3(
maximumAngularShake.x * (Mathf.PerlinNoise(seed + 3, Time.time * shakeFrequency) * 2 - 1),
maximumAngularShake.y * (Mathf.PerlinNoise(seed + 4, Time.time * shakeFrequency) * 2 - 1),
maximumAngularShake.z * (Mathf.PerlinNoise(seed + 5, Time.time * shakeFrequency) * 2 - 1)
) * shake);
}
private void ShakePosition(float shake)
{
transform.localPosition = new Vector3(
maximumTranslationShake.x * (Mathf.PerlinNoise(seed, Time.time * shakeFrequency) * 2 - 1),
maximumTranslationShake.y * (Mathf.PerlinNoise(seed + 1, Time.time * shakeFrequency) * 2 - 1),
maximumTranslationShake.z * (Mathf.PerlinNoise(seed + 2, Time.time * shakeFrequency) * 2 - 1)
) * shake;
}
public void DoCameraShake(float shakeAmount)
{
currentShakeAmount = shakeAmount;
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 24a2b68611641b7458532cc8352695bf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 206665
packageName: All In 1 Vfx Toolkit
packageVersion: 2.1
assetPath: Assets/Plugins/AllIn1VfxToolkit/Demo & Assets/Demo/Scripts/AllIn1Shaker.cs
uploadId: 701632

View File

@@ -0,0 +1,87 @@
using UnityEngine;
using UnityEngine.UI;
namespace AllIn1VfxToolkit.Demo.Scripts
{
public class AllIn1TimeControl : MonoBehaviour
{
[SerializeField] private KeyCode increaseTimeScale = KeyCode.UpArrow;
[SerializeField] private KeyCode increaseTimeScaleAlt = KeyCode.W;
[SerializeField] private KeyCode decreaseTimeScale = KeyCode.DownArrow;
[SerializeField] private KeyCode decreaseTimeScaleAlt = KeyCode.S;
[SerializeField] private KeyCode pauseKey = KeyCode.P;
[SerializeField, Range(0f, 1f)] private float timeScaleInterval = 0.05f;
[SerializeField] private Slider timeScaleSlider;
[SerializeField] private Image pausedButtonImage;
[SerializeField] private Color pausedButtonColor;
private bool timeScaleSliderNotNull;
private float lastChangeTime;
private AllIn1DemoScaleTween pausedButtonTween;
private Text pausedButtonText;
private void Start()
{
timeScaleSliderNotNull = timeScaleSlider != null;
pausedButtonTween = pausedButtonImage.GetComponent<AllIn1DemoScaleTween>();
pausedButtonText = pausedButtonImage.GetComponentInChildren<Text>();
UpdateTimeScaleUI();
if(timeScaleSliderNotNull) timeScaleSlider.onValueChanged.AddListener(delegate { ChangeTimeScale(timeScaleSlider.value - Time.timeScale); });
}
private void Update()
{
if(Input.GetKeyDown(increaseTimeScale) || Input.GetKeyDown(increaseTimeScaleAlt)) ChangeTimeScale(timeScaleInterval);
if(Input.GetKeyDown(decreaseTimeScale) || Input.GetKeyDown(decreaseTimeScaleAlt)) ChangeTimeScale(-timeScaleInterval);
if(Input.GetKeyDown(pauseKey))
{
if(Time.timeScale < 0.01f) ChangeTimeScale(1f - Time.timeScale);
else ChangeTimeScale(-Time.timeScale);
pausedButtonTween.ScaleUpTween();
}
float timeScaleChangeInterval = 0.1f;
if(!(Time.unscaledTime - lastChangeTime > timeScaleChangeInterval)) return;
if(Input.GetKey(increaseTimeScale) || Input.GetKey(increaseTimeScaleAlt)) ChangeTimeScale(timeScaleInterval);
if(Input.GetKey(decreaseTimeScale) || Input.GetKey(decreaseTimeScaleAlt)) ChangeTimeScale(-timeScaleInterval);
}
private void ChangeTimeScale(float changeAmount)
{
Time.timeScale = Mathf.Clamp(Time.timeScale + changeAmount, 0.0f, 1f);
lastChangeTime = Time.unscaledTime;
UpdateTimeScaleUI();
}
private void UpdateTimeScaleUI()
{
if(timeScaleSliderNotNull) timeScaleSlider.value = Time.timeScale;
if(Time.timeScale < 0.01f)
{
pausedButtonText.text = "Unpause";
pausedButtonImage.color = pausedButtonColor;
}
else
{
pausedButtonText.text = "Pause";
pausedButtonImage.color = Color.white;
}
}
public void PauseUiButton()
{
if(Time.timeScale < 0.01f) Time.timeScale = 1f;
else Time.timeScale = 0f;
UpdateTimeScaleUI();
}
public void CurrentEffectChanged()
{
if(Time.timeScale < 0.01f)
{
Time.timeScale = 0.1f;
UpdateTimeScaleUI();
}
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 36b11c5475471bf4db78a90cae614ead
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 206665
packageName: All In 1 Vfx Toolkit
packageVersion: 2.1
assetPath: Assets/Plugins/AllIn1VfxToolkit/Demo & Assets/Demo/Scripts/AllIn1TimeControl.cs
uploadId: 701632

View File

@@ -0,0 +1,14 @@
using UnityEngine;
namespace AllIn1VfxToolkit.Demo.Scripts
{
public class AllIn1VfxAutoDestroy : MonoBehaviour
{
[SerializeField] private float destroyTime = 1f;
private void Start()
{
Destroy(gameObject, destroyTime);
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 83d354433035fb44ca1436010e6839c1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 206665
packageName: All In 1 Vfx Toolkit
packageVersion: 2.1
assetPath: Assets/Plugins/AllIn1VfxToolkit/Demo & Assets/Demo/Scripts/AllIn1VfxAutoDestroy.cs
uploadId: 701632

View File

@@ -0,0 +1,200 @@
using System.Collections;
using UnityEngine;
using UnityEngine.UI;
namespace AllIn1VfxToolkit.Demo.Scripts
{
public class AllIn1VfxDemoController : MonoBehaviour
{
[SerializeField] private int startingCollectionIndex, startingEffectIndex;
[Space, Header("Demo Effects")]
[SerializeField] private All1VfxDemoEffectCollection[] effectsToSpawnCollections;
[Space, Header("Projectile References")]
[Space, SerializeField] private GameObject projectileBasePrefab;
[SerializeField] private GameObject projectileSceneSetupObject;
[SerializeField] private Transform projectileSpawnPoint;
[Space, Header("Demo Controller Input")]
[SerializeField] private KeyCode playEffectKey = KeyCode.Q;
[SerializeField] private KeyCode nextEffectKey = KeyCode.RightArrow;
[SerializeField] private KeyCode nextEffectKeyAlt = KeyCode.D;
[SerializeField] private KeyCode previousEffectKey = KeyCode.LeftArrow;
[SerializeField] private KeyCode previousEffectKeyAlt = KeyCode.A;
[Space, Header("UI and Other References")]
[SerializeField] private Text currentEffectLabel;
[SerializeField] private Button playEffectButton;
[SerializeField] private GameObject playEffectInstructionsGo;
[SerializeField] private Button nextEffectButton, previousEffectButton;
[SerializeField] private Transform groundSpawnTransform, cameraPivotTransform;
[SerializeField] private float camPivotHeightSmoothing;
[SerializeField] private GameObject projectileEffectUI, normalEffectUI;
private All1VfxDemoEffect currDemoEffect;
private int currDemoCollectionIndex, currDemoEffectIndex, currentEffectPlays;
private AllIn1DemoScaleTween currLabelTween, playButtTween, nextButtTween, prevButtTween;
private float timeSinceEffectPlay;
private AllIn1TimeControl allIn1TimeControl;
private void Start()
{
projectileSceneSetupObject.SetActive(false);
currDemoCollectionIndex = startingCollectionIndex;
currDemoEffectIndex = startingEffectIndex;
currLabelTween = currentEffectLabel.GetComponent<AllIn1DemoScaleTween>();
playButtTween = playEffectButton.GetComponent<AllIn1DemoScaleTween>();
nextButtTween = nextEffectButton.GetComponent<AllIn1DemoScaleTween>();
prevButtTween = previousEffectButton.GetComponent<AllIn1DemoScaleTween>();
allIn1TimeControl = gameObject.GetComponent<AllIn1TimeControl>();
SetupAndInstantiateCurrentEffect();
}
private void Update()
{
if(currDemoEffect.canBePlayedAgain && Input.GetKeyDown(playEffectKey)) PlayCurrentEffect();
if(Input.GetKeyDown(nextEffectKey) || Input.GetKeyDown(nextEffectKeyAlt)) ChangeCurrentEffect(1);
else if(Input.GetKeyDown(previousEffectKey) || Input.GetKeyDown(previousEffectKeyAlt)) ChangeCurrentEffect(-1);
if(currDemoEffect.spawnTouchingFloor) cameraPivotTransform.position = Vector3.Lerp(cameraPivotTransform.position, new Vector3(0f, 0.1f, 0f), Time.unscaledDeltaTime * camPivotHeightSmoothing);
if(!currDemoEffect.spawnTouchingFloor) cameraPivotTransform.position = Vector3.Lerp(cameraPivotTransform.position, new Vector3(0f, 2f, 0f), Time.unscaledDeltaTime * camPivotHeightSmoothing);
CooldownHandling();
}
private void CooldownHandling()
{
if(!currDemoEffect.canBePlayedAgain) return;
timeSinceEffectPlay += Time.deltaTime;
playEffectButton.interactable = currentEffectPlays < 1 || timeSinceEffectPlay >= currDemoEffect.cooldown;
}
public void PlayCurrentEffect(bool isAfterSetupAndInstantiateEffect = false)
{
if(currentEffectPlays > 0 && timeSinceEffectPlay < currDemoEffect.cooldown) return; //Return if on cooldown and not first play
if(!isAfterSetupAndInstantiateEffect && Time.timeSinceLevelLoad > 0.1f) playButtTween.ScaleUpTween();
if(!isAfterSetupAndInstantiateEffect && currDemoEffect.onlyOneAtATime) DestroyAllChildren();
timeSinceEffectPlay = 0f;
Transform tempTransform = null;
if(currDemoEffect.isShootProjectile)
{
if(currDemoEffect.muzzleFlashPrefab != null)
{
tempTransform = Instantiate(currDemoEffect.muzzleFlashPrefab, projectileSpawnPoint.position, Quaternion.identity).transform;
tempTransform.localRotation = Quaternion.identity;
tempTransform.forward = projectileSpawnPoint.forward;
tempTransform.parent = transform;
tempTransform.localScale *= currDemoEffect.scaleMultiplier;
}
Transform projectileBase = Instantiate(projectileBasePrefab, projectileSpawnPoint.position, Quaternion.identity).transform;
projectileBase.forward = projectileSpawnPoint.forward;
projectileBase.parent = transform;
projectileBase.localRotation = Quaternion.identity;
tempTransform = Instantiate(currDemoEffect.projectilePrefab, projectileSpawnPoint.position, Quaternion.identity).transform;
tempTransform.localRotation = Quaternion.identity;
tempTransform.forward = projectileSpawnPoint.forward;
tempTransform.parent = projectileBase;
AllIn1DemoProjectile tempProjectileInstance = projectileBase.GetComponent<AllIn1DemoProjectile>();
tempProjectileInstance.Initialize(transform, projectileSpawnPoint.forward, currDemoEffect.projectileSpeed, currDemoEffect.impactPrefab, currDemoEffect.scaleMultiplier);
if(currDemoEffect.doCameraShake) tempProjectileInstance.AddScreenShakeOnImpact(currDemoEffect.projectileImpactShakeAmount);
}
else
{
tempTransform = Instantiate(currDemoEffect.effectPrefab, transform).transform;
if(!currDemoEffect.spawnTouchingFloor) tempTransform.localPosition = Vector3.zero;
else tempTransform.position = groundSpawnTransform.position;
tempTransform.localRotation = currDemoEffect.effectPrefab.transform.rotation;
if(currDemoEffect.canBePlayedAgain && currDemoEffect.randomSpreadRadius > 0f && currentEffectPlays > 0)
{
tempTransform.position += new Vector3(Random.Range(-currDemoEffect.randomSpreadRadius, currDemoEffect.randomSpreadRadius), 0f,
Random.Range(-currDemoEffect.randomSpreadRadius, currDemoEffect.randomSpreadRadius));
}
}
tempTransform.localScale *= currDemoEffect.scaleMultiplier;
tempTransform.position += currDemoEffect.positionOffset;
if(!isAfterSetupAndInstantiateEffect && currDemoEffect.doCameraShake) AllIn1Shaker.i.DoCameraShake(currDemoEffect.mainEffectShakeAmount);
currentEffectPlays++;
}
public void ChangeCurrentEffect(int changeAmount)
{
if(changeAmount < 0) prevButtTween.ScaleUpTween();
else if(changeAmount > 0) nextButtTween.ScaleUpTween();
StartCoroutine(CurrentEffectLabelTweenEffectCR());
currDemoEffectIndex += changeAmount;
SetupAndInstantiateCurrentEffect();
allIn1TimeControl.CurrentEffectChanged();
}
private void SetupAndInstantiateCurrentEffect()
{
DestroyAllChildren();
currentEffectPlays = 0;
ComputeValidEffectAndCollectionIndex();
currDemoEffect = effectsToSpawnCollections[currDemoCollectionIndex].demoEffectCollection[currDemoEffectIndex];
projectileSceneSetupObject.SetActive(currDemoEffect.isShootProjectile);
projectileEffectUI.SetActive(currDemoEffect.isShootProjectile);
normalEffectUI.SetActive(!currDemoEffect.isShootProjectile);
currentEffectLabel.text = currDemoEffect.isShootProjectile ? currDemoEffect.projectilePrefab.name : currDemoEffect.effectPrefab.name;
playEffectButton.gameObject.SetActive(currDemoEffect.canBePlayedAgain);
playEffectInstructionsGo.SetActive(currDemoEffect.canBePlayedAgain);
PlayCurrentEffect(true);
}
private void ComputeValidEffectAndCollectionIndex()
{
int demoEffectOperation = 0; // 0 means no operation, 1 means assign first collection effect, 2 means last collection effect
if(currDemoEffectIndex < 0)
{
currDemoCollectionIndex--;
demoEffectOperation = 2;
}
else if(currDemoEffectIndex >= effectsToSpawnCollections[currDemoCollectionIndex].demoEffectCollection.Length)
{
currDemoCollectionIndex++;
demoEffectOperation = 1;
}
if(currDemoCollectionIndex < 0)
{
currDemoCollectionIndex = effectsToSpawnCollections.Length - 1;
demoEffectOperation = 2;
}
else if(currDemoCollectionIndex >= effectsToSpawnCollections.Length)
{
currDemoCollectionIndex = 0;
demoEffectOperation = 1;
}
if(demoEffectOperation > 0)
{
if(demoEffectOperation == 1) currDemoEffectIndex = 0;
else if(demoEffectOperation == 2) currDemoEffectIndex = effectsToSpawnCollections[currDemoCollectionIndex].demoEffectCollection.Length - 1;
}
}
private IEnumerator CurrentEffectLabelTweenEffectCR()
{
//This mess of a function prevents the Best Fit on currentEffectLabel to scale in a weird way during 1 frame
Color startColor = currentEffectLabel.color;
currLabelTween.ScaleDownTween();
currentEffectLabel.color = new Color(startColor.r, startColor.g, startColor.b, 0f);
yield return null;
currentEffectLabel.color = new Color(startColor.r, startColor.g, startColor.b, 1f);
}
private void DestroyAllChildren()
{
foreach(Transform child in transform) Destroy(child.gameObject);
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 4b359abc6e0e5d24a87889a91d4e7351
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 206665
packageName: All In 1 Vfx Toolkit
packageVersion: 2.1
assetPath: Assets/Plugins/AllIn1VfxToolkit/Demo & Assets/Demo/Scripts/AllIn1VfxDemoController.cs
uploadId: 701632

View File

@@ -0,0 +1,27 @@
using UnityEngine;
namespace AllIn1VfxToolkit.Demo.Scripts
{
[RequireComponent(typeof(Light))]
public class AllIn1VfxFadeLight : MonoBehaviour
{
[SerializeField] private float fadeDuration = 0.1f;
[SerializeField] private bool destroyWhenFaded = true;
private Light targetLight;
private float animationRatioRemaining = 1f;
private float iniLightIntensity;
private void Start()
{
targetLight = GetComponent<Light>();
iniLightIntensity = targetLight.intensity;
}
private void Update()
{
targetLight.intensity = Mathf.Lerp(0f, iniLightIntensity, animationRatioRemaining);
animationRatioRemaining -= Time.deltaTime / fadeDuration;
if(destroyWhenFaded && animationRatioRemaining <= 0f) Destroy(gameObject);
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: c1d5630570373fe44a8d6a476a387ab0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 206665
packageName: All In 1 Vfx Toolkit
packageVersion: 2.1
assetPath: Assets/Plugins/AllIn1VfxToolkit/Demo & Assets/Demo/Scripts/AllIn1VfxFadeLight.cs
uploadId: 701632

View File

@@ -0,0 +1,49 @@
using UnityEngine;
using Random = UnityEngine.Random;
namespace AllIn1VfxToolkit.Demo.Scripts
{
[ExecuteInEditMode]
public class AllIn1VfxParticleSystemTime : MonoBehaviour
{
[SerializeField] private bool updateEveryFrame = true;
[Header("If Y component is 0 X component will be used instead")]
[SerializeField] private Vector2 simulationTimeRange = Vector2.zero;
[Space, Header("If null we search in this GameObject")]
[SerializeField] private ParticleSystem targetPs;
private void Start()
{
SetSimulationTime();
}
private void Update()
{
if(updateEveryFrame) SetSimulationTime();
}
private void OnValidate()
{
SetSimulationTime();
}
private bool isValid = true;
private void SetSimulationTime()
{
if(targetPs == null)
{
targetPs = GetComponent<ParticleSystem>();
if(targetPs == null && isValid)
{
Debug.LogError("The object " + gameObject.name + " has no Particle System and you are trying to access it. Please take a look");
isValid = false;
}
}
if(!isValid) return;
if(simulationTimeRange.y > 0f) targetPs.Simulate(Random.Range(simulationTimeRange.x, simulationTimeRange.y), true, true);
else targetPs.Simulate(simulationTimeRange.x, true, true);
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: e6b022990a519244aad6339516e1386c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 206665
packageName: All In 1 Vfx Toolkit
packageVersion: 2.1
assetPath: Assets/Plugins/AllIn1VfxToolkit/Demo & Assets/Demo/Scripts/AllIn1VfxParticleSystemTime.cs
uploadId: 701632