Initialer Upload neues Unity-Projekt

This commit is contained in:
Daniel Ocks
2025-07-03 11:02:29 +02:00
commit 27d6b94b7c
8167 changed files with 1116569 additions and 0 deletions

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 0b7dacd25f47c0e45ae29a72371d6852
folderAsset: yes
timeCreated: 1559650939
licenseType: Store
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,76 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: Color
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.9
- _GlossyReflections: 1
- _Metallic: 0.5
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 068bd8ec07ce5ea43bfe89ed1892e633
timeCreated: 1559650972
licenseType: Store
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,76 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: Conductive
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.9
- _GlossyReflections: 1
- _Metallic: 0.95
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 0c71095ac5a3ddc40a4e4601f3d6374e
timeCreated: 1559650972
licenseType: Store
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,76 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: Dielectric
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.9
- _GlossyReflections: 1
- _Metallic: 0.15
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 5cfcb95b11f4510429a792bb115e566b
timeCreated: 1559650972
licenseType: Store
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

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

BIN
Assets/3D Skybox/Common/Prefabs/Main Camera.prefab (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: b61c6337777d7ee41a220559cae2c38f
timeCreated: 1559653522
licenseType: Store
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/3D Skybox/Common/Prefabs/Spheres.prefab (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 12f6251a8fcec9549b26236a328d40bc
timeCreated: 1559653528
licenseType: Store
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 454e4c7dc8bc35642b25fe7db9591ec2
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4e7c83cd439e21947a052e0a76f4eaf3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,62 @@
#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
namespace Crosstales.Common.EditorTask
{
/// <summary>Checks if a 'Happy new year'-message must be displayed.</summary>
[InitializeOnLoad]
public static class NYCheck
{
private const string KEY_NYCHECK_DATE = "CT_CFG_NYCHECK_DATE";
private static readonly System.Random rnd = new System.Random();
#region Constructor
static NYCheck()
{
string lastYear = EditorPrefs.GetString(KEY_NYCHECK_DATE);
string year = System.DateTime.Now.ToString("yyyy");
//string year = "9999"; //only for test
string month = System.DateTime.Now.ToString("MM");
//string month = "01"; //only for test
if (!year.Equals(lastYear) && month.Equals("01"))
{
Debug.LogWarning(createString("-", 400));
Debug.LogWarning($"<color=yellow>¸.•°*”˜˜”*°•.¸ ★</color> <b><color=darkblue>crosstales LLC</color></b> wishes you a <b>happy</b> and <b>successful <color=orange>{year}</color></b>! <color=yellow>★ ¸.•*¨`*•.</color><color=cyan>♫</color><color=red>❤</color><color=lime>♫</color><color=red>❤</color><color=magenta>♫</color><color=red>❤</color>");
Debug.LogWarning(createString("-", 400));
if (!year.Equals("9999"))
EditorPrefs.SetString(KEY_NYCHECK_DATE, year);
}
}
private static string createString(string replaceChars, int stringLength)
{
if (replaceChars != null)
{
if (replaceChars.Length > 1)
{
char[] chars = new char[stringLength];
for (int ii = 0; ii < stringLength; ii++)
{
chars[ii] = replaceChars[rnd.Next(0, replaceChars.Length)];
}
return new string(chars);
}
return replaceChars.Length == 1 ? new string(replaceChars[0], stringLength) : string.Empty;
}
return string.Empty;
}
#endregion
}
}
#endif
// © 2017-2023 crosstales LLC (https://www.crosstales.com)

View File

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

View File

@ -0,0 +1,138 @@
using UnityEngine;
namespace Crosstales.Internal
{
/// <summary>
/// A simple free camera to be added to a Unity game object.
///
/// Keys:
/// wasd / arrows - movement
/// q/e - up/down (local space)
/// r/f - up/down (world space)
/// pageup/pagedown - up/down (world space)
/// hold shift - enable fast movement mode
/// right mouse - enable free look
/// mouse - free look / rotation
/// </summary>
[DisallowMultipleComponent]
public class FreeCam : MonoBehaviour
{
#region Variables
/// <summary>Normal speed of camera movement.</summary>
public float MovementSpeed = 10f;
/// <summary>Speed of camera movement when shift is held down.</summary>
public float FastMovementSpeed = 100f;
/// <summary>Sensitivity for free look.</summary>
public float FreeLookSensitivity = 3f;
/// <summary>Amount to zoom the camera when using the mouse wheel.</summary>
public float ZoomSensitivity = 10f;
/// <summary>Amount to zoom the camera when using the mouse wheel (fast mode).</summary>
public float FastZoomSensitivity = 50f;
private Transform tf;
private bool looking;
#endregion
#region MonoBehaviour methods
private void Start()
{
tf = transform;
}
private void Update()
{
bool fastMode = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);
float movementSpeed = fastMode ? FastMovementSpeed : MovementSpeed;
if (Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.LeftArrow))
tf.position += Time.deltaTime * movementSpeed * -tf.right;
if (Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.RightArrow))
tf.position += Time.deltaTime * movementSpeed * tf.right;
if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.UpArrow))
tf.position += Time.deltaTime * movementSpeed * tf.forward;
if (Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.DownArrow))
tf.position += Time.deltaTime * movementSpeed * -tf.forward;
if (Input.GetKey(KeyCode.Q))
tf.position += Time.deltaTime * movementSpeed * tf.up;
if (Input.GetKey(KeyCode.E))
tf.position += Time.deltaTime * movementSpeed * -tf.up;
if (Input.GetKey(KeyCode.R) || Input.GetKey(KeyCode.PageUp))
tf.position += Time.deltaTime * movementSpeed * Vector3.up;
if (Input.GetKey(KeyCode.F) || Input.GetKey(KeyCode.PageDown))
tf.position += Time.deltaTime * movementSpeed * -Vector3.up;
if (looking)
{
Vector3 localEulerAngles = tf.localEulerAngles;
float newRotationX = localEulerAngles.y + Input.GetAxis("Mouse X") * FreeLookSensitivity;
float newRotationY = localEulerAngles.x - Input.GetAxis("Mouse Y") * FreeLookSensitivity;
localEulerAngles = new Vector3(newRotationY, newRotationX, 0f);
tf.localEulerAngles = localEulerAngles;
}
float axis = Input.GetAxis("Mouse ScrollWheel");
if (Mathf.Abs(axis) > 0.0001f)
{
float zoomSensitivity = fastMode ? FastZoomSensitivity : ZoomSensitivity;
tf.position += zoomSensitivity * axis * tf.forward;
}
if (Input.GetKeyDown(KeyCode.Mouse1))
{
StartLooking();
}
else if (Input.GetKeyUp(KeyCode.Mouse1))
{
StopLooking();
}
}
private void OnDisable()
{
StopLooking();
}
#endregion
#region Public methods
/// <summary>
/// Enable free looking.
/// </summary>
public void StartLooking()
{
looking = true;
Cursor.visible = false;
Cursor.lockState = CursorLockMode.Locked;
}
/// <summary>
/// Disable free looking.
/// </summary>
public void StopLooking()
{
looking = false;
Cursor.visible = true;
Cursor.lockState = CursorLockMode.None;
}
#endregion
}
}
// © 2019-2022 crosstales LLC (https://www.crosstales.com)

