Skip to content

Instantly share code, notes, and snippets.

View divide-by-zero's full-sized avatar

ksz divide-by-zero

View GitHub Profile
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerBall : MonoBehaviour
{
[SerializeField]
private float rotSpeed = 100;
[SerializeField]
@divide-by-zero
divide-by-zero / VectorNSwizzleExtensions.cs
Created January 1, 2020 18:11
Vector2/3/4 にswizzle演算子を生やせる拡張メソッド
using UnityEngine;
namespace VectorExtensions
{
public static class Vector2SwizzleExtension
{
public static Vector2 xx(this Vector2 v)
{
return new Vector2(v.x,v.x);
}
public static Vector2 xy(this Vector2 v)
@divide-by-zero
divide-by-zero / ColorConst.cs
Last active January 11, 2019 00:28
UnityのColorは定数で用意されている名前付きカラーが少なすぎるので、自分でなんとかしてみた。
namespace UnityEngine
{
public static class ColorConst
{
/// <summary>
/// #0048BA R:0% G:28% B:73%
/// </summary>
public static Color Absolute_Zero
{
v2=(2.0, 1.0)
UnityEngine.Debug:Log(Object)
SwizzleTest:Start() (at Assets/SwizzleTest.cs:11)
using System;
using System.Linq;
var r = new Random();
for(var i = 0;i < 10;++i)
Console.WriteLine(string.Join("の",
new []{
"風","谷","ナウシカ",
"天空","城ラピュタ",
"となり","トトロ",
"火垂る","墓",
@divide-by-zero
divide-by-zero / JSONパース用クラス
Last active February 8, 2018 15:27
Unity(WebGL)からGyazoAPIを使って画像をアップロードする ref: https://qiita.com/divideby_zero/items/8109a508afe91fee82ac
[Serializable]
public class GyazoResponse
{
public string image_id;
public string permalink_url;
public string thumb_url;
public string url;
public string type;
}
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.Networking;
public class GyazoSender
@divide-by-zero
divide-by-zero / list.txt
Created September 1, 2017 08:48
sqlplusで複数SQLを確認しながら順に流し込むbat芸 ref: http://qiita.com/divideby_zero/items/e0432732cbee80463380
hogehoge_alter.sql
hugahuga_insert.sql
mogamoga_update.sql
@divide-by-zero
divide-by-zero / MyMesh.cs
Created August 3, 2017 13:54
UnityでMeshの頂点をムニャムニャする ref: http://qiita.com/divideby_zero/items/eef7604e306300fd7833
using System.Collections.Generic;
using UnityEngine;
public class MyMesh : MonoBehaviour
{
[SerializeField]
private MeshFilter meshFilter;
private Mesh mesh;
void Start ()
{
button?.onClick.AddListener(async() => {
var btex = await BuildTexture.CreateBlurTextureAsync(spriteRenderer.sprite.texture, 32.0f, false);
spriteRenderer.sprite = Sprite.Create(btex, spriteRenderer.sprite.rect, new Vector2(0.5f, 0.5f));
});
}