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
namespace SpiralCircus.DOTween | |
{ | |
using DG.Tweening; | |
using SpiralCircus.Mathematics; | |
using UnityEngine.Rendering.Universal; | |
public static class DOTweenLight2DExtension | |
{ | |
public static Tween DOIntensity(this Light2D light, float endValue, float duration) | |
=> DOTween.To(() => light.intensity, t => light.intensity = t, endValue, duration); |
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; | |
using RSG; | |
public class ExamplePromiseWithTimeout : MonoBehaviour | |
{ | |
private void Start() | |
{ | |
// The example promise never resolves so this will timeout after 5 seconds has passed | |
// NOTE: This timer only works if the Promise.Update(deltaTime) method is being called | |
// (make sure you have the PromiseManager script running somewhere) |
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
#if UNITY_2020_2_OR_NEWER && ODIN_INSPECTOR | |
using System; | |
using System.Diagnostics; | |
using Sirenix.OdinInspector; | |
[AttributeUsage(AttributeTargets.All)] | |
[Conditional("UNITY_EDITOR")] | |
public class CBoxGroup : PropertyGroupAttribute | |
{ | |
public float r, g, b, a; |
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; | |
// A structure for performing bitwise operations collections of flags that are larger than the bit depth of an integer. | |
// The structure is backed by an array of unsigned 32 bit integers which represent "words" in the larger bit array. | |
// All standard bitwise operators are implemented, as well as methods that mutate the struct directly. | |
// The array of uints is implemented as a `fixed-size buffer` to force allocation of the uints inside this structure. | |
// The struct is therefore marked as `unsafe` | |
// The struct implements IEquatable to improve performance in hash tables and dictionaries. | |
// Method params are marked with the `in` keyword where appropriate to minimise copying of the supplied arguments. | |
public unsafe struct BitField128 : IEquatable<BitField128> |
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 interface IApplicationService : IService | |
{ | |
HashSet<string> GetValidScenes(); | |
void Load(string sceneName, Action<string, float> onProgress, Action<string> onComplete); | |
void Unload(string sceneName, Action<string, float> onProgress, Action<string> onComplete); | |
void Quit(); | |
} |
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 System.Runtime.InteropServices; | |
public static class Approximations | |
{ | |
// Sine approximation using polynominals. | |
// Has a low precision. | |
public static float LowSin(float x) | |
{ | |
//always wrap input angle to -PI..PI |
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 static class Easing | |
{ | |
// GENERAL | |
public static float Ease(float t, EaseType easeType) => EasingFunctions[easeType](t); | |
// LINEAR | |
public static float Linear(float t) => t; | |
// IN (as t^x) | |
public static float EaseInQuad(float t) => t * t; |
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 Spine.Unity; | |
using UnityEngine; | |
[RequireComponent(typeof(Renderer), typeof(SkeletonAnimation))] | |
public class SpineFrustrumCullSkeletonAnimation : MonoBehaviour | |
{ | |
private SkeletonAnimation _anim; | |
private Renderer _renderer; | |
void Start() |
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
// free move 2d handle with a circle texture | |
using UnityEditor; | |
using UnityEngine; | |
namespace CableSystem.Editor | |
{ | |
public class CircleHandle2D : CustomHandle | |
{ | |
private float _distance; | |
private bool _hovered, _selected; |
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 Entitas; | |
using System.Collections.Generic; | |
public abstract class CollisionSystem : ReactiveSystem<InputEntity> | |
{ | |
protected Contexts _contexts; | |
public CollisionSystem(Contexts contexts) : base(contexts.input) | |
{ | |
_contexts = contexts; |
NewerOlder