Skip to content

Instantly share code, notes, and snippets.

// This script is created with help of tutorial by Catlikecoding
// meant to create infinte platformer game
// http://catlikecoding.com/unity/tutorials/runner/
using UnityEngine;
using System.Collections.Generic;
public class PlatformManager : MonoBehaviour {
public Transform prefab;
public int numberOfObjects;
Shader "MyShader"
{
Properties
{
// The properties of your shaders
// - textures
// - colours
// - parameters
// ...
}
Properties {
// properties for water shader
_WaveScale ("Wave scale", Range (0.02,0.15)) = 0.07 // sliders
_ReflDistort ("Reflection distort", Range (0,1.5)) = 0.5
_RefrDistort ("Refraction distort", Range (0,1.5)) = 0.4
_RefrColor ("Refraction color", Color) = (.34, .85, .92, 1) // color
_ReflectionTex ("Environment Reflection", 2D) = "" {} // textures
_RefractionTex ("Environment Refraction", 2D) = "" {}
_Fresnel ("Fresnel (A) ", 2D) = "" {}
_BumpMap ("Bumpmap (RGB) ", 2D) = "" {}
@nipundavid
nipundavid / CustomShader.shader
Created September 9, 2016 04:02
Simple shader, Add color to the mesh
Shader "Unlit/CustomShader"
{
Properties {
_Color("Main Color", Color) = (1,1,1,1)
}
SubShader {
PASS {
CGPROGRAM
#pragma vertex vert
@nipundavid
nipundavid / InputHandler.cs
Created September 9, 2016 04:06
Rotate 3D game object when touched and drag on screen, tap and double tap
using UnityEngine;
using System.Collections;
public class InputHandler : MonoBehaviour {
private bool isDragging;
private GameObject target;
float touchDuration;
@nipundavid
nipundavid / CustomShader_Texture.shader
Last active September 9, 2016 04:43
A simple shader, which wraps a texture around a 3D model
Shader "Unlit/CustomShader_Texture"
{
Properties {
// Texture field in inspector where we assign texture to the model
_MainTexture("Main Texture",2D) = "white"{}
}
SubShader {
PASS {
CGPROGRAM
@nipundavid
nipundavid / Levitate.cs
Created September 12, 2016 04:35
This scripts levitate game object in 3 axis.
using UnityEngine;
using System.Collections;
public class Levitate : MonoBehaviour {
public float amplitude = 0.1f;
public Vector3 speed;
private Vector3 tempVal;
private Vector3 tempPos;
void Start ()
using UnityEngine;
using System.Collections;
public class SwipeScript : MonoBehaviour {
private float fingerStartTime = 0.0f;
private Vector2 fingerStartPos = Vector2.zero;
private bool isSwipe = false;
@nipundavid
nipundavid / SavWav.cs
Created November 10, 2016 05:10 — forked from darktable/SavWav.cs
Unity3D: script to save an AudioClip as a .wav file.
// Copyright (c) 2012 Calvin Rien
// http://the.darktable.com
//
// This software is provided 'as-is', without any express or implied warranty. In
// no event will the authors be held liable for any damages arising from the use
// of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
@nipundavid
nipundavid / Matte Shadow.shader
Created November 30, 2016 05:24
Shader to show the shadow on transparent gameobject, very usefull in Augmented Reality (Vuforia)
Shader "FX/Matte Shadow" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
}
SubShader {
Tags {"Queue"="AlphaTest" "IgnoreProjector"="True" "RenderType"="TransparentCutout"}
LOD 200
Blend Zero SrcColor