Skip to content

Instantly share code, notes, and snippets.

View AGeorgy's full-sized avatar

George Ananchenko AGeorgy

View GitHub Profile
@bddckr
bddckr / CleanUpGameObjectSystem.cs
Last active July 14, 2021 07:55
A small example on how to use the same kind of system for multiple contexts in Entitas 0.37.0(+) while making usage of a shared component.
using System.Collections.Generic;
using Components.GameObjects;
using Components.Miscellaneous;
using Entitas;
using Entitas.Unity.VisualDebugging;
using EntitasHelpers;
using JetBrains.Annotations;
public sealed class CleanUpGameObjectSystem<TEntity> : ReactiveSystem<TEntity> where TEntity : class, IEntity, new()
{
@LotteMakesStuff
LotteMakesStuff / EditorCoroutineRunner.cs
Last active August 28, 2024 19:09
Run stuff in the editor with all the convenience of co-routines! Add a status UI super easily to see readouts what your long running code is actually doing! nice~ There is a short API demo at the top of the class. This is a prefect companion for my inspector buttons https://gist.github.com/LotteMakesStuff/dd785ff49b2a5048bb60333a6a125187
using UnityEngine;
using UnityEditor;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
public class EditorCoroutineRunner
{
[MenuItem("Window/Lotte's Coroutine Runner: Demo")]
@FNGgames
FNGgames / TimerSystem.cs
Last active October 20, 2021 10:05
Entitas Timer System
using Entitas;
using UnityEngine;
public class TimerSystem : IExecuteSystem, ICleanupSystem
{
readonly IGroup<GameEntity> _timers;
readonly IGroup<GameEntity> _timerCompletes;
readonly GameContext _context;
public TimerSystem(Contexts contexts)
[PostProcessBuild]
public static void OnPostProcessBuild(BuildTarget buildTarget, string pathToBuildProject)
{
if (buildTarget != BuildTarget.iOS)
return;
StripMethods(pathToBuiltProject);
}
private static string[] s_stripList =
@LotteMakesStuff
LotteMakesStuff / StaticCoroutineRunner.cs
Created June 19, 2017 22:32
Ever wanted to run a Unity Coroutine from game code thats not in a MonoBehaviour (for example, a static manager class). Now you can friends!! this class automates creating a dummy game object to run your coroutine and cleans itself up automagically when the routine has finished
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CoroutineRunner : MonoBehaviour
{
public static void RunCoroutine(IEnumerator coroutine)
{
var go = new GameObject("runner");
DontDestroyOnLoad(go);
@mzaks
mzaks / AbstractEventLogger.cs
Created July 8, 2017 10:53
Event Logger for Entitas-CSharp
using System;
using System.Collections.Generic;
namespace Entitas
{
public abstract class AbstractEventLogger : IEventLogger
{
private readonly Dictionary<Pool, byte> poolIdmap = new Dictionary<Pool, byte>();
private readonly Dictionary<Entity, byte> poolIdmapForEntity = new Dictionary<Entity, byte>();
protected string[] poolNames;
@mzaks
mzaks / EntitasBT.cs
Last active July 24, 2017 09:37
A behaviour tree system for Entitas
public sealed class BTSystem: IExecuteSystem
{
IBehaviorNode rootNode;
public BTSystem(IBehaviorNode rootNode)
{
this.rootNode = rootNode;
}
void Execute()
{
@LotteMakesStuff
LotteMakesStuff / TrafficLightAttribute.cs
Last active April 8, 2025 21:13
TrafficLight control/layout/property drawer: Adds a new editor control that draws lil Traffic Lights in the inspector. its really useful for visualizing state. For example, checkboxes can be hard to read at a glace, but a Red or Green status light is easy! Recommend you use the attached package, as it has all the icon image files.
// Non Editor code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public abstract class TrafficLightAttribute : PropertyAttribute
{
public bool DrawLabel = true;
public string CustomLabel;
public bool AlsoDrawDefault;
Shader "KumoKairo/Gradient Moon Skybox"
{
Properties
{
_SkyTint("Sky Tint", Color) = (.5, .5, .5, 1)
_GroundColor("Ground", Color) = (.369, .349, .341, 1)
_Exponent("Exponent", Range(0, 15)) = 1.0
_SunPosition("Sun Position", Vector) = (0.0, 0.0, 1.0)
_SunColor("Sun Color", Color) = (1.0, 1.0, 1.0, 1.0)
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using System;
using System.IO;
public static class CopyFilesBuildPostProcessor
{
private const string PathToCopy = "PathToFiles";