Skip to content

Instantly share code, notes, and snippets.

@Zammy
Zammy / ProjectileCollisionSystem.cs
Last active November 10, 2022 14:56
Projectile collision system ECS
using Unity.Burst;
using Unity.Collections;
using Unity.Entities;
using Unity.Jobs;
using Unity.Physics;
using Unity.Physics.Systems;
using Unity.Transforms;
[UpdateInGroup(typeof(FixedStepSimulationSystemGroup))]
[UpdateBefore(typeof(PhysicsSystemGroup))]
@Zammy
Zammy / Bootstrapper.cs
Created January 31, 2019 07:39
Base bootstrapper tightly coupled with ServiceLocator
using UnityEngine;
using System.Collections.Generic;
using MEC;
public class Bootstrapper : MonoBehaviour
{
protected virtual void Awake()
{
}
@Zammy
Zammy / ServiceLocator.cs
Last active January 31, 2019 09:43
Service locator pattern in C#
using System;
using System.Collections.Generic;
using System.Linq;
using UniRx;
public interface IService
{
}
public interface IInitializable
@Zammy
Zammy / whatever.cs
Created January 4, 2019 19:54
Loading json file from streamingAssets on Android using UniRx
public static IObservable<RoomData> LoadLevel(string gymRoom)
{
string path = System.IO.Path.Combine(Application.streamingAssetsPath, "Levels");
path = System.IO.Path.Combine(path, gymRoom + ".room");
#if UNITY_ANDROID && !UNITY_EDITOR
return ObservableWWW.Get(path)
#else
return Observable.ReturnUnit()
.SubscribeOn(Scheduler.ThreadPool)
.Select(_ => System.IO.File.ReadAllText(path))
@Zammy
Zammy / Visibility.cs
Last active November 8, 2018 15:52 — forked from zloedi/roguelike_FOV.c
Unity3d Implementation of rougelike_FOV
/*
Check original C code and explanation!
*/
using System;
using System.Collections.Generic;
using UnityEngine;
public static class Visibility
{
@Zammy
Zammy / DrawRect.frag
Last active April 12, 2024 10:52
Rectangle drawing function GLSL
//all params in normalized units
vec3 drawRect(in vec2 st,
in vec2 center,
in float width,
in float height,
in float thickness,
in vec3 fillColor,
in vec3 strokeColor)
{
vec3 color = vec3(0);
@Zammy
Zammy / gist:8e056ac5f004ffcb9087
Created May 15, 2015 09:58
XCode 6.0.1 build log
This file has been truncated, but you can view the full file.
Build target Unity-iPhone
CpResource /Applications/Xcode6.0.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.0.sdk/ResourceRules.plist /Users/evgenipetrov/Library/Developer/Xcode/DerivedData/Unity-iPhone-busbjkfhcrypyycedcyyedevplzw/Build/Products/Debug-iphoneos/ScavengerArena.app/ResourceRules.plist
cd /Users/evgenipetrov/Work/Tryad/ScavengerArena/client/ScavengerDuels/XCode
export PATH="/Applications/Xcode6.0.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode6.0.1.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
builtin-copy -exclude .DS_Store -exclude CVS -exclude .svn -exclude .git -exclude .hg -resolve-src-symlinks /Applications/Xcode6.0.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.0.sdk/ResourceRules.plist /Users/evgenipetrov/Library/Developer/Xcode/DerivedData/Unity-iPhone-busbjkfhcrypyycedcyyedevplzw/Build/Products/Debug-iphoneos/ScavengerArena.app
CompileAssetCatalog /User
@Zammy
Zammy / gist:5f676c4435271128eca6
Created May 13, 2015 18:41
Simple list/table view
void DevicesDraw()
{
const int NAME_WIDTH = 50;
const int IP_WIDTH = 50;
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
GUILayout.Label("Devices", EditorStyles.largeLabel);
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
#import "TaxiArrivingAnnotation.h"
#define SECONDS_IN_A_MINUTE 60
@interface TaxiArrivingAnnotation ()
@property (nonatomic) NSTimer * timer;
@property (nonatomic) NSDate * timeOfArrival;
@property (nonatomic, weak) id token1;
@property (nonatomic, weak) id token2;
@end