View File

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

View File

@ -0,0 +1,145 @@
using UnityEngine;
namespace Crosstales.Common.Util
{
/// <summary>Random color changer.</summary>
public class RandomColor : MonoBehaviour
{
#region Variables
///<summary>Use intervals to change the color (default: true).</summary>
[Tooltip("Use intervals to change the color (default: true).")] public bool UseInterval = true;
///<summary>Random change interval between min (= x) and max (= y) in seconds (default: x = 5, y = 10).</summary>
[Tooltip("Random change interval between min (= x) and max (= y) in seconds (default: x = 5, y = 10).")]
public Vector2 ChangeInterval = new Vector2(5, 10);
///<summary>Random hue range between min (= x) and max (= y) (default: x = 0, y = 1).</summary>
[Tooltip("Random hue range between min (= x) and max (= y) (default: x = 0, y = 1).")] public Vector2 HueRange = new Vector2(0f, 1f);
///<summary>Random saturation range between min (= x) and max (= y) (default: x = 1, y = 1).</summary>
[Tooltip("Random saturation range between min (= x) and max (= y) (default: x = 1, y = 1).")] public Vector2 SaturationRange = new Vector2(1f, 1f);
///<summary>Random value range between min (= x) and max (= y) (default: x = 1, y = 1).</summary>
[Tooltip("Random value range between min (= x) and max (= y) (default: x = 1, y = 1).")] public Vector2 ValueRange = new Vector2(1f, 1f);
///<summary>Random alpha range between min (= x) and max (= y) (default: x = 1, y = 1).</summary>
[Tooltip("Random alpha range between min (= x) and max (= y) (default: x = 1, y = 1).")] public Vector2 AlphaRange = new Vector2(1f, 1f);
///<summary>Use gray scale colors (default: false).</summary>
[Tooltip("Use gray scale colors (default: false).")] public bool GrayScale;
///<summary>Modify the color of a material instead of the Renderer (default: not set, optional).</summary>
[Tooltip("Modify the color of a material instead of the Renderer (default: not set, optional).")]
public Material Material;
///<summary>Set the object to a random color at Start (default: false).</summary>
[Tooltip("Set the object to a random color at Start (default: false).")] public bool RandomColorAtStart;
private float elapsedTime;
private float changeTime;
private Renderer currentRenderer;
private Color32 startColor;
private Color32 endColor;
private float lerpProgress;
private static readonly int colorID = Shader.PropertyToID("_Color");
private bool existsMaterial;
#endregion
#region MonoBehaviour methods
private void Start()
{
existsMaterial = Material != null;
elapsedTime = changeTime = Random.Range(ChangeInterval.x, ChangeInterval.y);
if (RandomColorAtStart)
{
if (GrayScale)
{
float grayScale = Random.Range(HueRange.x, HueRange.y);
startColor = new Color(grayScale, grayScale, grayScale, Random.Range(AlphaRange.x, AlphaRange.y));
}
else
{
startColor = Random.ColorHSV(HueRange.x, HueRange.y, SaturationRange.x, SaturationRange.y, ValueRange.x, ValueRange.y, AlphaRange.x, AlphaRange.y);
}
if (existsMaterial)
{
Material.SetColor(colorID, startColor);
}
else
{
currentRenderer = GetComponent<Renderer>();
currentRenderer.material.color = startColor;
}
}
else
{
if (existsMaterial)
{
startColor = Material.GetColor(colorID);
}
else
{
currentRenderer = GetComponent<Renderer>();
startColor = currentRenderer.material.color;
}
}
}
private void Update()
{
if (UseInterval)
{
elapsedTime += Time.deltaTime;
if (elapsedTime > changeTime)
{
lerpProgress = elapsedTime = 0f;
if (GrayScale)
{
float grayScale = Random.Range(HueRange.x, HueRange.y);
endColor = new Color(grayScale, grayScale, grayScale, Random.Range(AlphaRange.x, AlphaRange.y));
}
else
{
endColor = Random.ColorHSV(HueRange.x, HueRange.y, SaturationRange.x, SaturationRange.y, ValueRange.x, ValueRange.y, AlphaRange.x, AlphaRange.y);
}
changeTime = Random.Range(ChangeInterval.x, ChangeInterval.y);
}
if (existsMaterial)
{
Material.SetColor(colorID, Color.Lerp(startColor, endColor, lerpProgress));
}
else
{
currentRenderer.material.color = Color.Lerp(startColor, endColor, lerpProgress);
}
if (lerpProgress < 1f)
{
lerpProgress += Time.deltaTime / (changeTime - 0.1f);
}
else
{
startColor = existsMaterial ? Material.GetColor(colorID) : currentRenderer.material.color;
}
}
}
#endregion
}
}
// © 2015-2023 crosstales LLC (https://www.crosstales.com)

