Skip to content

Instantly share code, notes, and snippets.

Avatar

Shunsuke_Ishimoto TheStoneBook

View GitHub Profile
@TheStoneBook
TheStoneBook / Satellite.cs
Last active Sep 2, 2019
【Unity】衛星軌道(円周)
View Satellite.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public enum AROUNDLR
{
LEFT,
RIGHT
}
@TheStoneBook
TheStoneBook / BumpMapping.shader
Last active Jan 19, 2019
【Unity】バンプマッピング【Shader】
View BumpMapping.shader
Shader "Custom/BumpMapping" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex("MainTexture", 2D) = "white" {}
_BumpMap("NormalMap", 2D) = "white" {}
_BumpScale("NormalScale", Range(0,1)) = 0.5
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
@TheStoneBook
TheStoneBook / HeightDisappear.shader
Last active Dec 30, 2018
【Unity】指定の高さ(ワールド座標)以降は描画しないシェーダー
View HeightDisappear.shader
Shader "Custom/HeightDisappear" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Height ("Height", Float) = 0.0
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
}
SubShader {
Tags { "RenderType"="Opaque" }
@TheStoneBook
TheStoneBook / RimLightingStandard.shader
Last active Dec 19, 2018
【Unity】リムライティングっぽいシェーダー(StandardShader版)
View RimLightingStandard.shader
Shader "Custom/RimLightingStandard" {
Properties {
_MainColor ("MainColor", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_RimColor("RimColor",Color)=(1,1,1,1)
_RimPower("RimPower", Range(0.1, 10.0)) = 3.0
_RimAmplitude("RimAmplitude",Float)=1
_Alpha("Alpha",Range(0.0,1.0))=1
}
SubShader {
@TheStoneBook
TheStoneBook / dimen.xml
Created Nov 12, 2018
【Android】dimen.xmlファイルの一例
View dimen.xml
<?xml version="1.0" encoding="UTF-8" ?>
<resources>
<dimen name="Header_text_size">20dp</dimen>
<dimen name="Button_text_size">20dp</dimen>
<dimen name="Button_height">50dp</dimen>
</resources>
@TheStoneBook
TheStoneBook / RimLightEffect.shader
Last active Nov 12, 2018
【Unity】リムライティングエフェクト【Shader】
View RimLightEffect.shader
Shader "Unlit/RimLightEffect"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_MainColor("MainColor",Color)=(1,1,1,1)
_RimPower("RimPower",Float)=1
_RimAmplitude("RimAmplitude",Float)=1
_RimColor("RimColor",Color)=(1,1,1,1)
_Alpha("Alpha",Range(0.0,1.0))=1
@TheStoneBook
TheStoneBook / Polygonoperator.shader
Last active Nov 10, 2018
【Unity】ジオメトリーシェーダーでポリゴンをバラバラにする【Shader】
View Polygonoperator.shader
Shader "Unlit/Polygonoperator"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_MainColor("Color",Color)=(1,1,1,1)
_PositionFactor("Position Factor", Range(0.0, 1.0)) = 1.0
_RotationFactor("Rotation Factor", Range(0.0, 1.0)) = 1.0
_ScaleFactor("Scale Factor", Range(0.0, 1.0)) = 1.0
_Destruction("Destruction Factor", Range(0.0, 1.0)) = 0.0
@TheStoneBook
TheStoneBook / InputIntByTryParse.cs
Last active Nov 12, 2018
【Xamarin.iOS】TryParseを使って、TextField(NumberField)に数値のみ入力できるようにする。
View InputIntByTryParse.cs
public override void ViewDidLoad()
{
base.ViewDidLoad();
NumberField.EditingChanged += (sender, e) =>
{
int number;
int.TryParse(((UITextField)sender).Text, out number);
NumberField.Text = number.ToString();
};
@TheStoneBook
TheStoneBook / AccSensor.cs
Created Nov 5, 2018
【Unity】スマホ、タブレット等の加速度センサーの値取得
View AccSensor.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AccSensor : MonoBehaviour {
public Vector3 acc_dir;
void Update () {
@TheStoneBook
TheStoneBook / ShaderReplace.cs
Created Oct 21, 2018
【Unity】カメラ画面内のShaderを置き換える【ShaderReplacement】
View ShaderReplace.cs
using UnityEngine;
public class ShaderReplace : MonoBehaviour {
public Shader replaceShader;
void Update () {
if(Input.GetKey(KeyCode.A))
{