Skip to content

Instantly share code, notes, and snippets.

View restush's full-sized avatar
🎯
Focusing

Restu Syibul Huda restush

🎯
Focusing
  • AmoyFeels
  • Indonesia
View GitHub Profile
@restush
restush / Order Convention Writng C# Class.cs
Last active October 23, 2023 01:12
A correct way to write C# aka order convention of writing a C# class.
public class MyClass
{
// Nested classes, structs, enums
public class PublicNestedClass { }
public struct PublicNestedStruct { }
public enum PublicNestedEnum { A, B, C }
private class PrivateNestedClass { }
private struct PrivateNestedStruct { }
private enum PrivateNestedEnum { A, B, C }
@restush
restush / CustomTime.cs
Last active October 20, 2023 17:33
CustomTime for Naninovel in Unity
/// <summary> Custom Unity Time based on <see cref="System.Diagnostics.Stopwatch"/> </summary>
public class CustomTime : ITime
{
public float TimeScale { get; set; }
public float Time { get; private set; }
public float DeltaTime { get; private set; }
public float UnscaledTime { get; private set; }
public float UnscaledDeltaTime { get; private set; }
public int FrameCount { get; private set; }
@restush
restush / UniTask-AllowSceneActivation.cs
Last active August 14, 2023 11:39
UniTask Unity Cheat Sheet
/// Example Usage
{
...
var operation = await LoadSceneOperation(nameOfScene, (progress)=>slider.value = progress);
...
...
operation.allowSceneActivation = true;
...
@restush
restush / ICircleTarget.cs
Last active June 29, 2023 14:42
Get target position in form of Circular / Circle position. So multiple agents that are following target, will try circling target. This prevent agents colliding with each other because wants to go to the same position.
using System.Collections.Generic;
using UnityEngine;
///<summary> Attach this script on Monobehaviour class </summary>
public interface ICircleTarget
{
/// <summary> Circle radius around target </summary>
float RadiusAroundTarget { get; set; }
/// <summary> Contain objects that following this target </summary>
List<Transform> CircleObjects { get; set; }
@restush
restush / SimpleDateTime.cs
Last active June 9, 2023 23:30
Simple serializable System.DateTime and Time Machine for Unity Engine.
using System;
using UnityEngine;
/// <summary>
/// Simple Date Time based on <see cref="System.DateTime"/>.
/// <example>
/// <br/><br/>
/// Usage 1:
/// <code>
/// var simpleDateTime = new SimpleDateTime(DateTime.Now);
@restush
restush / Initializer.cs
Last active June 9, 2023 22:29
Unity Google Play Asset Delivery
using System;
using System.Collections;
using System.Linq;
using UnityEngine;
using UnityEngine.Android;
using UnityEngine.Networking;
using UnityEngine.UI;
public class Initializer : MonoBehaviour
{