Skip to content

Instantly share code, notes, and snippets.

View longde123's full-sized avatar
:octocat:
Working from home

paling longde123

:octocat:
Working from home
View GitHub Profile
@longde123
longde123 / InjcetableFeature.cs
Created June 7, 2021 11:08 — forked from kdrzymala/InjcetableFeature.cs
A feature that's Injectable by Zenject
using Entitas;
using Zenject;
using System.Collections;
using System.Collections.Generic;
public class InjectableFeature : Feature
{
public InjectableFeature()
: base()
{
@longde123
longde123 / FlyingCam.cs
Created January 25, 2021 10:09 — forked from runette/FlyingCam.cs
Movement and Interaction script
//https://stackoverflow.com/questions/58328209/how-to-make-a-free-fly-camera-script-in-unity-with-acceleration-and-decceleratio
// copyright Runette Software Ltd, 2020. All rights reserved
using UnityEngine;
using UnityEngine.InputSystem;
using Zinnia.Pointer;
using Zinnia.Cast;
public class FlyingCam : MonoBehaviour
{
[Header("Constants")]
@longde123
longde123 / JsonSchemaToPocos.cs
Created December 8, 2020 03:49 — forked from rushfrisby/JsonSchemaToPocos.cs
Converts a JSON schema to C# POCO classes
class Program
{
private const string Cyrillic = "Cyrillic";
private const string Nullable = "?";
static void Main()
{
string schemaText;
using (var r = new StreamReader("schema.txt"))
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using UnityEditor;
using UnityEditor.AddressableAssets;
using UnityEditor.AddressableAssets.Settings;
using UnityEngine;
using UnityEngine.AddressableAssets;
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using UnityEditor;
using UnityEditor.AddressableAssets;
using UnityEditor.AddressableAssets.Settings;
using UnityEngine;
using UnityEngine.AddressableAssets;
@longde123
longde123 / BuildAddressables.cs
Created August 12, 2020 03:34 — forked from favoyang/BuildAddressables.cs
Build addressable bundles when clicking the build button
/// <summary>
/// The script gives you choice to whether to build addressable bundles when clicking the build button.
/// For custom build script, call PreExport method yourself.
/// For cloud build, put BuildAddressablesProcessor.PreExport as PreExport command.
/// Discussion: https://forum.unity.com/threads/how-to-trigger-build-player-content-when-build-unity-project.689602/
/// </summary>
using UnityEditor;
using UnityEditor.AddressableAssets;
using UnityEditor.AddressableAssets.Settings;
using UnityEngine;
@longde123
longde123 / BuildAddressables.cs
Created August 12, 2020 03:34 — forked from favoyang/BuildAddressables.cs
Build addressable bundles when clicking the build button
/// <summary>
/// The script gives you choice to whether to build addressable bundles when clicking the build button.
/// For custom build script, call PreExport method yourself.
/// For cloud build, put BuildAddressablesProcessor.PreExport as PreExport command.
/// Discussion: https://forum.unity.com/threads/how-to-trigger-build-player-content-when-build-unity-project.689602/
/// </summary>
using UnityEditor;
using UnityEditor.AddressableAssets;
using UnityEditor.AddressableAssets.Settings;
using UnityEngine;
@longde123
longde123 / SharpNavTest.cs
Created August 7, 2020 03:42 — forked from unitycoder/SharpNavTest.cs
Using SharpNav.dll with Unity
using SharpNav;
using SharpNav.Geometry;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Vector3 = UnityEngine.Vector3;
public class SharpNavTest : MonoBehaviour
{
// assign your mesh here, try the example mesh provided in https://github.com/Robmaister/SharpNav/blob/96ddd939f292a4f4e76b460c1f783cdf1e9bcf41/Source/SharpNav.Examples/nav_test.obj
@longde123
longde123 / livestream
Created July 15, 2020 03:06 — forked from deandob/livestream
Node.JS function to remux mp4/h.264 video from an IP camera to a HTML5 video tag using FFMPEG
// Live video stream management for HTML5 video. Uses FFMPEG to connect to H.264 camera stream,
// Camera stream is remuxed to a MP4 stream for HTML5 video compatibility and segments are recorded for later playback
var liveStream = function (req, resp) { // handle each client request by instantiating a new FFMPEG instance
// For live streaming, create a fragmented MP4 file with empty moov (no seeking possible).
var reqUrl = url.parse(req.url, true)
var cameraName = typeof reqUrl.pathname === "string" ? reqUrl.pathname.substring(1) : undefined;
if (cameraName) {
try {
cameraName = decodeURIComponent(cameraName);
@longde123
longde123 / EntityComponentSystemExploration.md
Created July 7, 2020 02:13 — forked from TheSeamau5/EntityComponentSystemExploration.md
An exploration of the Entity Component System in Elm

#Exploring Entity Component Systems in Elm

Entity-Component-System (or ECS) is a pattern for designing programs that is prevalent in the games industry. This pattern consists of three simple parts:

  • Entity : A uniquely identifiable object that may contain any number of components
  • Component : A property usually representing the raw data of one aspect of the object. (Position is a component, Velocity is a component, Strength is a component, etc...)
  • System : A continuous process performing actions on every entity that possesses a component of the same aspect as that system

To understand this, let us try to make a simple example: Boxes that move in space: