Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
٩(˃̶͈̀௰˂̶͈́)و

fanhl dyguests

:octocat:
٩(˃̶͈̀௰˂̶͈́)و
View GitHub Profile
@dyguests
dyguests / BinaryIndexedTree.kt
Created Nov 18, 2021
BinaryIndexedTree, 数状数组
View BinaryIndexedTree.kt
class BinaryIndexedTree(private var nums: IntArray) {
var size: Int = nums.size
private val _bit = IntArray(size + 1)
init {
for (i in 0 until size) init(i, nums[i])
}
private fun init(index: Int, value: Int) {
var i = index + 1
@dyguests
dyguests / GroundHelper
Created Oct 13, 2021
GroundHelper, PhysicsObject, grounded checker.
View GroundHelper
using System;
using System.Collections.Generic;
using UnityEngine;
namespace Utils
{
public class GroundHelper
{
private const float minMoveDistance = 0.001f;
private const float shellRadius = 0.01f;
View SceneStacker.cs
using System.Collections.Generic;
using UnityEngine.SceneManagement;
namespace Utils
{
public static class SceneStacker
{
private static readonly Stack<string> sceneStack = new Stack<string>();
static SceneStacker()
@dyguests
dyguests / Touchable.cs
Created Jul 31, 2021
Unity Button without Image.
View Touchable.cs
// https://stackoverflow.com/questions/36888780/how-to-make-an-invisible-transparent-button-work
// file Touchable.cs
// Correctly backfills the missing Touchable concept in Unity.UI's OO chain.
using UnityEngine;
using UnityEngine.UI;
#if UNITY_EDITOR
using UnityEditor;
[CustomEditor(typeof(Touchable))]
public class Touchable_Editor : Editor
@dyguests
dyguests / AnimationCurveEx.cs
Created Jun 6, 2021
AnimationCurve PlayEvaluate
View AnimationCurveEx.cs
using System;
using System.Collections;
using UnityEngine;
namespace Util
{
public static class AnimationCurveEx
{
public static IEnumerator PlayEvaluate(this AnimationCurve curve, float time, Action<float> action, params Tuple<float, Action>[] animationEvents)
{
View FillScreen.cs
using UnityEngine;
namespace Game
{
public class FillScreen : MonoBehaviour
{
public SpriteRenderer sr;
private void Awake()
{
View InputCtlr.cs
using Common;
using UnityEngine;
using UnityEngine.InputSystem;
namespace Game
{
public class InputCtlr : MonoBehaviour
{
private InputActions inputActions;
View Kotlin DSL Tree.kt
fun main() {
val root = NodeBuilder {
"Ali"{
"Bob"{
"Candy"()
"Dave"()
}
"Egg"{
"Fold"()
}
@dyguests
dyguests / Inputer2DHelper.cs
Created Mar 5, 2020
Unity Inputer2DHelper
View Inputer2DHelper.cs
using System;
using UnityEngine;
namespace Lina.Scripts
{
public struct Inputer2DHelper
{
private Vector2 move;
private bool fire1;
@dyguests
dyguests / PhysicsObject.cs
Created Jan 30, 2020
Unity PhysicsObject
View PhysicsObject.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PhysicsObject : MonoBehaviour {
public float minGroundNormalY = .65f;
public float gravityModifier = 1f;
protected Vector2 targetVelocity;