轨迹插件引入
This commit is contained in:
1 parent
89b5275efd
commit
195893a1b0
1023 files changed
+378944
-18404
No files matched your search
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 679f053a8c502f24ba1ee3e9442d1e03
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9e13412d4391ff941b8e76f52cfcebaf
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0d231409514a7d14ab7a85e8906b97da
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,43 @@
|
||||
// =====================================================================
|
||||
// Copyright 2013-2022 ToolBuddy
|
||||
// All rights reserved
|
||||
//
|
||||
// http://www.toolbuddy.net
|
||||
// =====================================================================
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using ToolBuddy.Pooling.Pools;
|
||||
|
||||
namespace ToolBuddy.Pooling
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides instances of <see cref="ArrayPool{T}"/>
|
||||
/// </summary>
|
||||
/// <remarks>Is thread safe</remarks>
|
||||
public class ArrayPoolsProvider
|
||||
{
|
||||
private static Dictionary<Type, object> arrayPools = new Dictionary<Type, object>();
|
||||
private static object lockObject = new object();
|
||||
|
||||
/// <summary>
|
||||
/// Returns an instance of <see cref="ArrayPool{T}"/> if previously created, otherwise creates a new one.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public static ArrayPool<T> GetPool<T>()
|
||||
{
|
||||
Type type = typeof(T);
|
||||
object pool;
|
||||
if (arrayPools.TryGetValue(type, out pool) == false)
|
||||
{
|
||||
lock (lockObject)
|
||||
{
|
||||
if (arrayPools.TryGetValue(type, out pool) == false)
|
||||
arrayPools[type] = pool = new ArrayPool<T>(1_000_000);
|
||||
}
|
||||
}
|
||||
|
||||
return (ArrayPool<T>)pool;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 63f40aa4b20670544b815cf3f0a5da3a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f1234dcf70b996c4cb133e83886a27fe
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,125 @@
|
||||
// =====================================================================
|
||||
// Copyright 2013-2022 ToolBuddy
|
||||
// All rights reserved
|
||||
//
|
||||
// http://www.toolbuddy.net
|
||||
// =====================================================================
|
||||
|
||||
using System;
|
||||
using ToolBuddy.Pooling.Pools;
|
||||
|
||||
namespace ToolBuddy.Pooling.Collections
|
||||
{
|
||||
/// <summary>
|
||||
/// A struct that helps you use a part of an array.
|
||||
/// </summary>
|
||||
/// <remarks>Can be reused if you free it by calling <see cref="ArrayPool{T}.Free(ToolBuddy.Pooling.Collections.SubArray{T})"/></remarks>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
#if CURVY_SANITY_CHECKS
|
||||
public struct SubArray<T>
|
||||
{
|
||||
|
||||
private T[] array;
|
||||
|
||||
/// <summary>
|
||||
/// The array where data is stored in
|
||||
/// </summary>
|
||||
public T[] Array
|
||||
{
|
||||
get
|
||||
{
|
||||
if (IsDisposed)
|
||||
throw new InvalidOperationException("Trying to dispose a disposed SubArray");
|
||||
return array;
|
||||
}
|
||||
set => array = value;
|
||||
}
|
||||
|
||||
public bool IsDisposed;
|
||||
#else
|
||||
public readonly struct SubArray<T>
|
||||
{
|
||||
/// <summary>
|
||||
/// The array where data is stored in
|
||||
/// </summary>
|
||||
public readonly T[] Array;
|
||||
#endif
|
||||
/// <summary>
|
||||
/// The number of elements to be used in that array, counted from the start of the array
|
||||
/// </summary>
|
||||
public readonly int Count;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance that will use all the elements of the given array
|
||||
/// </summary>
|
||||
public SubArray(T[] array)
|
||||
{
|
||||
#if CURVY_SANITY_CHECKS
|
||||
IsDisposed = false;
|
||||
this.array =
|
||||
#else
|
||||
Array =
|
||||
#endif
|
||||
array != null ? array : throw new ArgumentNullException(nameof(array));
|
||||
Count = array.Length;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance that will use the first "count" elements of the given array
|
||||
/// </summary>
|
||||
public SubArray(T[] array, int count)
|
||||
{
|
||||
if (array == null)
|
||||
throw new ArgumentNullException(nameof(array));
|
||||
if (count < 0)
|
||||
throw new ArgumentOutOfRangeException(nameof(count));
|
||||
if (count > array.Length)
|
||||
throw new ArgumentOutOfRangeException(nameof(count));
|
||||
|
||||
#if CURVY_SANITY_CHECKS
|
||||
IsDisposed = false;
|
||||
this.array =
|
||||
#else
|
||||
Array =
|
||||
#endif
|
||||
array;
|
||||
|
||||
Count = count;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a new array that which length is <see cref="Count"/> and contains the elements from <see cref="Array"/>
|
||||
/// </summary>
|
||||
public T[] CopyToArray(ArrayPool<T> arrayPool)
|
||||
{
|
||||
T[] result = arrayPool.AllocateExactSize(Count, false).Array;
|
||||
System.Array.Copy(Array, 0, result, 0, Count);
|
||||
return result;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Array != null ? Array.GetHashCode() ^ Count : 0;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return obj is SubArray<T> subArray && Equals(subArray);
|
||||
}
|
||||
|
||||
public bool Equals(SubArray<T> obj)
|
||||
{
|
||||
return obj.Array == Array && obj.Count == Count;
|
||||
}
|
||||
|
||||
public static bool operator ==(SubArray<T> a, SubArray<T> b)
|
||||
{
|
||||
return a.Equals(b);
|
||||
}
|
||||
|
||||
public static bool operator !=(SubArray<T> a, SubArray<T> b)
|
||||
{
|
||||
return !(a == b);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 40ccb37f4e1e70b42a936638fd73f551
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,95 @@
|
||||
// =====================================================================
|
||||
// Copyright 2013-2022 ToolBuddy
|
||||
// All rights reserved
|
||||
//
|
||||
// http://www.toolbuddy.net
|
||||
// =====================================================================
|
||||
|
||||
using ToolBuddy.Pooling.Pools;
|
||||
|
||||
namespace ToolBuddy.Pooling.Collections
|
||||
{
|
||||
/// <summary>
|
||||
/// A class that simulates very minimal features of a List, but using a <see cref="SubArray{T}"/> instead of an <see cref="System.Array"/> as a storage
|
||||
/// </summary>
|
||||
/// <seealso cref="SubArray{T}"/>
|
||||
public struct SubArrayList<T>
|
||||
{
|
||||
private readonly ArrayPool<T> typePool;
|
||||
private SubArray<T> subArray;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="System.Array"/> used by the underlying <see cref="SubArray{T}"/> for storage
|
||||
/// </summary>
|
||||
public T[] Array => subArray.Array;
|
||||
|
||||
/// <summary>
|
||||
/// The number of elements occupied in the storage
|
||||
/// </summary>
|
||||
public int Count { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance
|
||||
/// </summary>
|
||||
/// <param name="initialCapacity">The initial capacity of the underlying storage</param>
|
||||
/// <param name="typePool"> A pool that will be used to, if needed, allocate a bigger array if elements </param>
|
||||
public SubArrayList(int initialCapacity, ArrayPool<T> typePool)
|
||||
{
|
||||
this.typePool = typePool;
|
||||
subArray = typePool.Allocate(initialCapacity, false);
|
||||
Count = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new element to the array
|
||||
/// </summary>
|
||||
public void Add(T element)
|
||||
{
|
||||
if (Count == subArray.Count)
|
||||
{
|
||||
int newSize = subArray.Count == 0 ? 4 : subArray.Count * 2;
|
||||
typePool.Resize(ref subArray, newSize, false);
|
||||
}
|
||||
|
||||
subArray.Array[Count] = element;
|
||||
Count++;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <see cref="SubArray{T}"/> instance that will have <see cref="Array"/> as an array (not a copy of it), and <see cref="Count"/> as its <see cref="SubArray{T}.Count"/>
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public SubArray<T> ToSubArray()
|
||||
{
|
||||
return new SubArray<T>(subArray.Array, Count);
|
||||
}
|
||||
|
||||
public bool Equals(SubArrayList<T> other)
|
||||
{
|
||||
return subArray.Equals(other.subArray) && Count == other.Count;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return obj is SubArrayList<T> other && Equals(other);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked
|
||||
{
|
||||
return (subArray.GetHashCode() * 397) ^ Count;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool operator ==(SubArrayList<T> a, SubArrayList<T> b)
|
||||
{
|
||||
return a.Equals(b);
|
||||
}
|
||||
|
||||
public static bool operator !=(SubArrayList<T> a, SubArrayList<T> b)
|
||||
{
|
||||
return !(a == b);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 47f615f5619283e4a9d614fd31165ac8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 42406537e9ce771468530c79cc69a08c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,382 @@
|
||||
// =====================================================================
|
||||
// Copyright 2013-2022 ToolBuddy
|
||||
// All rights reserved
|
||||
//
|
||||
// http://www.toolbuddy.net
|
||||
// =====================================================================
|
||||
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using ToolBuddy.Pooling.Collections;
|
||||
using UnityEngine;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
namespace ToolBuddy.Pooling.Pools
|
||||
{
|
||||
/// <summary>
|
||||
/// A pool of allowing the re-usage of previously allocated and discarded arrays.
|
||||
/// Helps reducing garbage collection.
|
||||
/// </summary>
|
||||
/// <remarks>Is thread safe</remarks>
|
||||
/// <seealso cref="SubArray{T}"/>
|
||||
public class ArrayPool<T>
|
||||
{
|
||||
|
||||
private readonly SubArray<T> emptySubArray = new SubArray<T>(new T[0]);
|
||||
|
||||
private readonly System.Random random = new System.Random();
|
||||
|
||||
private const int keysInitialCapacity = 200;
|
||||
//Optim: inserting and removing elements from those arrays leads to array copies. That takes a lot of time. Enhance this if needed
|
||||
private int[] poolKeys = new int[keysInitialCapacity];
|
||||
private T[][] poolValues = new T[keysInitialCapacity][];
|
||||
private int arraysCount;
|
||||
|
||||
private long elementsCount;
|
||||
private long elementsCapacity;
|
||||
|
||||
/// <summary>
|
||||
/// The maximal number of elements that the pool will keep, after they have been freed, to be available for future usage.
|
||||
/// Once this limit is reached, every freed array will simply get ignored, allowing the garbage collector to collect it
|
||||
/// </summary>
|
||||
/// <remarks>This is not the maximal number of arrays, but the maximal sum of the arrays' lengths</remarks>
|
||||
public long ElementsCapacity
|
||||
{
|
||||
get => elementsCapacity;
|
||||
set
|
||||
{
|
||||
if (elementsCapacity != value)
|
||||
lock (this)
|
||||
{
|
||||
elementsCapacity = value;
|
||||
ApplyCapacity(elementsCapacity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Log in the console each time a new array is allocated in memory
|
||||
/// </summary>
|
||||
public bool LogAllocations { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns data about the pool's usage.
|
||||
/// </summary>
|
||||
/// <see cref="ArrayPoolUsageData"/>
|
||||
public ArrayPoolUsageData UsageData => new ArrayPoolUsageData(elementsCount, arraysCount, elementsCapacity);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new pool
|
||||
/// </summary>
|
||||
/// <param name="elementsCapacity"><see cref="ElementsCapacity"/>
|
||||
/// </param>
|
||||
public ArrayPool(long elementsCapacity)
|
||||
{
|
||||
if (elementsCapacity < 0)
|
||||
throw new ArgumentOutOfRangeException(nameof(elementsCapacity), "Must be strictly positive.");
|
||||
|
||||
this.elementsCapacity = elementsCapacity;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Allocates a new array if none available, or reuses an existing one otherwise
|
||||
/// </summary>
|
||||
/// <param name="minimalSize">The array's guaranteed minimal size</param>
|
||||
/// <param name="clearArray">Whether the returned array's elements will be guaranteed to be set to their default value</param>
|
||||
/// <returns></returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
|
||||
public SubArray<T> Allocate(int minimalSize, bool clearArray = true)
|
||||
{
|
||||
//OPTIM set all calls that don't need a cleared array to clearArray == false
|
||||
return Allocate(minimalSize, false, clearArray, out _);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Allocates a new array if none available, or reuses an existing one otherwise
|
||||
/// </summary>
|
||||
/// <param name="exactSize">The array's exact size</param>
|
||||
/// <param name="clearArray">Whether the returned array's elements will be guaranteed to be set to their default value</param>
|
||||
/// <returns></returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public SubArray<T> AllocateExactSize(int exactSize, bool clearArray = true)
|
||||
{
|
||||
return Allocate(exactSize, true, clearArray, out _);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns an array to the pool, ready to be reused
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Free(SubArray<T> subArray)
|
||||
{
|
||||
Free(subArray.Array);
|
||||
#if CURVY_SANITY_CHECKS
|
||||
subArray.IsDisposed = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an array to the pool, ready to be reused
|
||||
/// </summary>
|
||||
public void Free(T[] array)
|
||||
{
|
||||
if (array.Length > elementsCapacity || array.Length == 0)
|
||||
return;
|
||||
|
||||
lock (this)
|
||||
{
|
||||
#if CURVY_SANITY_CHECKS
|
||||
for (var i = 0; i < arraysCount; i++)
|
||||
{
|
||||
if (poolValues[i] == array)
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
#endif
|
||||
|
||||
ApplyCapacity(elementsCapacity - array.Length);
|
||||
|
||||
int indexToInsertInto;
|
||||
{
|
||||
int index = BinarySearch(poolKeys, arraysCount, array.Length);
|
||||
indexToInsertInto = index >= 0 ? index : ~index;
|
||||
}
|
||||
|
||||
if (arraysCount == poolKeys.Length)
|
||||
{
|
||||
//no overflow check. If you reach the point of overflowing, then you have way too much arrays
|
||||
int newSize = 2 * (arraysCount + 1);
|
||||
Array.Resize(ref poolValues, newSize);
|
||||
Array.Resize(ref poolKeys, newSize);
|
||||
}
|
||||
|
||||
if (indexToInsertInto < arraysCount)
|
||||
{
|
||||
Array.Copy(poolKeys, indexToInsertInto, poolKeys, indexToInsertInto + 1, arraysCount - indexToInsertInto);
|
||||
Array.Copy(poolValues, indexToInsertInto, poolValues, indexToInsertInto + 1, arraysCount - indexToInsertInto);
|
||||
}
|
||||
poolKeys[indexToInsertInto] = array.Length;
|
||||
poolValues[indexToInsertInto] = array;
|
||||
|
||||
++arraysCount;
|
||||
|
||||
elementsCount += array.Length;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resizes the given array
|
||||
/// </summary>
|
||||
/// <param name="subArray"> The array to resize</param>
|
||||
/// <param name="newMinimalSize">The new size</param>
|
||||
/// <param name="clearNewSpace">When resizing and array to make it bigger, should the newly available space be cleared or not.</param>
|
||||
public void Resize(ref SubArray<T> subArray, int newMinimalSize, bool clearNewSpace = true)
|
||||
{
|
||||
//OPTIM set all calls that don't need a cleared new space to clearNewSpace == false
|
||||
if (subArray.Count == newMinimalSize)
|
||||
return;
|
||||
|
||||
if (newMinimalSize < 0)
|
||||
throw new ArgumentOutOfRangeException(nameof(newMinimalSize), "Must be positive.");
|
||||
|
||||
if (newMinimalSize == 0)
|
||||
{
|
||||
Free(subArray);
|
||||
subArray = emptySubArray;
|
||||
}
|
||||
else
|
||||
{
|
||||
int oldSize = subArray.Count;
|
||||
|
||||
bool isArrayCleared;
|
||||
if (newMinimalSize > subArray.Array.Length)
|
||||
{
|
||||
SubArray<T> destinationSubArray = Allocate(newMinimalSize, false, false, out isArrayCleared);
|
||||
Array.Copy(
|
||||
subArray.Array, 0,
|
||||
destinationSubArray.Array, 0,
|
||||
subArray.Count);
|
||||
Free(subArray);
|
||||
subArray = destinationSubArray;
|
||||
}
|
||||
else
|
||||
{
|
||||
subArray = new SubArray<T>(subArray.Array, newMinimalSize);
|
||||
isArrayCleared = false;
|
||||
}
|
||||
|
||||
if (clearNewSpace && isArrayCleared == false && newMinimalSize > oldSize)
|
||||
Array.Clear(subArray.Array, oldSize, newMinimalSize - oldSize);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resize an array to a new size and clears it. Similar to calling <see cref="Free(ToolBuddy.Pooling.Collections.SubArray{T})"/> then calling <see cref="Allocate"/>, but done in a more optimized way
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void ResizeAndClear(ref SubArray<T> subArray, int newMinimalSize)
|
||||
{
|
||||
if (subArray.Count == newMinimalSize)
|
||||
{
|
||||
Array.Clear(subArray.Array, 0, newMinimalSize);
|
||||
return;
|
||||
}
|
||||
|
||||
if (newMinimalSize < 0)
|
||||
throw new ArgumentOutOfRangeException(nameof(newMinimalSize), "Must be positive.");
|
||||
|
||||
if (newMinimalSize == 0)
|
||||
{
|
||||
Free(subArray);
|
||||
subArray = emptySubArray;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (newMinimalSize > subArray.Array.Length)
|
||||
{
|
||||
SubArray<T> destinationSubArray = Allocate(newMinimalSize, false, true, out _);
|
||||
Free(subArray);
|
||||
subArray = destinationSubArray;
|
||||
}
|
||||
else
|
||||
{
|
||||
subArray = new SubArray<T>(subArray.Array, newMinimalSize);
|
||||
Array.Clear(subArray.Array, 0, newMinimalSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return a new <see cref="SubArray{T}"/> instance that will use a copy of the given input array
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public SubArray<T> Clone(T[] source)
|
||||
{
|
||||
SubArray<T> clone = Allocate(source.Length, false);
|
||||
Array.Copy(source, 0,
|
||||
clone.Array, 0, source.Length);
|
||||
|
||||
return clone;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return a new <see cref="SubArray{T}"/> instance that will use a copy of the given input array
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public SubArray<T> Clone(SubArray<T> source)
|
||||
{
|
||||
SubArray<T> clone = Allocate(source.Count, false);
|
||||
Array.Copy(source.Array, 0,
|
||||
clone.Array, 0, source.Count);
|
||||
|
||||
return clone;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Allocates a new array if none available, or reuses an existing one otherwise
|
||||
/// </summary>
|
||||
/// <param name="size">The array's minimal or exact size, depending on <see cref="exactSize"/></param>
|
||||
/// <param name="exactSize">Whether the <see cref="size"/> parameter should be considered as an exact size or a minimal one</param>
|
||||
/// <param name="clearArray">Whether the returned array's elements will be guaranteed to be set to their default value</param>
|
||||
/// <param name="isArrayCleared">Whether the returned array is cleared. This is different from <see cref="clearArray"/> because even if <see cref="clearArray"/> is set to false, a newly created array will have its content cleared by definition</param>
|
||||
/// <returns></returns>
|
||||
private SubArray<T> Allocate(int size, bool exactSize, bool clearArray, out bool isArrayCleared)
|
||||
{
|
||||
|
||||
if (size > elementsCapacity)
|
||||
{
|
||||
isArrayCleared = true;
|
||||
if (LogAllocations)
|
||||
Debug.Log($"[ArrayPools] Type: {typeof(T).Name}. Allocated array size {size}. The requested size is bigger than the pool's capacity {elementsCapacity}");
|
||||
return new SubArray<T>(new T[size], size);
|
||||
}
|
||||
|
||||
if (size == 0)
|
||||
{
|
||||
isArrayCleared = true;
|
||||
return emptySubArray;
|
||||
}
|
||||
|
||||
if (size < 0)
|
||||
throw new ArgumentOutOfRangeException(nameof(size), "Must be positive.");
|
||||
|
||||
lock (this)
|
||||
{
|
||||
int indexToRemoveFrom;
|
||||
{
|
||||
int elementIndex = BinarySearch(poolKeys, arraysCount, size);
|
||||
|
||||
indexToRemoveFrom = elementIndex >= 0
|
||||
? elementIndex
|
||||
: exactSize
|
||||
? arraysCount
|
||||
: ~elementIndex;
|
||||
}
|
||||
|
||||
T[] array;
|
||||
if (indexToRemoveFrom < arraysCount)
|
||||
{
|
||||
array = RemoveElementAt(indexToRemoveFrom);
|
||||
if (clearArray)
|
||||
Array.Clear(array, 0, array.Length);
|
||||
isArrayCleared = clearArray;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (LogAllocations)
|
||||
Debug.Log($"[ArrayPools] Type: {typeof(T).Name}. Allocated array size {size}. The size of the biggest array available is {(arraysCount == 0 ? "None" : poolKeys[arraysCount - 1].ToString( ))}");
|
||||
array = new T[size];
|
||||
isArrayCleared = true;
|
||||
}
|
||||
|
||||
return new SubArray<T>(array, size);
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private void ApplyCapacity(long capacity)
|
||||
{
|
||||
while (elementsCount > capacity)
|
||||
RemoveElementAt(random.Next(0, arraysCount));
|
||||
}
|
||||
|
||||
private T[] RemoveElementAt(int elementIndex)
|
||||
{
|
||||
T[] array = poolValues[elementIndex];
|
||||
|
||||
--arraysCount;
|
||||
if (elementIndex < arraysCount)
|
||||
{
|
||||
Array.Copy(poolKeys, elementIndex + 1, poolKeys, elementIndex, arraysCount - elementIndex);
|
||||
Array.Copy(poolValues, elementIndex + 1, poolValues, elementIndex, arraysCount - elementIndex);
|
||||
}
|
||||
elementsCount -= array.Length;
|
||||
return array;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="Array.BinarySearch(System.Array,int,int,object)"/>
|
||||
/// </summary>
|
||||
private static int BinarySearch(
|
||||
int[] array,
|
||||
int length,
|
||||
int value)
|
||||
{
|
||||
int num1 = 0;
|
||||
int num2 = length - 1;
|
||||
while (num1 <= num2)
|
||||
{
|
||||
int index1 = num1 + (num2 - num1 >> 1);
|
||||
int num3 = array[index1] - value;
|
||||
if (num3 == 0)
|
||||
return index1;
|
||||
if (num3 < 0)
|
||||
num1 = index1 + 1;
|
||||
else
|
||||
num2 = index1 - 1;
|
||||
}
|
||||
return ~num1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 265a80d77815ce84ca4914d0fe04201a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,75 @@
|
||||
// =====================================================================
|
||||
// Copyright 2013-2022 ToolBuddy
|
||||
// All rights reserved
|
||||
//
|
||||
// http://www.toolbuddy.net
|
||||
// =====================================================================
|
||||
|
||||
namespace ToolBuddy.Pooling.Pools
|
||||
{
|
||||
/// <summary>
|
||||
/// Data about how full an <see cref="ArrayPool{T}"/> is
|
||||
/// </summary>
|
||||
public readonly struct ArrayPoolUsageData
|
||||
{
|
||||
/// <summary>
|
||||
/// The number of elements that the pool will keep, after they have been freed, to be available for future usage.
|
||||
/// </summary>
|
||||
/// <remarks>This is not the maximal number of arrays, but the maximal sum of the arrays' lengths</remarks>
|
||||
public long ElementsCount { get; }
|
||||
/// <summary>
|
||||
/// The number of arrays stored in the pool
|
||||
/// </summary>
|
||||
public int ArraysCount { get; }
|
||||
/// <summary>
|
||||
/// The maximal number of elements that the pool will keep, after they have been freed, to be available for future usage.
|
||||
/// Once this limit is reached, every freed array will simply get ignored, allowing the garbage collector to collect it
|
||||
/// </summary>
|
||||
/// <remarks>This is not the maximal number of arrays, but the maximal sum of the arrays' lengths</remarks>
|
||||
public long ElementsCapacity { get; }
|
||||
|
||||
|
||||
public ArrayPoolUsageData(long elementsCount, int arraysCount, long elementsCapacity)
|
||||
{
|
||||
ElementsCount = elementsCount;
|
||||
ArraysCount = arraysCount;
|
||||
ElementsCapacity = elementsCapacity;
|
||||
}
|
||||
|
||||
public bool Equals(ArrayPoolUsageData other)
|
||||
{
|
||||
return ElementsCount == other.ElementsCount && ArraysCount == other.ArraysCount && ElementsCapacity == other.ElementsCapacity;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return obj is ArrayPoolUsageData other && Equals(other);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked
|
||||
{
|
||||
int hashCode = ElementsCount.GetHashCode();
|
||||
hashCode = (hashCode * 397) ^ ArraysCount;
|
||||
hashCode = (hashCode * 397) ^ ElementsCapacity.GetHashCode();
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool operator ==(ArrayPoolUsageData a, ArrayPoolUsageData b)
|
||||
{
|
||||
return a.Equals(b);
|
||||
}
|
||||
|
||||
public static bool operator !=(ArrayPoolUsageData a, ArrayPoolUsageData b)
|
||||
{
|
||||
return !(a == b);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{nameof(ElementsCount)}: {ElementsCount}, {nameof(ArraysCount)}: {ArraysCount}, {nameof(ElementsCapacity)}: {ElementsCapacity}";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 496538c595f98984291012010b2f1e26
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"name":"ToolBuddy.ArraysPooling"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 86241f33e957cf74992e5ca37b75e53a
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 307763d67386f3841ba48c5da5f56f52
|
||||
folderAsset: yes
|
||||
timeCreated: 1437476977
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fda4720cf39a5d241b49abde38593b00
|
||||
folderAsset: yes
|
||||
timeCreated: 1442473707
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,34 @@
|
||||
// =====================================================================
|
||||
// Copyright 2013-2022 ToolBuddy
|
||||
// All rights reserved
|
||||
//
|
||||
// http://www.toolbuddy.net
|
||||
// =====================================================================
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.Collections;
|
||||
using FluffyUnderware.DevToolsEditor;
|
||||
using FluffyUnderware.Curvy.Examples;
|
||||
using FluffyUnderware.CurvyEditor;
|
||||
|
||||
namespace FluffyUnderware.Curvy.ExamplesEditor
|
||||
{
|
||||
|
||||
[CustomEditor(typeof(E01_HeightMetadata))]
|
||||
public class E01_HeightMetadataEditor : DTEditor<E01_HeightMetadata>
|
||||
{
|
||||
|
||||
[DrawGizmo(GizmoType.Active|GizmoType.NonSelected|GizmoType.InSelectionHierarchy)]
|
||||
static void GizmoDrawer(E01_HeightMetadata data, GizmoType context)
|
||||
{
|
||||
if (CurvyGlobalManager.ShowMetadataGizmo && data.Spline.ShowGizmos)
|
||||
{
|
||||
Vector3 position = data.ControlPoint.transform.position;
|
||||
#pragma warning disable CS0618
|
||||
CurvyGizmo.PointLabel(position, data.MetaDataValue.ToString(), OrientationAxisEnum.Down);
|
||||
#pragma warning restore CS0618
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 90ad9f4a58552ff48aecd9e1464f44a9
|
||||
timeCreated: 1442473718
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name":"ToolBuddy.Curvy.Examples.Editor",
|
||||
"references":[
|
||||
"ToolBuddy.ArraysPooling",
|
||||
"FluffyUnderware.DevTools",
|
||||
"FluffyUnderware.DevTools.Editor",
|
||||
"ToolBuddy.Curvy",
|
||||
"ToolBuddy.Curvy.Editor",
|
||||
"ToolBuddy.Curvy.Examples"
|
||||
],
|
||||
"includePlatforms":[
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms":[]
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 870011a960514d04d81f86fbdbb92329
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 946aba22c21c03247971e0d4aec7b2c7
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8965de4a5c3327a4f9ba78f3aa5531ed
|
||||
DefaultImporter:
|
||||
userData:
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 83178807cbeef8149ae1e2612988ac5d
|
||||
timeCreated: 1436091375
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e5f6ca220bf4cd542adf758b55cd6057
|
||||
DefaultImporter:
|
||||
userData:
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 10ae0c98bf753c04d8c6e2a378e3dabd
|
||||
timeCreated: 1432539542
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4eb3b9721e597834bad1e6baf42d3a6a
|
||||
DefaultImporter:
|
||||
userData:
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 74b5a9d3a9a9bb54399b79495001fca8
|
||||
timeCreated: 1432901464
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a8705a7c11af64b489986edef4a07358
|
||||
timeCreated: 1444156166
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4f06f4a7d7481c841bafde49fad30896
|
||||
timeCreated: 1438594004
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f20a478aecc1e5c45b30ad1fe79a5378
|
||||
timeCreated: 1438601336
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f2d7c4a4f6ce11245967f1921eac4572
|
||||
timeCreated: 1438609635
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+18287
File diff suppressed because it is too large.
Load diff
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7540e462e613248419dc494e8bb46554
|
||||
timeCreated: 1442657153
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 95b17c526f31be2408b98593522bf0b6
|
||||
timeCreated: 1433333357
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f64f2e16941ca42428683f89332f6c2c
|
||||
timeCreated: 1433838612
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d066c0ad1e5e27d4faa7592b507c854f
|
||||
timeCreated: 1460901411
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c9d0bf66a0b714f4f91521515d2e3ab5
|
||||
timeCreated: 1439366519
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 04df53ffda142144bbd5b74428b7298e
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large.
Load diff
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c8be04e02acdc1745aa0c813f38ab400
|
||||
timeCreated: 1441928497
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+5328
File diff suppressed because it is too large.
Load diff
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 67522100332a1574999b46e45c6cbd90
|
||||
timeCreated: 1442776717
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large.
Load diff
+7
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 517cdea3295e0a444b7f8e953430a1ba
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7b6cc4acf7df7244889b69e880b69908
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+2302
File diff suppressed because it is too large.
Load diff
+7
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e54d4512cb8b1194381b9565f8541a19
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+2463
File diff suppressed because it is too large.
Load diff
+7
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 281a044b74b3d4c4abcc08a68931a404
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4909477262300cb4fb6c4a92cb496b34
|
||||
timeCreated: 1436098989
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c5cf72ca5ff168f48bf33ddedce933b1
|
||||
timeCreated: 1448048134
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cfb46ea8455e6e94f924c444441ec13e
|
||||
timeCreated: 1447413833
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8237a7e5f49aa66468cb83d6c8a0982d
|
||||
timeCreated: 1439470072
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,438 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!29 &1
|
||||
OcclusionCullingSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_OcclusionBakeSettings:
|
||||
smallestOccluder: 5
|
||||
smallestHole: 0.25
|
||||
backfaceThreshold: 100
|
||||
m_SceneGUID: 00000000000000000000000000000000
|
||||
m_OcclusionCullingData: {fileID: 0}
|
||||
--- !u!104 &2
|
||||
RenderSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 9
|
||||
m_Fog: 0
|
||||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||
m_FogMode: 3
|
||||
m_FogDensity: 0.01
|
||||
m_LinearFogStart: 0
|
||||
m_LinearFogEnd: 300
|
||||
m_AmbientSkyColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
|
||||
m_AmbientEquatorColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
|
||||
m_AmbientGroundColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
|
||||
m_AmbientIntensity: 1
|
||||
m_AmbientMode: 3
|
||||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
|
||||
m_SkyboxMaterial: {fileID: 0}
|
||||
m_HaloStrength: 0.5
|
||||
m_FlareStrength: 1
|
||||
m_FlareFadeSpeed: 3
|
||||
m_HaloTexture: {fileID: 0}
|
||||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_DefaultReflectionMode: 0
|
||||
m_DefaultReflectionResolution: 128
|
||||
m_ReflectionBounces: 1
|
||||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 0}
|
||||
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_UseRadianceAmbientProbe: 0
|
||||
--- !u!157 &4
|
||||
LightmapSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 11
|
||||
m_GIWorkflowMode: 0
|
||||
m_GISettings:
|
||||
serializedVersion: 2
|
||||
m_BounceScale: 1
|
||||
m_IndirectOutputScale: 1
|
||||
m_AlbedoBoost: 1
|
||||
m_EnvironmentLightingMode: 0
|
||||
m_EnableBakedLightmaps: 0
|
||||
m_EnableRealtimeLightmaps: 0
|
||||
m_LightmapEditorSettings:
|
||||
serializedVersion: 12
|
||||
m_Resolution: 1
|
||||
m_BakeResolution: 50
|
||||
m_AtlasSize: 1024
|
||||
m_AO: 0
|
||||
m_AOMaxDistance: 1
|
||||
m_CompAOExponent: 0
|
||||
m_CompAOExponentDirect: 0
|
||||
m_ExtractAmbientOcclusion: 0
|
||||
m_Padding: 2
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_LightmapsBakeMode: 1
|
||||
m_TextureCompression: 0
|
||||
m_FinalGather: 0
|
||||
m_FinalGatherFiltering: 1
|
||||
m_FinalGatherRayCount: 1024
|
||||
m_ReflectionCompression: 2
|
||||
m_MixedBakeMode: 1
|
||||
m_BakeBackend: 0
|
||||
m_PVRSampling: 1
|
||||
m_PVRDirectSampleCount: 32
|
||||
m_PVRSampleCount: 512
|
||||
m_PVRBounces: 2
|
||||
m_PVREnvironmentSampleCount: 512
|
||||
m_PVREnvironmentReferencePointCount: 2048
|
||||
m_PVRFilteringMode: 0
|
||||
m_PVRDenoiserTypeDirect: 0
|
||||
m_PVRDenoiserTypeIndirect: 0
|
||||
m_PVRDenoiserTypeAO: 0
|
||||
m_PVRFilterTypeDirect: 0
|
||||
m_PVRFilterTypeIndirect: 0
|
||||
m_PVRFilterTypeAO: 0
|
||||
m_PVREnvironmentMIS: 0
|
||||
m_PVRCulling: 1
|
||||
m_PVRFilteringGaussRadiusDirect: 1
|
||||
m_PVRFilteringGaussRadiusIndirect: 5
|
||||
m_PVRFilteringGaussRadiusAO: 2
|
||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||
m_ExportTrainingData: 0
|
||||
m_TrainingDataDestination: TrainingData
|
||||
m_LightProbeSampleCountMultiplier: 4
|
||||
m_LightingDataAsset: {fileID: 0}
|
||||
m_UseShadowmask: 0
|
||||
--- !u!196 &5
|
||||
NavMeshSettings:
|
||||
serializedVersion: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_BuildSettings:
|
||||
serializedVersion: 2
|
||||
agentTypeID: 0
|
||||
agentRadius: 0.5
|
||||
agentHeight: 2
|
||||
agentSlope: 45
|
||||
agentClimb: 0.4
|
||||
ledgeDropHeight: 0
|
||||
maxJumpAcrossDistance: 0
|
||||
minRegionArea: 2
|
||||
manualCellSize: 0
|
||||
cellSize: 0.16666666
|
||||
manualTileSize: 0
|
||||
tileSize: 256
|
||||
accuratePlacement: 0
|
||||
debug:
|
||||
m_Flags: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1001 &494292524
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 184722, guid: 13463edfb77f1304ca4a0da53dfe21a0, type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 22412676, guid: 13463edfb77f1304ca4a0da53dfe21a0, type: 3}
|
||||
propertyPath: m_Pivot.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 22412676, guid: 13463edfb77f1304ca4a0da53dfe21a0, type: 3}
|
||||
propertyPath: m_Pivot.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 22412676, guid: 13463edfb77f1304ca4a0da53dfe21a0, type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 22412676, guid: 13463edfb77f1304ca4a0da53dfe21a0, type: 3}
|
||||
propertyPath: m_AnchorMax.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 22412676, guid: 13463edfb77f1304ca4a0da53dfe21a0, type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 22412676, guid: 13463edfb77f1304ca4a0da53dfe21a0, type: 3}
|
||||
propertyPath: m_AnchorMin.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 22412676, guid: 13463edfb77f1304ca4a0da53dfe21a0, type: 3}
|
||||
propertyPath: m_AnchorMin.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 22412676, guid: 13463edfb77f1304ca4a0da53dfe21a0, type: 3}
|
||||
propertyPath: m_SizeDelta.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 22412676, guid: 13463edfb77f1304ca4a0da53dfe21a0, type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 22412676, guid: 13463edfb77f1304ca4a0da53dfe21a0, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 22412676, guid: 13463edfb77f1304ca4a0da53dfe21a0, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 22412676, guid: 13463edfb77f1304ca4a0da53dfe21a0, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 22412676, guid: 13463edfb77f1304ca4a0da53dfe21a0, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 22412676, guid: 13463edfb77f1304ca4a0da53dfe21a0, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 22412676, guid: 13463edfb77f1304ca4a0da53dfe21a0, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 22412676, guid: 13463edfb77f1304ca4a0da53dfe21a0, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 22412676, guid: 13463edfb77f1304ca4a0da53dfe21a0, type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 22412676, guid: 13463edfb77f1304ca4a0da53dfe21a0, type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 13463edfb77f1304ca4a0da53dfe21a0, type: 3}
|
||||
--- !u!1 &781880046
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 781880050}
|
||||
- component: {fileID: 781880049}
|
||||
- component: {fileID: 781880048}
|
||||
- component: {fileID: 781880047}
|
||||
m_Layer: 0
|
||||
m_Name: EventSystem
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &781880047
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 781880046}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 2d49b7c1bcd2e07499844da127be038d, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_ForceModuleActive: 0
|
||||
--- !u!114 &781880048
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 781880046}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_HorizontalAxis: Horizontal
|
||||
m_VerticalAxis: Vertical
|
||||
m_SubmitButton: Submit
|
||||
m_CancelButton: Cancel
|
||||
m_InputActionsPerSecond: 10
|
||||
m_RepeatDelay: 0.5
|
||||
m_ForceModuleActive: 0
|
||||
--- !u!114 &781880049
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 781880046}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_FirstSelected: {fileID: 0}
|
||||
m_sendNavigationEvents: 1
|
||||
m_DragThreshold: 5
|
||||
--- !u!4 &781880050
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 781880046}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1489596081
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1489596083}
|
||||
- component: {fileID: 1489596082}
|
||||
m_Layer: 0
|
||||
m_Name: Performance
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &1489596082
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1489596081}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 917be1f89abbdbd4ca06657c465e2be6, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!4 &1489596083
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1489596081}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 248.99654, y: 356.86853, z: -6.875}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1665809476
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1665809481}
|
||||
- component: {fileID: 1665809480}
|
||||
- component: {fileID: 1665809478}
|
||||
- component: {fileID: 1665809477}
|
||||
- component: {fileID: 1665809482}
|
||||
m_Layer: 0
|
||||
m_Name: Main Camera
|
||||
m_TagString: MainCamera
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!81 &1665809477
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1665809476}
|
||||
m_Enabled: 1
|
||||
--- !u!124 &1665809478
|
||||
Behaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1665809476}
|
||||
m_Enabled: 1
|
||||
--- !u!20 &1665809480
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1665809476}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 1
|
||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0.019607844}
|
||||
m_projectionMatrixMode: 1
|
||||
m_GateFitMode: 2
|
||||
m_FOVAxisMode: 0
|
||||
m_SensorSize: {x: 36, y: 24}
|
||||
m_LensShift: {x: 0, y: 0}
|
||||
m_FocalLength: 50
|
||||
m_NormalizedViewPortRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
near clip plane: 0.3
|
||||
far clip plane: 1000
|
||||
field of view: 60
|
||||
orthographic: 0
|
||||
orthographic size: 5
|
||||
m_Depth: -1
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingPath: -1
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_TargetDisplay: 0
|
||||
m_TargetEye: 3
|
||||
m_HDR: 0
|
||||
m_AllowMSAA: 1
|
||||
m_AllowDynamicResolution: 0
|
||||
m_ForceIntoRT: 0
|
||||
m_OcclusionCulling: 1
|
||||
m_StereoConvergence: 10
|
||||
m_StereoSeparation: 0.022
|
||||
--- !u!4 &1665809481
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1665809476}
|
||||
m_LocalRotation: {x: 0.16492918, y: 0.20952912, z: -0.035880588, w: 0.9631244}
|
||||
m_LocalPosition: {x: -31.09, y: 25.1, z: -61}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1665809482
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1665809476}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d025f1b57fec5ca4f8585046c3fd23c8, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Version:
|
||||
Splines: []
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 18aa167d4f1e1ba449563b1afca75ebc
|
||||
timeCreated: 1425478143
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+1652
File diff suppressed because it is too large.
Load diff
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 17174547927805c469ab20e7f4278ebc
|
||||
timeCreated: 1432714819
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ece717abe053b6747a81e33c5e48bf20
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
||||
@@ -0,0 +1,59 @@
|
||||
// =====================================================================
|
||||
// Copyright 2013-2022 ToolBuddy
|
||||
// All rights reserved
|
||||
//
|
||||
// http://www.toolbuddy.net
|
||||
// =====================================================================
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using FluffyUnderware.DevTools;
|
||||
|
||||
namespace FluffyUnderware.Curvy.Examples
|
||||
{
|
||||
[ExecuteAlways]
|
||||
public class ChaseCam : MonoBehaviour
|
||||
{
|
||||
public Transform LookAt;
|
||||
public Transform MoveTo;
|
||||
public Transform RollTo;
|
||||
[Positive]
|
||||
public float ChaseTime=0.1f;
|
||||
|
||||
|
||||
Vector3 mVelocity;
|
||||
Vector3 mRollVelocity;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
void Update()
|
||||
{
|
||||
if (!Application.isPlaying)
|
||||
{
|
||||
if (MoveTo)
|
||||
transform.position = MoveTo.position;
|
||||
//if (LookAt)
|
||||
//{
|
||||
// if (!RollTo) transform.LookAt(LookAt);
|
||||
// else transform.LookAt(LookAt, RollTo.up);
|
||||
//}
|
||||
if (RollTo)
|
||||
transform.rotation = Quaternion.Euler(new Vector3(transform.rotation.eulerAngles.x, transform.rotation.eulerAngles.y, RollTo.rotation.eulerAngles.z));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Update is called once per frame
|
||||
void LateUpdate()
|
||||
{
|
||||
if (MoveTo)
|
||||
transform.position = Vector3.SmoothDamp(transform.position, MoveTo.position, ref mVelocity, ChaseTime);
|
||||
//if (LookAt)
|
||||
//{
|
||||
// if (!RollTo) transform.LookAt(LookAt);
|
||||
// else transform.LookAt(LookAt, Vector3.SmoothDamp(transform.up, RollTo.up, ref mRollVelocity, ChaseTime));
|
||||
//}
|
||||
// if (RollTo)
|
||||
// transform.rotation = Quaternion.Euler (new Vector3 (transform.rotation.eulerAngles.x, transform.rotation.eulerAngles.y, RollTo.rotation.eulerAngles.z));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 434e0e7bb669a364a94813e14dffb65b
|
||||
timeCreated: 1433754899
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,31 @@
|
||||
// =====================================================================
|
||||
// Copyright 2013-2022 ToolBuddy
|
||||
// All rights reserved
|
||||
//
|
||||
// http://www.toolbuddy.net
|
||||
// =====================================================================
|
||||
|
||||
using UnityEngine;
|
||||
using FluffyUnderware.DevTools;
|
||||
|
||||
namespace FluffyUnderware.Curvy.Examples
|
||||
{
|
||||
public class E01_HeightMetadata : CurvyInterpolatableMetadataBase<float>
|
||||
{
|
||||
[SerializeField]
|
||||
[RangeEx(0, 1, Slider = true)]
|
||||
#pragma warning disable 649
|
||||
float m_Height;
|
||||
#pragma warning restore 649
|
||||
|
||||
public override float MetaDataValue
|
||||
{
|
||||
get { return m_Height; }
|
||||
}
|
||||
|
||||
public override float Interpolate(CurvyInterpolatableMetadataBase<float> nextMetadata, float interpolationTime)
|
||||
{
|
||||
return (nextMetadata != null) ? Mathf.Lerp(MetaDataValue, nextMetadata.MetaDataValue, interpolationTime) : MetaDataValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8712b26610c3b0646b25d28526c1128f
|
||||
timeCreated: 1436092085
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,72 @@
|
||||
// =====================================================================
|
||||
// Copyright 2013-2022 ToolBuddy
|
||||
// All rights reserved
|
||||
//
|
||||
// http://www.toolbuddy.net
|
||||
// =====================================================================
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using FluffyUnderware.Curvy.Controllers;
|
||||
using FluffyUnderware.DevTools;
|
||||
|
||||
namespace FluffyUnderware.Curvy.Examples
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Example custom Controller
|
||||
/// </summary>
|
||||
public class E01_MetaDataController : SplineController
|
||||
{
|
||||
//The section attribute renders our field inside it's own category!
|
||||
[Section("MetaController",Sort=0)]
|
||||
[RangeEx(0, 30)]
|
||||
[SerializeField]
|
||||
float m_MaxHeight = 5f; // The height over ground to use as default
|
||||
|
||||
|
||||
public float MaxHeight
|
||||
{
|
||||
get { return m_MaxHeight; }
|
||||
set
|
||||
{
|
||||
if (m_MaxHeight != value)
|
||||
m_MaxHeight = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is called just after the SplineController has been initialized
|
||||
/// </summary>
|
||||
protected override void UserAfterInit()
|
||||
{
|
||||
setHeight();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is called just after the SplineController updates
|
||||
/// </summary>
|
||||
protected override void UserAfterUpdate()
|
||||
{
|
||||
setHeight();
|
||||
}
|
||||
|
||||
|
||||
void setHeight()
|
||||
{
|
||||
if(Spline.Dirty)
|
||||
Spline.Refresh();
|
||||
|
||||
// Get the interpolated Metadata value for the current position (for SplineController, RelativePosition means TF)
|
||||
float height = Spline.GetInterpolatedMetadata<E01_HeightMetadata,float>(RelativePosition);
|
||||
|
||||
// In our case we store a percentage (0..1) in our custom MetaData class, so we multiply with MaxHeight to set the actual height.
|
||||
// Note that position and rotation has been set by the SplineController previously, so we just translate here using the local y-axis
|
||||
|
||||
transform.Translate(0, height * MaxHeight, 0, Space.Self);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6b01ebf71ba5ff0478c3b1788e587526
|
||||
timeCreated: 1436091769
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,28 @@
|
||||
// =====================================================================
|
||||
// Copyright 2013-2022 ToolBuddy
|
||||
// All rights reserved
|
||||
//
|
||||
// http://www.toolbuddy.net
|
||||
// =====================================================================
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace FluffyUnderware.Curvy.Examples
|
||||
{
|
||||
/// <summary>
|
||||
/// A class that makes some Animation methods available to Unity Events
|
||||
/// </summary>
|
||||
public class E02_AnimationHelper : MonoBehaviour {
|
||||
|
||||
public void Play(Animation animation)
|
||||
{
|
||||
animation.Play();
|
||||
}
|
||||
|
||||
public void RewindThenPlay(Animation animation)
|
||||
{
|
||||
animation.Rewind();
|
||||
animation.Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6f8ff5781822ed040991ee4ff4ef9eac
|
||||
timeCreated: 1527118293
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,91 @@
|
||||
// =====================================================================
|
||||
// Copyright 2013-2022 ToolBuddy
|
||||
// All rights reserved
|
||||
//
|
||||
// http://www.toolbuddy.net
|
||||
// =====================================================================
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using FluffyUnderware.Curvy;
|
||||
using FluffyUnderware.DevTools.Extensions;
|
||||
using FluffyUnderware.Curvy.Controllers;
|
||||
using UnityEngine.UI;
|
||||
|
||||
/*
|
||||
* In this example we let the user draw a spline on screen!
|
||||
*
|
||||
*/
|
||||
namespace FluffyUnderware.Curvy.Examples
|
||||
{
|
||||
public class E04_PaintSpline : MonoBehaviour
|
||||
{
|
||||
public float StepDistance = 30;
|
||||
public SplineController Controller;
|
||||
public Text InfoText;
|
||||
|
||||
CurvySpline mSpline;
|
||||
Vector2 mLastControlPointPos;
|
||||
bool mResetSpline = true;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
// for this example we assume the component is attached to a GameObject holding a spline
|
||||
mSpline = GetComponent<CurvySpline>();
|
||||
}
|
||||
|
||||
void OnGUI()
|
||||
{
|
||||
// before using the spline, ensure it's initialized and the Controller is available
|
||||
if (mSpline == null || !mSpline.IsInitialized || !Controller)
|
||||
return;
|
||||
|
||||
Event e = Event.current;
|
||||
switch (e.type)
|
||||
{
|
||||
case EventType.MouseDrag:
|
||||
// Start a new line?
|
||||
if (mResetSpline)
|
||||
{
|
||||
mSpline.Clear(); // delete all Control Points
|
||||
addCP(e.mousePosition); // add the first Control Point
|
||||
Controller.gameObject.SetActive(true);
|
||||
Controller.AbsolutePosition = 0;
|
||||
mLastControlPointPos = e.mousePosition; // Store current mouse position
|
||||
mResetSpline = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// only create a new Control Point if the minimum distance is reached
|
||||
float dist = (e.mousePosition - mLastControlPointPos).magnitude;
|
||||
if (dist >= StepDistance)
|
||||
{
|
||||
mLastControlPointPos = e.mousePosition;
|
||||
addCP(e.mousePosition);
|
||||
if (Controller.PlayState != CurvyController.CurvyControllerState.Playing)
|
||||
Controller.Play();
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case EventType.MouseUp:
|
||||
mResetSpline = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Add a Control Point and set it's position
|
||||
CurvySplineSegment addCP(Vector3 mousePos)
|
||||
{
|
||||
Vector3 p = Camera.main.ScreenToWorldPoint(mousePos);
|
||||
p.y *= -1; // flip Y to get the correct world position
|
||||
p.z += 100; //To move further than camera's plane. The value 100 comes from the Canvas' plane distance
|
||||
CurvySplineSegment cp = mSpline.InsertAfter(null, p, false);
|
||||
|
||||
InfoText.text = "Control Points: " + mSpline.ControlPointCount.ToString(); // set info text
|
||||
|
||||
return cp;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 519164ed9b6fe2844ab6927e80fc3dd8
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,45 @@
|
||||
// =====================================================================
|
||||
// Copyright 2013-2022 ToolBuddy
|
||||
// All rights reserved
|
||||
//
|
||||
// http://www.toolbuddy.net
|
||||
// =====================================================================
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using FluffyUnderware.DevTools;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace FluffyUnderware.Curvy.Examples
|
||||
{
|
||||
[ExecuteAlways]
|
||||
public class E05_MoveToNearestPoint : MonoBehaviour
|
||||
{
|
||||
public Transform Lookup;
|
||||
public CurvySpline Spline;
|
||||
public Text StatisticsText;
|
||||
public Slider Density;
|
||||
|
||||
TimeMeasure Timer = new TimeMeasure(30);
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (Spline && Spline.IsInitialized && Lookup && Spline.Dirty == false)
|
||||
{
|
||||
// get the nearest point's TF on spline
|
||||
Timer.Start();
|
||||
transform.position = Spline.GetNearestPoint(Lookup.position, Space.World);
|
||||
Timer.Stop();
|
||||
// set the corresponding position to nearestTF
|
||||
StatisticsText.text =
|
||||
string.Format("Blue Curve Cache Points: {0} \nAverage Lookup (ms): {1:0.000}", Spline.CacheSize, Timer.AverageMS);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnSliderChange()
|
||||
{
|
||||
Spline.CacheDensity = (int)Density.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 90d77a0360522274d962d1170d9f3207
|
||||
timeCreated: 1432904141
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,70 @@
|
||||
// =====================================================================
|
||||
// Copyright 2013-2022 ToolBuddy
|
||||
// All rights reserved
|
||||
//
|
||||
// http://www.toolbuddy.net
|
||||
// =====================================================================
|
||||
|
||||
using UnityEngine;
|
||||
// This is the regular SmoothFollow script, but renamed and put into Curvy.Examples namespace to keep it separated from the often changing Standard Assets
|
||||
namespace FluffyUnderware.Curvy.Examples
|
||||
{
|
||||
public class E05_SmoothFollow : MonoBehaviour
|
||||
{
|
||||
|
||||
// The target we are following
|
||||
[SerializeField]
|
||||
#pragma warning disable 649
|
||||
private Transform target;
|
||||
#pragma warning restore 649
|
||||
// The distance in the x-z plane to the target
|
||||
[SerializeField]
|
||||
private float distance = 10.0f;
|
||||
// the height we want the camera to be above the target
|
||||
[SerializeField]
|
||||
private float height = 5.0f;
|
||||
|
||||
[SerializeField]
|
||||
#pragma warning disable 649
|
||||
private float rotationDamping;
|
||||
[SerializeField]
|
||||
private float heightDamping;
|
||||
#pragma warning restore 649
|
||||
|
||||
|
||||
// Update is called once per frame
|
||||
void LateUpdate()
|
||||
{
|
||||
// Early out if we don't have a target
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
// Calculate the current rotation angles
|
||||
float wantedRotationAngle = target.eulerAngles.y;
|
||||
float wantedHeight = target.position.y + height;
|
||||
|
||||
float currentRotationAngle = transform.eulerAngles.y;
|
||||
float currentHeight = transform.position.y;
|
||||
|
||||
// Damp the rotation around the y-axis
|
||||
currentRotationAngle = Mathf.LerpAngle(currentRotationAngle, wantedRotationAngle, rotationDamping * Time.deltaTime);
|
||||
|
||||
// Damp the height
|
||||
currentHeight = Mathf.Lerp(currentHeight, wantedHeight, heightDamping * Time.deltaTime);
|
||||
|
||||
// Convert the angle into a rotation
|
||||
Quaternion currentRotation = Quaternion.Euler(0, currentRotationAngle, 0);
|
||||
|
||||
// Set the position of the camera on the x-z plane to:
|
||||
// distance meters behind the target
|
||||
transform.position = target.position;
|
||||
transform.position -= currentRotation * Vector3.forward * distance;
|
||||
|
||||
// Set the height of the camera
|
||||
transform.position = new Vector3(transform.position.x ,currentHeight , transform.position.z);
|
||||
|
||||
// Always look at the target
|
||||
transform.LookAt(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a20feb36c253ae940912006b89d21e84
|
||||
timeCreated: 1495982388
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,28 @@
|
||||
// =====================================================================
|
||||
// Copyright 2013-2022 ToolBuddy
|
||||
// All rights reserved
|
||||
//
|
||||
// http://www.toolbuddy.net
|
||||
// =====================================================================
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using FluffyUnderware.Curvy.Controllers;
|
||||
using FluffyUnderware.DevTools;
|
||||
|
||||
namespace FluffyUnderware.Curvy.Examples
|
||||
{
|
||||
public class E10_MotorController : SplineController
|
||||
{
|
||||
[Section("Motor")]
|
||||
public float MaxSpeed = 30;
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
float axis = Input.GetAxis("Vertical");
|
||||
Speed = Mathf.Abs(axis) * MaxSpeed;
|
||||
MovementDirection = MovementDirectionMethods.FromInt((int)Mathf.Sign(axis));
|
||||
base.Update();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 967866bd6dfb207458ed4a36e414e5bc
|
||||
timeCreated: 1438595490
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
// =====================================================================
|
||||
// Copyright 2013-2022 ToolBuddy
|
||||
// All rights reserved
|
||||
//
|
||||
// http://www.toolbuddy.net
|
||||
// =====================================================================
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using FluffyUnderware.Curvy;
|
||||
using FluffyUnderware.Curvy.Controllers;
|
||||
|
||||
|
||||
namespace FluffyUnderware.Curvy.Examples
|
||||
{
|
||||
[RequireComponent(typeof(Rigidbody))]
|
||||
public class E11_RigidBodySplineController : MonoBehaviour
|
||||
{
|
||||
public CurvySpline Spline;
|
||||
public SplineController CameraController;
|
||||
public float VSpeed = 10;
|
||||
public float HSpeed = 0.5f;
|
||||
public float CenterDrag = 0.5f;
|
||||
public float JumpForce = 10;
|
||||
|
||||
Rigidbody mRigidBody;
|
||||
float mTF;
|
||||
float velocity;
|
||||
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
mRigidBody = GetComponent<Rigidbody>();
|
||||
}
|
||||
|
||||
void LateUpdate()
|
||||
{
|
||||
if (CameraController)
|
||||
{
|
||||
// Camera has a regular SplineController attached. Set it to 5 units behind the player
|
||||
float newCamAbs = Spline.TFToDistance(mTF) - 5;
|
||||
CameraController.AbsolutePosition = Mathf.SmoothDamp(CameraController.AbsolutePosition, newCamAbs, ref velocity, 0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
void FixedUpdate()
|
||||
{
|
||||
if (Spline)
|
||||
{
|
||||
float v = Input.GetAxis("Vertical")*VSpeed;
|
||||
float h = Input.GetAxis("Horizontal")*HSpeed;
|
||||
|
||||
Vector3 p;
|
||||
// get nearest TF and point on spline
|
||||
mTF = Spline.GetNearestPointTF(transform.localPosition, out p);
|
||||
// apply forward thrust along spline direction (tangent)
|
||||
if (v != 0)
|
||||
{
|
||||
mRigidBody.AddForce(Spline.GetTangentFast(mTF) * v, ForceMode.Force);
|
||||
}
|
||||
// apply side thrust to left/right from the spline's "forward" vector
|
||||
if (h != 0)
|
||||
{
|
||||
Vector3 offset = Spline.InterpolateFast(mTF) + Quaternion.AngleAxis(90, Spline.GetTangentFast(mTF)) * Spline.GetOrientationUpFast(mTF);
|
||||
Vector3 hdir = p - offset;
|
||||
mRigidBody.AddForce(hdir * h , ForceMode.Force);
|
||||
}
|
||||
if (Input.GetKeyDown(KeyCode.Space))
|
||||
mRigidBody.AddForce(Vector3.up * JumpForce,ForceMode.Impulse);
|
||||
|
||||
// continously drag toward the spline to add some magic gravity
|
||||
mRigidBody.AddForce((Spline.Interpolate(mTF) - transform.localPosition) * CenterDrag, ForceMode.VelocityChange);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b6f96fa824fa43342b16b5dac66031f0
|
||||
timeCreated: 1438598326
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,25 @@
|
||||
// =====================================================================
|
||||
// Copyright 2013-2022 ToolBuddy
|
||||
// All rights reserved
|
||||
//
|
||||
// http://www.toolbuddy.net
|
||||
// =====================================================================
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using FluffyUnderware.Curvy;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace FluffyUnderware.Curvy.Examples
|
||||
{
|
||||
public class E12_MDJunctionControl : CurvyMetadataBase
|
||||
{
|
||||
public bool UseJunction;
|
||||
|
||||
public void Toggle()
|
||||
{
|
||||
UseJunction = !UseJunction;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Loaded 100 of 1023 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user