Skip to content

Instantly share code, notes, and snippets.

View IDNoise's full-sized avatar

Yaroslav Nikityshev IDNoise

  • Coconut Shavers
  • Russia, Tver
View GitHub Profile
@IDNoise
IDNoise / Quaternion.cs
Last active February 19, 2018 23:00 — forked from taotao111/Quaternion.cs
A custom completely managed implementation of UnityEngine.Quaternion. Base is decompiled UnityEngine.Quaternion. Doesn't implement methods marked Obsolete. Does implicit coversions to and from UnityEngine.Quaternion
// A custom completely managed implementation of UnityEngine.Quaternion
// Base is decompiled UnityEngine.Quaternion
// Doesn't implement methods marked Obsolete
// Does implicit coversions to and from UnityEngine.Quaternion
// Uses code from:
// https://raw.githubusercontent.com/mono/opentk/master/Source/OpenTK/Math/Quaternion.cs
// http://answers.unity3d.com/questions/467614/what-is-the-source-code-of-quaternionlookrotation.html
// http://stackoverflow.com/questions/12088610/conversion-between-euler-quaternion-like-in-unity3d-engine
// http://stackoverflow.com/questions/11492299/quaternion-to-euler-angles-algorithm-how-to-convert-to-y-up-and-between-ha
@IDNoise
IDNoise / codegenrator.cs
Created January 22, 2018 00:52
Code generator
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace IDEntitas.CodeGenerator
{
@IDNoise
IDNoise / uifeaturesystem.cs
Created July 26, 2017 12:22
eventreactivesystem + ui with interface
using UnityEngine;
using UnityEngine.UI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Entitas;
public interface IUIFeatureContainer : IUIContainer<IUIFeature> { }
public interface IUIFeature : IUIView
@IDNoise
IDNoise / IntervalReactiveSystem.cs
Created July 13, 2017 19:27
reactive system at specific interval
public sealed class FeatureBonusInfoSystem : IntervalExecuteSystem
{
InternalSystem _system;
public FeatureBonusInfoSystem(Contexts contexts) : base(contexts, 4)
{
_system = new InternalSystem(contexts);
}
protected override void IntervalExecute()
@IDNoise
IDNoise / eventreactivesystem.cs
Created July 13, 2017 19:16
System that allows handling events in reactive manner (execute logic not at the time of component change event but when system executes)
public abstract class EventReactiveSystem<TEntity> : IReactiveSystem where TEntity : class, IEntity, new()
{
EventConfig<TEntity>[] _eventConfigs;
List<TEntity>[] _buffers;
public EventReactiveSystem(IContext<TEntity> context)
{
_eventConfigs = GetEventConfigs();
foreach (var collector in _eventConfigs)
collector.InitCollector(context);
public class GameController : MonoBehaviour
{
Systems _activeSystems;
Dictionary<GameState, Systems> _stateSystems = new Dictionary<GameState, Systems>();
private void Start()
{
var contexts = Contexts.sharedInstance;
contexts.SetAllContexts();
contexts.AddEntityIndexes();