View File

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

View File

@ -0,0 +1,121 @@
using UnityEngine;
namespace Crosstales.Common.Util
{
/// <summary>Random rotation changer.</summary>
[DisallowMultipleComponent]
public class RandomRotator : MonoBehaviour
{
#region Variables
///<summary>Use intervals to change the rotation (default: true).</summary>
[Tooltip("Use intervals to change the rotation (default: true).")] public bool UseInterval = true;
///<summary>Random change interval between min (= x) and max (= y) in seconds (default: x = 10, y = 20).</summary>
[Tooltip("Random change interval between min (= x) and max (= y) in seconds (default: x = 10, y = 20).")]
public Vector2 ChangeInterval = new Vector2(10, 20);
///<summary>Minimum rotation speed per axis (default: 5 for all axis).</summary>
[Tooltip("Minimum rotation speed per axis (default: 5 for all axis).")] public Vector3 SpeedMin = new Vector3(5, 5, 5);
///<summary>Maximum rotation speed per axis (default: 15 for all axis).</summary>
[Tooltip("Minimum rotation speed per axis (default: 15 for all axis).")] public Vector3 SpeedMax = new Vector3(15, 15, 15);
///<summary>Set the object to a random rotation at Start (default: false).</summary>
[Tooltip("Set the object to a random rotation at Start (default: false).")] public bool RandomRotationAtStart;
///<summary>Random change interval per axis (default: true).</summary>
[Tooltip("Random change interval per axis (default: true).")] public bool RandomChangeIntervalPerAxis = true;
///<summary>Random direction per axis (default: true).</summary>
[Tooltip("Random direction per axis (default: true).")] public bool RandomDirectionPerAxis = true;
private Transform tf;
private Vector3 speed;
private float elapsedTime;
private float changeTime;
private Vector3 elapsedTimeAxis = Vector3.zero;
private Vector3 changeTimeAxis;
#endregion
#region MonoBehaviour methods
private void Start()
{
tf = transform;
if (RandomChangeIntervalPerAxis)
{
elapsedTimeAxis.x = changeTimeAxis.x = Random.Range(ChangeInterval.x, ChangeInterval.y);
elapsedTimeAxis.y = changeTimeAxis.y = Random.Range(ChangeInterval.x, ChangeInterval.y);
elapsedTimeAxis.z = changeTimeAxis.z = Random.Range(ChangeInterval.x, ChangeInterval.y);
}
else
{
elapsedTime = changeTime = Random.Range(ChangeInterval.x, ChangeInterval.y);
}
if (RandomRotationAtStart)
tf.localRotation = Random.rotation;
}
private void Update()
{
if (UseInterval)
{
if (RandomChangeIntervalPerAxis)
{
elapsedTimeAxis.x += Time.deltaTime;
elapsedTimeAxis.y += Time.deltaTime;
elapsedTimeAxis.z += Time.deltaTime;
if (elapsedTimeAxis.x > changeTimeAxis.x)
{
elapsedTimeAxis.x = 0f;
speed.x = Random.Range(SpeedMin.x, SpeedMax.x) * (!RandomDirectionPerAxis || Random.Range(0, 2) == 0 ? 1 : -1);
changeTimeAxis.x = Random.Range(ChangeInterval.x, ChangeInterval.y);
}
if (elapsedTimeAxis.y > changeTimeAxis.y)
{
elapsedTimeAxis.y = 0f;
speed.y = Random.Range(SpeedMin.y, SpeedMax.y) * (!RandomDirectionPerAxis || Random.Range(0, 2) == 0 ? 1 : -1);
changeTimeAxis.y = Random.Range(ChangeInterval.x, ChangeInterval.y);
}
if (elapsedTimeAxis.z > changeTimeAxis.z)
{
elapsedTimeAxis.z = 0f;
speed.z = Random.Range(SpeedMin.z, SpeedMax.z) * (!RandomDirectionPerAxis || Random.Range(0, 2) == 0 ? 1 : -1);
changeTimeAxis.z = Random.Range(ChangeInterval.x, ChangeInterval.y);
}
}
else
{
elapsedTime += Time.deltaTime;
if (elapsedTime > changeTime)
{
elapsedTime = 0f;
speed.x = Random.Range(SpeedMin.x, SpeedMax.x) * (!RandomDirectionPerAxis || Random.Range(0, 2) == 0 ? 1 : -1);
speed.y = Random.Range(SpeedMin.y, SpeedMax.y) * (!RandomDirectionPerAxis || Random.Range(0, 2) == 0 ? 1 : -1);
speed.z = Random.Range(SpeedMin.z, SpeedMax.z) * (!RandomDirectionPerAxis || Random.Range(0, 2) == 0 ? 1 : -1);
changeTime = Random.Range(ChangeInterval.x, ChangeInterval.y);
}
}
tf.Rotate(speed.x * Time.deltaTime, speed.y * Time.deltaTime, speed.z * Time.deltaTime);
}
}
#endregion
}
}
// © 2015-2023 crosstales LLC (https://www.crosstales.com)

View File

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