Skip to content

Instantly share code, notes, and snippets.

View 0V's full-sized avatar
🛌
Always sleeping

G2 0V

🛌
Always sleeping
View GitHub Profile
@0V
0V / SecretClickHandler.cs
Last active May 20, 2017 11:24
Unity(uGUI)で N 回クリックするとオブジェクトをアクティブにするスクリプト
using System;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
public class SecretClickHandler : MonoBehaviour, IPointerClickHandler
{
[SerializeField]
private ClickEvent clickHandler;
[SerializeField]
@0V
0V / CounterClickHandler.cs
Last active May 20, 2017 11:33
uGUIで指定回数連続クリックされたら何かをするスクリプト
using System;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
public class CounterClickHandler : MonoBehaviour, IPointerClickHandler
{
[SerializeField]
private ClickEvent clickHandler;
[SerializeField]
@0V
0V / aprrox.c
Last active May 14, 2019 04:23
Approximationa rough calculation without math.h (for my homework)
#include <stdio.h>
#define LOG2 0.693147180559945309417 //log(2)
#define chk_nan(x) x!=x
double log_fast(double x)
{
static double table[17]={
.0 , // log( 16 /16)
.0606246218164348425806 , // log( 17 /16)
.1177830356563834545387 , // log( 18 /16)
using System.Text.RegularExpressions;
using UnityEditor;
using UnityEngine;
public class ToNumbering : EditorWindow
{
private string baseName = "";
// Add menu item named "My Window" to the Window menu
[SerializeField]
private float speed = 10f;
void Update () {
transform.Translate (speed * Time.deltaTime, 0, 0);
}
@0V
0V / wallis_fomula.rs
Created August 8, 2018 12:27
Wallis' Formula by Rust
use std::io;
fn main() {
println!("Please Input Count > ");
let mut count = String::new();
io::stdin().read_line(&mut count).expect("Failed to read line");;
let count: u64 = count.trim().parse().expect("Need u64");
println!("PI = {}",wallis_fomula(count));
var controller = GetComponent<SteamVRInputRx>();
controller.ControllerState
.Where(s => s == SteamVRControllerState.TriggerPressDown)
.Subscribe(_ =>
{
// Triggerが引かれたら何かをする
});
@0V
0V / RandomBoxMuller.cs
Last active October 23, 2018 14:49
Ranged Box–Muller's method for Unity
using UnityEngine;
/// <summary>
/// Box–Muller's method
/// </summary>
public class RandomBoxMuller
{
public static float Range(float min, float max)
{
while (true)
VRTK_ControllerEvents controllerEvents = GetComponent<VRTK_ControllerEvents>();
controllerEvents.TriggerPressedAsObservable()
.Subscribe(_ =>
{
Debug.Log("Trigger Pressed!");
});
using RxVRTK;
using UniRx;
using UnityEngine;
public class SomeObject : RxVRTK_InteractableObject
{
protected void Start()
{
this.StartUsingAsObservable()
.Subscribe(user =>