This file contains hidden or 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 System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using UnityEditor; | |
using UnityEditor.AddressableAssets; | |
using UnityEditor.AddressableAssets.Settings; | |
using UnityEngine; | |
using Object = UnityEngine.Object; |
This file contains hidden or 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 Code.Scripts.Configs.InteractionItems | |
{ | |
[CreateAssetMenu(fileName = "CharactersContainer", menuName = "Configs/Interactions/CharactersContainer")] | |
public class CharactersContainer : ScriptableObject, IConfigsContainer | |
{ | |
public CharacterInfo[] Characters = new CharacterInfo[0]; | |
public void UpdateItems(IAssetsFinder finder) |
This file contains hidden or 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
namespace Code.Scripts.Data.Hexes | |
{ | |
public enum HexDirection | |
{ | |
NE, | |
E, | |
SE, | |
SW, | |
W, | |
NW |
This file contains hidden or 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.Collections.Generic; | |
using UnityEngine; | |
namespace Code.Scripts.Utils | |
{ | |
public class QuadTree<T> where T : Component | |
{ | |
private const int Capacity = 4; | |
private readonly Rect _bounds; |
This file contains hidden or 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 Unity.Burst; | |
using Unity.Mathematics; | |
using UnityEngine; | |
using UnityEngine.Events; | |
namespace Grids.Square | |
{ | |
[BurstCompile] | |
public class SquareGrid<T> | |
{ |
This file contains hidden or 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; | |
namespace Code.Scripts.Utils | |
{ | |
public class ScriptableObjectIdAttribute : PropertyAttribute { } | |
#if UNITY_EDITOR | |
[UnityEditor.CustomPropertyDrawer(typeof(ScriptableObjectIdAttribute))] | |
public class ScriptableObjectIdDrawer : UnityEditor.PropertyDrawer |
This file contains hidden or 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.Collections.Generic; | |
using Unity.Mathematics; | |
namespace Grids.Square | |
{ | |
public class PathFinding | |
{ | |
private const int MOVE_STRAIGHT_COST = 10; | |
private const int MOVE_DIAGONAL_COST = 14; | |
This file contains hidden or 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
//To get the difference C between quaternions A and B you do this: | |
C = A * Quaternion.Inverse(B); | |
//To add the difference to D you do this: | |
D = C * D; | |
///////////////// | |
//World vs local | |
//An easy way to keep track of the order of operations for quaternions is to think of it in terms of world and local rotations. | |
//When multiplying a quaternion the world rotation is on the left, and the local rotation is on the right, like this: |
This file contains hidden or 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
private List<GameObject> _debug = new List<GameObject>(); | |
private void ClearDebug() | |
{ | |
for (int i = _debug.Count - 1; i >= 0; i--) | |
{ | |
GameObject.Destroy(_debug[i]); | |
} | |
_debug.Clear(); | |
} | |
private void Debug(Vector3 pos, Color color) |
This file contains hidden or 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
private AnimationCurve GetSnapCurve(float min, float max, float snapAt, float snapAmount, WrapMode wrapMode = WrapMode.Clamp) | |
{ | |
var keyFrames = new List<Keyframe> | |
{ | |
new Keyframe(0, min), | |
new Keyframe(1, max) | |
}; | |
for (float i = snapAt; i < max; i += snapAt) | |
{ |
NewerOlder