This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
namespace Impostors.Utilities | |
{ | |
public class TerrainTreesToSceneObjectsConverter : MonoBehaviour | |
{ | |
[SerializeField] | |
private Terrain _terrain = default; | |
[SerializeField] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using UnityEngine.Events; | |
using UnityEngine.EventSystems; | |
public static class EventTriggerExtensions | |
{ | |
public static void AddListener(this EventTrigger eventTrigger, EventTriggerType triggerType, | |
UnityAction<BaseEventData> call) | |
{ | |
if (eventTrigger == null) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class ReadonlyVariable<TValue> : ScriptableObject | |
{ | |
public abstract TValue Value { get; } | |
} | |
public abstract class Variable<TValue> : ReadonlyVariable<TValue> | |
{ | |
protected TValue _runtimeValue; | |
public override TValue Value | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Very messy and not 100% correct ISODATA clustering algorithm implementation that works with vectors. | |
# Source: https://github.com/PyRadar/pyradar/blob/master/pyradar/classifiers/isodata.py | |
# it works only for one-dimensional vectors :-( | |
# P.S. | |
# I've made it for university lab that's why you can find test values at the end of the file. (and that's why code so flipping bad XD) | |
# And I was shocked that there is no complete implementation of this algorithm on the internet o_O. | |
# Hope this helped:3 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
namespace Core.Utilities | |
{ | |
// Creates a new instance of terrain data that can be safely changed. | |
// Applies wind wettings specified in inspector. | |
public class TerrainGrassWindSettingsSetter : MonoBehaviour | |
{ | |
[SerializeField] | |
private Terrain _terrain; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/////////////////////////////////////////////////////////////////////////////////////// | |
// Native queue collection with fixed length. FILO. | |
// NativeStack<T> supports writing in IJobParallelFor, just use ParallelWriter and AsParallelWriter(). | |
// Not tested to much, works for me with integers and unity 2019.3 | |
// | |
// Assembled with help of: | |
// - NativeCounter example (https://docs.unity3d.com/Packages/[email protected]/manual/custom_job_types.html) | |
// - How to Make Custom Native Collections (https://jacksondunstan.com/articles/4734) | |
// - source code of NativeQueue and NativeList |