@@ -0,0 +1,23 @@
using UnityEngine;
using System.Collections;

public class simpleMove : MonoBehaviour {

private Vector3 startPos;
private float tmp;

// Use this for initialization
void Start () {
startPos = transform.position;
}

// Update is called once per frame
void Update () {

tmp += Time.deltaTime * 40.0f;
//transform.position = startPos + new Vector3 (Mathf.Cos(tmp), 0.0f, Mathf.Sin(tmp));
transform.position = startPos + new Vector3 (0.0f, 0.0f, -tmp );
if(tmp > 100.0f)
tmp = 0.0f;
}
}
@@ -0,0 +1,146 @@
using System;
using System.Collections.Generic;
using UnityEditor;

namespace UnityStandardAssets.CrossPlatformInput.Inspector
{
[InitializeOnLoad]
public class CrossPlatformInitialize
{
// Custom compiler defines:
//
// CROSS_PLATFORM_INPUT : denotes that cross platform input package exists, so that other packages can use their CrossPlatformInput functions.
// EDITOR_MOBILE_INPUT : denotes that mobile input should be used in editor, if a mobile build target is selected. (i.e. using Unity Remote app).
// MOBILE_INPUT : denotes that mobile input should be used right now!

static CrossPlatformInitialize()
{
var defines = GetDefinesList(buildTargetGroups[0]);
if (!defines.Contains("CROSS_PLATFORM_INPUT"))
{
SetEnabled("CROSS_PLATFORM_INPUT", true, false);
SetEnabled("MOBILE_INPUT", true, true);
}
}


[MenuItem("Mobile Input/Enable")]
private static void Enable()
{
SetEnabled("MOBILE_INPUT", true, true);
switch (EditorUserBuildSettings.activeBuildTarget)
{
case BuildTarget.Android:
case BuildTarget.iOS:
case BuildTarget.WP8Player:
case BuildTarget.BlackBerry:
case BuildTarget.PSM:
case BuildTarget.Tizen:
case BuildTarget.WSAPlayer:
EditorUtility.DisplayDialog("Mobile Input",
"You have enabled Mobile Input. You'll need to use the Unity Remote app on a connected device to control your game in the Editor.",
"OK");
break;

default:
EditorUtility.DisplayDialog("Mobile Input",
"You have enabled Mobile Input, but you have a non-mobile build target selected in your build settings. The mobile control rigs won't be active or visible on-screen until you switch the build target to a mobile platform.",
"OK");
break;
}
}


[MenuItem("Mobile Input/Enable", true)]
private static bool EnableValidate()
{
var defines = GetDefinesList(mobileBuildTargetGroups[0]);
return !defines.Contains("MOBILE_INPUT");
}


[MenuItem("Mobile Input/Disable")]
private static void Disable()
{
SetEnabled("MOBILE_INPUT", false, true);
switch (EditorUserBuildSettings.activeBuildTarget)
{
case BuildTarget.Android:
case BuildTarget.iOS:
case BuildTarget.WP8Player:
case BuildTarget.BlackBerry:
EditorUtility.DisplayDialog("Mobile Input",
"You have disabled Mobile Input. Mobile control rigs won't be visible, and the Cross Platform Input functions will always return standalone controls.",
"OK");
break;
}
}


[MenuItem("Mobile Input/Disable", true)]
private static bool DisableValidate()
{
var defines = GetDefinesList(mobileBuildTargetGroups[0]);
return defines.Contains("MOBILE_INPUT");
}


private static BuildTargetGroup[] buildTargetGroups = new BuildTargetGroup[]
{
BuildTargetGroup.Standalone,
BuildTargetGroup.WebPlayer,
BuildTargetGroup.Android,
BuildTargetGroup.iOS,
BuildTargetGroup.WP8,
BuildTargetGroup.BlackBerry
};

private static BuildTargetGroup[] mobileBuildTargetGroups = new BuildTargetGroup[]
{
BuildTargetGroup.Android,
BuildTargetGroup.iOS,
BuildTargetGroup.WP8,
BuildTargetGroup.BlackBerry,
BuildTargetGroup.PSM,
BuildTargetGroup.Tizen,
BuildTargetGroup.WSA
};


private static void SetEnabled(string defineName, bool enable, bool mobile)
{
//Debug.Log("setting "+defineName+" to "+enable);
foreach (var group in mobile ? mobileBuildTargetGroups : buildTargetGroups)
{
var defines = GetDefinesList(group);
if (enable)
{
if (defines.Contains(defineName))
{
return;
}
defines.Add(defineName);
}
else
{
if (!defines.Contains(defineName))
{
return;
}
while (defines.Contains(defineName))
{
defines.Remove(defineName);
}
}
string definesString = string.Join(";", defines.ToArray());
PlayerSettings.SetScriptingDefineSymbolsForGroup(group, definesString);
}
}


private static List<string> GetDefinesList(BuildTargetGroup group)
{
return new List<string>(PlayerSettings.GetScriptingDefineSymbolsForGroup(group).Split(';'));
}
}
}
@@ -0,0 +1,75 @@
using System;
using UnityEditor;
using UnityEngine;

namespace UnityStandardAssets.ImageEffects
{
[CustomEditor(typeof (Antialiasing))]
public class AntialiasingEditor : Editor
{
private SerializedObject serObj;

private SerializedProperty mode;

private SerializedProperty showGeneratedNormals;
private SerializedProperty offsetScale;
private SerializedProperty blurRadius;
private SerializedProperty dlaaSharp;

private SerializedProperty edgeThresholdMin;
private SerializedProperty edgeThreshold;
private SerializedProperty edgeSharpness;


private void OnEnable()
{
serObj = new SerializedObject(target);

mode = serObj.FindProperty("mode");

showGeneratedNormals = serObj.FindProperty("showGeneratedNormals");
offsetScale = serObj.FindProperty("offsetScale");
blurRadius = serObj.FindProperty("blurRadius");
dlaaSharp = serObj.FindProperty("dlaaSharp");

edgeThresholdMin = serObj.FindProperty("edgeThresholdMin");
edgeThreshold = serObj.FindProperty("edgeThreshold");
edgeSharpness = serObj.FindProperty("edgeSharpness");
}


public override void OnInspectorGUI()
{
serObj.Update();

GUILayout.Label("Luminance based fullscreen antialiasing", EditorStyles.miniBoldLabel);

EditorGUILayout.PropertyField(mode, new GUIContent("Technique"));

Material mat = (target as Antialiasing).CurrentAAMaterial();
if (null == mat && (target as Antialiasing).enabled)
{
EditorGUILayout.HelpBox("This AA technique is currently not supported. Choose a different technique or disable the effect and use MSAA instead.", MessageType.Warning);
}

if (mode.enumValueIndex == (int) AAMode.NFAA)
{
EditorGUILayout.PropertyField(offsetScale, new GUIContent("Edge Detect Ofs"));
EditorGUILayout.PropertyField(blurRadius, new GUIContent("Blur Radius"));
EditorGUILayout.PropertyField(showGeneratedNormals, new GUIContent("Show Normals"));
}
else if (mode.enumValueIndex == (int) AAMode.DLAA)
{
EditorGUILayout.PropertyField(dlaaSharp, new GUIContent("Sharp"));
}
else if (mode.enumValueIndex == (int) AAMode.FXAA3Console)
{
EditorGUILayout.PropertyField(edgeThresholdMin, new GUIContent("Edge Min Threshhold"));
EditorGUILayout.PropertyField(edgeThreshold, new GUIContent("Edge Threshhold"));
EditorGUILayout.PropertyField(edgeSharpness, new GUIContent("Edge Sharpness"));
}

serObj.ApplyModifiedProperties();
}
}
}
@@ -0,0 +1,157 @@
using System;
using UnityEditor;
using UnityEngine;

namespace UnityStandardAssets.ImageEffects
{
[CustomEditor (typeof(BloomAndFlares))]
class BloomAndFlaresEditor : Editor
{
SerializedProperty tweakMode;
SerializedProperty screenBlendMode;

SerializedObject serObj;

SerializedProperty hdr;
SerializedProperty sepBlurSpread;
SerializedProperty useSrcAlphaAsMask;

SerializedProperty bloomIntensity;
SerializedProperty bloomthreshold;
SerializedProperty bloomBlurIterations;

SerializedProperty lensflares;

SerializedProperty hollywoodFlareBlurIterations;

SerializedProperty lensflareMode;
SerializedProperty hollyStretchWidth;
SerializedProperty lensflareIntensity;
SerializedProperty lensflarethreshold;
SerializedProperty flareColorA;
SerializedProperty flareColorB;
SerializedProperty flareColorC;
SerializedProperty flareColorD;

SerializedProperty lensFlareVignetteMask;

void OnEnable () {
serObj = new SerializedObject (target);

screenBlendMode = serObj.FindProperty("screenBlendMode");
hdr = serObj.FindProperty("hdr");

sepBlurSpread = serObj.FindProperty("sepBlurSpread");
useSrcAlphaAsMask = serObj.FindProperty("useSrcAlphaAsMask");

bloomIntensity = serObj.FindProperty("bloomIntensity");
bloomthreshold = serObj.FindProperty("bloomThreshold");
bloomBlurIterations = serObj.FindProperty("bloomBlurIterations");

lensflares = serObj.FindProperty("lensflares");

lensflareMode = serObj.FindProperty("lensflareMode");
hollywoodFlareBlurIterations = serObj.FindProperty("hollywoodFlareBlurIterations");
hollyStretchWidth = serObj.FindProperty("hollyStretchWidth");
lensflareIntensity = serObj.FindProperty("lensflareIntensity");
lensflarethreshold = serObj.FindProperty("lensflareThreshold");
flareColorA = serObj.FindProperty("flareColorA");
flareColorB = serObj.FindProperty("flareColorB");
flareColorC = serObj.FindProperty("flareColorC");
flareColorD = serObj.FindProperty("flareColorD");
lensFlareVignetteMask = serObj.FindProperty("lensFlareVignetteMask");

tweakMode = serObj.FindProperty("tweakMode");
}


public override void OnInspectorGUI () {
serObj.Update();

GUILayout.Label("HDR " + (hdr.enumValueIndex == 0 ? "auto detected, " : (hdr.enumValueIndex == 1 ? "forced on, " : "disabled, ")) + (useSrcAlphaAsMask.floatValue < 0.1f ? " ignoring alpha channel glow information" : " using alpha channel glow information"), EditorStyles.miniBoldLabel);

EditorGUILayout.PropertyField (tweakMode, new GUIContent("Tweak mode"));
EditorGUILayout.PropertyField (screenBlendMode, new GUIContent("Blend mode"));
EditorGUILayout.PropertyField (hdr, new GUIContent("HDR"));

// display info text when screen blend mode cannot be used
Camera cam = (target as BloomAndFlares).GetComponent<Camera>();
if (cam != null) {
if (screenBlendMode.enumValueIndex==0 && ((cam.hdr && hdr.enumValueIndex==0) || (hdr.enumValueIndex==1))) {
EditorGUILayout.HelpBox("Screen blend is not supported in HDR. Using 'Add' instead.", MessageType.Info);
}
}

if (1 == tweakMode.intValue)
EditorGUILayout.PropertyField (lensflares, new GUIContent("Cast lens flares"));

EditorGUILayout.Separator ();

EditorGUILayout.PropertyField (bloomIntensity, new GUIContent("Intensity"));
bloomthreshold.floatValue = EditorGUILayout.Slider ("threshold", bloomthreshold.floatValue, -0.05f, 4.0f);
bloomBlurIterations.intValue = EditorGUILayout.IntSlider ("Blur iterations", bloomBlurIterations.intValue, 1, 4);
sepBlurSpread.floatValue = EditorGUILayout.Slider ("Blur spread", sepBlurSpread.floatValue, 0.1f, 10.0f);

if (1 == tweakMode.intValue)
useSrcAlphaAsMask.floatValue = EditorGUILayout.Slider (new GUIContent("Use alpha mask", "Make alpha channel define glowiness"), useSrcAlphaAsMask.floatValue, 0.0f, 1.0f);
else
useSrcAlphaAsMask.floatValue = 0.0f;

if (1 == tweakMode.intValue) {
EditorGUILayout.Separator ();

if (lensflares.boolValue) {

// further lens flare tweakings
if (0 != tweakMode.intValue)
EditorGUILayout.PropertyField (lensflareMode, new GUIContent("Lens flare mode"));
else
lensflareMode.enumValueIndex = 0;

EditorGUILayout.PropertyField(lensFlareVignetteMask, new GUIContent("Lens flare mask", "This mask is needed to prevent lens flare artifacts"));

EditorGUILayout.PropertyField (lensflareIntensity, new GUIContent("Local intensity"));
lensflarethreshold.floatValue = EditorGUILayout.Slider ("Local threshold", lensflarethreshold.floatValue, 0.0f, 1.0f);

if (lensflareMode.intValue == 0) {
// ghosting
EditorGUILayout.BeginHorizontal ();
EditorGUILayout.PropertyField (flareColorA, new GUIContent("1st Color"));
EditorGUILayout.PropertyField (flareColorB, new GUIContent("2nd Color"));
EditorGUILayout.EndHorizontal ();

EditorGUILayout.BeginHorizontal ();
EditorGUILayout.PropertyField (flareColorC, new GUIContent("3rd Color"));
EditorGUILayout.PropertyField (flareColorD, new GUIContent("4th Color"));
EditorGUILayout.EndHorizontal ();
}
else if (lensflareMode.intValue == 1) {
// hollywood
EditorGUILayout.PropertyField (hollyStretchWidth, new GUIContent("Stretch width"));
hollywoodFlareBlurIterations.intValue = EditorGUILayout.IntSlider ("Blur iterations", hollywoodFlareBlurIterations.intValue, 1, 4);

EditorGUILayout.PropertyField (flareColorA, new GUIContent("Tint Color"));
}
else if (lensflareMode.intValue == 2) {
// both
EditorGUILayout.PropertyField (hollyStretchWidth, new GUIContent("Stretch width"));
hollywoodFlareBlurIterations.intValue = EditorGUILayout.IntSlider ("Blur iterations", hollywoodFlareBlurIterations.intValue, 1, 4);

EditorGUILayout.BeginHorizontal ();
EditorGUILayout.PropertyField (flareColorA, new GUIContent("1st Color"));
EditorGUILayout.PropertyField (flareColorB, new GUIContent("2nd Color"));
EditorGUILayout.EndHorizontal ();

EditorGUILayout.BeginHorizontal ();
EditorGUILayout.PropertyField (flareColorC, new GUIContent("3rd Color"));
EditorGUILayout.PropertyField (flareColorD, new GUIContent("4th Color"));
EditorGUILayout.EndHorizontal ();
}
}
} else
lensflares.boolValue = false; // disable lens flares in simple tweak mode

serObj.ApplyModifiedProperties();
}
}
}
@@ -0,0 +1,162 @@
using System;
using UnityEditor;
using UnityEngine;

namespace UnityStandardAssets.ImageEffects
{
[CustomEditor (typeof(Bloom))]
class BloomEditor : Editor
{
SerializedProperty tweakMode;
SerializedProperty screenBlendMode;

SerializedObject serObj;

SerializedProperty hdr;
SerializedProperty quality;
SerializedProperty sepBlurSpread;

SerializedProperty bloomIntensity;
SerializedProperty bloomThresholdColor;
SerializedProperty bloomThreshold;
SerializedProperty bloomBlurIterations;

SerializedProperty hollywoodFlareBlurIterations;

SerializedProperty lensflareMode;
SerializedProperty hollyStretchWidth;
SerializedProperty lensflareIntensity;
SerializedProperty flareRotation;
SerializedProperty lensFlareSaturation;
SerializedProperty lensflareThreshold;
SerializedProperty flareColorA;
SerializedProperty flareColorB;
SerializedProperty flareColorC;
SerializedProperty flareColorD;

SerializedProperty lensFlareVignetteMask;

void OnEnable () {
serObj = new SerializedObject (target);

screenBlendMode = serObj.FindProperty("screenBlendMode");
hdr = serObj.FindProperty("hdr");
quality = serObj.FindProperty("quality");

sepBlurSpread = serObj.FindProperty("sepBlurSpread");

bloomIntensity = serObj.FindProperty("bloomIntensity");
bloomThreshold = serObj.FindProperty("bloomThreshold");
bloomThresholdColor = serObj.FindProperty("bloomThresholdColor");
bloomBlurIterations = serObj.FindProperty("bloomBlurIterations");

lensflareMode = serObj.FindProperty("lensflareMode");
hollywoodFlareBlurIterations = serObj.FindProperty("hollywoodFlareBlurIterations");
hollyStretchWidth = serObj.FindProperty("hollyStretchWidth");
lensflareIntensity = serObj.FindProperty("lensflareIntensity");
lensflareThreshold = serObj.FindProperty("lensflareThreshold");
lensFlareSaturation = serObj.FindProperty("lensFlareSaturation");
flareRotation = serObj.FindProperty("flareRotation");
flareColorA = serObj.FindProperty("flareColorA");
flareColorB = serObj.FindProperty("flareColorB");
flareColorC = serObj.FindProperty("flareColorC");
flareColorD = serObj.FindProperty("flareColorD");
lensFlareVignetteMask = serObj.FindProperty("lensFlareVignetteMask");

tweakMode = serObj.FindProperty("tweakMode");
}


public override void OnInspectorGUI () {
serObj.Update();

EditorGUILayout.LabelField("Glow and Lens Flares for bright screen pixels", EditorStyles.miniLabel);

EditorGUILayout.PropertyField (quality, new GUIContent("Quality", "High quality preserves high frequencies with bigger blurs and uses a better blending and down-/upsampling"));

EditorGUILayout.Separator ();

EditorGUILayout.PropertyField (tweakMode, new GUIContent("Mode"));
EditorGUILayout.PropertyField (screenBlendMode, new GUIContent("Blend"));
EditorGUILayout.PropertyField (hdr, new GUIContent("HDR"));

EditorGUILayout.Separator ();

// display info text when screen blend mode cannot be used
Camera cam = (target as Bloom).GetComponent<Camera>();
if (cam != null) {
if (screenBlendMode.enumValueIndex==0 && ((cam.hdr && hdr.enumValueIndex==0) || (hdr.enumValueIndex==1))) {
EditorGUILayout.HelpBox("Screen blend is not supported in HDR. Using 'Add' instead.", MessageType.Info);
}
}

EditorGUILayout.PropertyField (bloomIntensity, new GUIContent("Intensity"));
bloomThreshold.floatValue = EditorGUILayout.Slider ("Threshold", bloomThreshold.floatValue, -0.05f, 4.0f);
if (1 == tweakMode.intValue) {
EditorGUILayout.PropertyField(bloomThresholdColor, new GUIContent(" RGB Threshold"));
}
EditorGUILayout.Separator ();

bloomBlurIterations.intValue = EditorGUILayout.IntSlider ("Blur Iterations", bloomBlurIterations.intValue, 1, 4);
sepBlurSpread.floatValue = EditorGUILayout.Slider (" Sample Distance", sepBlurSpread.floatValue, 0.1f, 10.0f);
EditorGUILayout.Separator ();

if (1 == tweakMode.intValue) {
// further lens flare tweakings
if (0 != tweakMode.intValue)
EditorGUILayout.PropertyField (lensflareMode, new GUIContent("Lens Flares"));
else
lensflareMode.enumValueIndex = 0;

EditorGUILayout.PropertyField (lensflareIntensity, new GUIContent(" Local Intensity", "0 disables lens flares entirely (optimization)"));
lensflareThreshold.floatValue = EditorGUILayout.Slider ("Threshold", lensflareThreshold.floatValue, 0.0f, 4.0f);

if (Mathf.Abs(lensflareIntensity.floatValue) > Mathf.Epsilon) {
if (lensflareMode.intValue == 0) {
// ghosting
EditorGUILayout.BeginHorizontal ();
EditorGUILayout.PropertyField (flareColorA, new GUIContent(" 1st Color"));
EditorGUILayout.PropertyField (flareColorB, new GUIContent(" 2nd Color"));
EditorGUILayout.EndHorizontal ();

EditorGUILayout.BeginHorizontal ();
EditorGUILayout.PropertyField (flareColorC, new GUIContent(" 3rd Color"));
EditorGUILayout.PropertyField (flareColorD, new GUIContent(" 4th Color"));
EditorGUILayout.EndHorizontal ();
}
else if (lensflareMode.intValue == 1) {
// hollywood
EditorGUILayout.PropertyField (hollyStretchWidth, new GUIContent(" Stretch width"));
EditorGUILayout.PropertyField (flareRotation, new GUIContent( " Rotation"));
hollywoodFlareBlurIterations.intValue = EditorGUILayout.IntSlider (" Blur Iterations", hollywoodFlareBlurIterations.intValue, 1, 4);

EditorGUILayout.PropertyField (lensFlareSaturation, new GUIContent(" Saturation"));
EditorGUILayout.PropertyField (flareColorA, new GUIContent(" Tint Color"));
}
else if (lensflareMode.intValue == 2) {
// both
EditorGUILayout.PropertyField (hollyStretchWidth, new GUIContent(" Stretch width"));
hollywoodFlareBlurIterations.intValue = EditorGUILayout.IntSlider (" Blur Iterations", hollywoodFlareBlurIterations.intValue, 1, 4);

EditorGUILayout.PropertyField (lensFlareSaturation, new GUIContent(" Saturation"));

EditorGUILayout.BeginHorizontal ();
EditorGUILayout.PropertyField (flareColorA, new GUIContent(" 1st Color"));
EditorGUILayout.PropertyField (flareColorB, new GUIContent(" 2nd Color"));
EditorGUILayout.EndHorizontal ();

EditorGUILayout.BeginHorizontal ();
EditorGUILayout.PropertyField (flareColorC, new GUIContent(" 3rd Color"));
EditorGUILayout.PropertyField (flareColorD, new GUIContent(" 4th Color"));
EditorGUILayout.EndHorizontal ();
}

EditorGUILayout.PropertyField(lensFlareVignetteMask, new GUIContent(" Mask", "This mask is needed to prevent lens flare artifacts"));

}
}

serObj.ApplyModifiedProperties();
}
}
}
@@ -0,0 +1,99 @@
using System;
using UnityEditor;
using UnityEngine;

namespace UnityStandardAssets.ImageEffects
{
[CustomEditor (typeof(CameraMotionBlur))]
class CameraMotionBlurEditor : Editor
{
SerializedObject serObj;

SerializedProperty filterType;
SerializedProperty preview;
SerializedProperty previewScale;
SerializedProperty movementScale;
SerializedProperty jitter;
SerializedProperty rotationScale;
SerializedProperty maxVelocity;
SerializedProperty minVelocity;
SerializedProperty velocityScale;
SerializedProperty velocityDownsample;
SerializedProperty noiseTexture;
SerializedProperty showVelocity;
SerializedProperty showVelocityScale;
SerializedProperty excludeLayers;

void OnEnable () {
serObj = new SerializedObject (target);

filterType = serObj.FindProperty ("filterType");

preview = serObj.FindProperty ("preview");
previewScale = serObj.FindProperty ("previewScale");

movementScale = serObj.FindProperty ("movementScale");
rotationScale = serObj.FindProperty ("rotationScale");

maxVelocity = serObj.FindProperty ("maxVelocity");
minVelocity = serObj.FindProperty ("minVelocity");

jitter = serObj.FindProperty ("jitter");

excludeLayers = serObj.FindProperty ("excludeLayers");

velocityScale = serObj.FindProperty ("velocityScale");
velocityDownsample = serObj.FindProperty ("velocityDownsample");

noiseTexture = serObj.FindProperty ("noiseTexture");
}


public override void OnInspectorGUI () {
serObj.Update ();

EditorGUILayout.LabelField("Simulates camera based motion blur", EditorStyles.miniLabel);

EditorGUILayout.PropertyField (filterType, new GUIContent("Technique"));
if (filterType.enumValueIndex == 3 && !(target as CameraMotionBlur).Dx11Support()) {
EditorGUILayout.HelpBox("DX11 mode not supported (need shader model 5)", MessageType.Info);
}
EditorGUILayout.PropertyField (velocityScale, new GUIContent(" Velocity Scale"));
if (filterType.enumValueIndex >= 2) {
EditorGUILayout.LabelField(" Tile size used during reconstruction filter:", EditorStyles.miniLabel);
EditorGUILayout.PropertyField (maxVelocity, new GUIContent(" Velocity Max"));
}
else
EditorGUILayout.PropertyField (maxVelocity, new GUIContent(" Velocity Max"));
EditorGUILayout.PropertyField (minVelocity, new GUIContent(" Velocity Min"));

EditorGUILayout.Separator ();

EditorGUILayout.LabelField("Technique Specific");

if (filterType.enumValueIndex == 0) {
// portal style motion blur
EditorGUILayout.PropertyField (rotationScale, new GUIContent(" Camera Rotation"));
EditorGUILayout.PropertyField (movementScale, new GUIContent(" Camera Movement"));
}
else {
// "plausible" blur or cheap, local blur
EditorGUILayout.PropertyField (excludeLayers, new GUIContent(" Exclude Layers"));
EditorGUILayout.PropertyField (velocityDownsample, new GUIContent(" Velocity Downsample"));
velocityDownsample.intValue = velocityDownsample.intValue < 1 ? 1 : velocityDownsample.intValue;
if (filterType.enumValueIndex >= 2) { // only display jitter for reconstruction
EditorGUILayout.PropertyField (noiseTexture, new GUIContent(" Sample Jitter"));
EditorGUILayout.PropertyField (jitter, new GUIContent(" Jitter Strength"));
}
}

EditorGUILayout.Separator ();

EditorGUILayout.PropertyField (preview, new GUIContent("Preview"));
if (preview.boolValue)
EditorGUILayout.PropertyField (previewScale, new GUIContent(""));

serObj.ApplyModifiedProperties();
}
}
}
@@ -0,0 +1,124 @@
using System;
using UnityEditor;
using UnityEngine;

namespace UnityStandardAssets.ImageEffects
{
[CustomEditor (typeof(ColorCorrectionCurves))]
class ColorCorrectionCurvesEditor : Editor {
SerializedObject serObj;

SerializedProperty mode;

SerializedProperty redChannel;
SerializedProperty greenChannel;
SerializedProperty blueChannel;

SerializedProperty useDepthCorrection;

SerializedProperty depthRedChannel;
SerializedProperty depthGreenChannel;
SerializedProperty depthBlueChannel;

SerializedProperty zCurveChannel;

SerializedProperty saturation;

SerializedProperty selectiveCc;
SerializedProperty selectiveFromColor;
SerializedProperty selectiveToColor;

private bool applyCurveChanges = false;

void OnEnable () {
serObj = new SerializedObject (target);

mode = serObj.FindProperty ("mode");

saturation = serObj.FindProperty ("saturation");

redChannel = serObj.FindProperty ("redChannel");
greenChannel = serObj.FindProperty ("greenChannel");
blueChannel = serObj.FindProperty ("blueChannel");

useDepthCorrection = serObj.FindProperty ("useDepthCorrection");

zCurveChannel = serObj.FindProperty ("zCurve");

depthRedChannel = serObj.FindProperty ("depthRedChannel");
depthGreenChannel = serObj.FindProperty ("depthGreenChannel");
depthBlueChannel = serObj.FindProperty ("depthBlueChannel");

serObj.ApplyModifiedProperties ();

selectiveCc = serObj.FindProperty ("selectiveCc");
selectiveFromColor = serObj.FindProperty ("selectiveFromColor");
selectiveToColor = serObj.FindProperty ("selectiveToColor");
}

void CurveGui ( string name, SerializedProperty animationCurve, Color color) {
// @NOTE: EditorGUILayout.CurveField is buggy and flickers, using PropertyField for now
//animationCurve.animationCurveValue = EditorGUILayout.CurveField (GUIContent (name), animationCurve.animationCurveValue, color, Rect (0.0f,0.0f,1.0f,1.0f));
EditorGUILayout.PropertyField (animationCurve, new GUIContent (name));
if (GUI.changed)
applyCurveChanges = true;
}

void BeginCurves () {
applyCurveChanges = false;
}

void ApplyCurves () {
if (applyCurveChanges) {
serObj.ApplyModifiedProperties ();
(serObj.targetObject as ColorCorrectionCurves).gameObject.SendMessage ("UpdateTextures");
}
}


public override void OnInspectorGUI () {
serObj.Update ();

GUILayout.Label ("Use curves to tweak RGB channel colors", EditorStyles.miniBoldLabel);

saturation.floatValue = EditorGUILayout.Slider( "Saturation", saturation.floatValue, 0.0f, 5.0f);

EditorGUILayout.PropertyField (mode, new GUIContent ("Mode"));
EditorGUILayout.Separator ();

BeginCurves ();

CurveGui (" Red", redChannel, Color.red);
CurveGui (" Green", greenChannel, Color.green);
CurveGui (" Blue", blueChannel, Color.blue);

EditorGUILayout.Separator ();

if (mode.intValue > 0)
useDepthCorrection.boolValue = true;
else
useDepthCorrection.boolValue = false;

if (useDepthCorrection.boolValue) {
CurveGui (" Red (depth)", depthRedChannel, Color.red);
CurveGui (" Green (depth)", depthGreenChannel, Color.green);
CurveGui (" Blue (depth)", depthBlueChannel, Color.blue);
EditorGUILayout.Separator ();
CurveGui (" Blend Curve", zCurveChannel, Color.grey);
}

EditorGUILayout.Separator ();
EditorGUILayout.PropertyField (selectiveCc, new GUIContent ("Selective"));
if (selectiveCc.boolValue) {
EditorGUILayout.PropertyField (selectiveFromColor, new GUIContent (" Key"));
EditorGUILayout.PropertyField (selectiveToColor, new GUIContent (" Target"));
}


ApplyCurves ();

if (!applyCurveChanges)
serObj.ApplyModifiedProperties ();
}
}
}
@@ -0,0 +1,90 @@
using System;
using UnityEditor;
using UnityEngine;

namespace UnityStandardAssets.ImageEffects
{
[CustomEditor (typeof(ColorCorrectionLookup))]
class ColorCorrectionLookupEditor : Editor
{
SerializedObject serObj;

void OnEnable () {
serObj = new SerializedObject (target);
}

private Texture2D tempClutTex2D;


public override void OnInspectorGUI () {
serObj.Update ();

EditorGUILayout.LabelField("Converts textures into color lookup volumes (for grading)", EditorStyles.miniLabel);

//EditorGUILayout.LabelField("Change Lookup Texture (LUT):");
//EditorGUILayout.BeginHorizontal ();
//Rect r = GUILayoutUtility.GetAspectRect(1.0ff);

Rect r; Texture2D t;

//EditorGUILayout.Space();
tempClutTex2D = EditorGUILayout.ObjectField (" Based on", tempClutTex2D, typeof(Texture2D), false) as Texture2D;
if (tempClutTex2D == null) {
t = AssetDatabase.LoadMainAssetAtPath(((ColorCorrectionLookup)target).basedOnTempTex) as Texture2D;
if (t) tempClutTex2D = t;
}

Texture2D tex = tempClutTex2D;

if (tex && (target as ColorCorrectionLookup).basedOnTempTex != AssetDatabase.GetAssetPath(tex))
{
EditorGUILayout.Separator();
if (!(target as ColorCorrectionLookup).ValidDimensions(tex))
{
EditorGUILayout.HelpBox ("Invalid texture dimensions!\nPick another texture or adjust dimension to e.g. 256x16.", MessageType.Warning);
}
else if (GUILayout.Button ("Convert and Apply"))
{
string path = AssetDatabase.GetAssetPath (tex);
TextureImporter textureImporter = AssetImporter.GetAtPath(path) as TextureImporter;
bool doImport = textureImporter.isReadable == false;
if (textureImporter.mipmapEnabled == true) {
doImport = true;
}
if (textureImporter.textureFormat != TextureImporterFormat.AutomaticTruecolor) {
doImport = true;
}

if (doImport)
{
textureImporter.isReadable = true;
textureImporter.mipmapEnabled = false;
textureImporter.textureFormat = TextureImporterFormat.AutomaticTruecolor;
AssetDatabase.ImportAsset (path, ImportAssetOptions.ForceUpdate);
//tex = AssetDatabase.LoadMainAssetAtPath(path);
}

(target as ColorCorrectionLookup).Convert(tex, path);
}
}

if ((target as ColorCorrectionLookup).basedOnTempTex != "")
{
EditorGUILayout.HelpBox("Using " + (target as ColorCorrectionLookup).basedOnTempTex, MessageType.Info);
t = AssetDatabase.LoadMainAssetAtPath(((ColorCorrectionLookup)target).basedOnTempTex) as Texture2D;
if (t) {
r = GUILayoutUtility.GetLastRect();
r = GUILayoutUtility.GetRect(r.width, 20);
r.x += r.width * 0.05f/2.0f;
r.width *= 0.95f;
GUI.DrawTexture (r, t);
GUILayoutUtility.GetRect(r.width, 4);
}
}

//EditorGUILayout.EndHorizontal ();

serObj.ApplyModifiedProperties();
}
}
}
@@ -0,0 +1,149 @@
using System;
using UnityEditor;
using UnityEngine;

namespace UnityStandardAssets.ImageEffects
{
[CustomEditor (typeof(DepthOfFieldDeprecated))]
class DepthOfFieldDeprecatedEditor : Editor
{
SerializedObject serObj;

SerializedProperty simpleTweakMode;

SerializedProperty focalPoint;
SerializedProperty smoothness;

SerializedProperty focalSize;

SerializedProperty focalZDistance;
SerializedProperty focalStartCurve;
SerializedProperty focalEndCurve;

SerializedProperty visualizeCoc;

SerializedProperty resolution;
SerializedProperty quality;

SerializedProperty objectFocus;

SerializedProperty bokeh;
SerializedProperty bokehScale;
SerializedProperty bokehIntensity;
SerializedProperty bokehThresholdLuminance;
SerializedProperty bokehThresholdContrast;
SerializedProperty bokehDownsample;
SerializedProperty bokehTexture;
SerializedProperty bokehDestination;

SerializedProperty bluriness;
SerializedProperty maxBlurSpread;
SerializedProperty foregroundBlurExtrude;

void OnEnable () {
serObj = new SerializedObject (target);

simpleTweakMode = serObj.FindProperty ("simpleTweakMode");

// simple tweak mode
focalPoint = serObj.FindProperty ("focalPoint");
smoothness = serObj.FindProperty ("smoothness");

// complex tweak mode
focalZDistance = serObj.FindProperty ("focalZDistance");
focalStartCurve = serObj.FindProperty ("focalZStartCurve");
focalEndCurve = serObj.FindProperty ("focalZEndCurve");
focalSize = serObj.FindProperty ("focalSize");

visualizeCoc = serObj.FindProperty ("visualize");

objectFocus = serObj.FindProperty ("objectFocus");

resolution = serObj.FindProperty ("resolution");
quality = serObj.FindProperty ("quality");
bokehThresholdContrast = serObj.FindProperty ("bokehThresholdContrast");
bokehThresholdLuminance = serObj.FindProperty ("bokehThresholdLuminance");

bokeh = serObj.FindProperty ("bokeh");
bokehScale = serObj.FindProperty ("bokehScale");
bokehIntensity = serObj.FindProperty ("bokehIntensity");
bokehDownsample = serObj.FindProperty ("bokehDownsample");
bokehTexture = serObj.FindProperty ("bokehTexture");
bokehDestination = serObj.FindProperty ("bokehDestination");

bluriness = serObj.FindProperty ("bluriness");
maxBlurSpread = serObj.FindProperty ("maxBlurSpread");
foregroundBlurExtrude = serObj.FindProperty ("foregroundBlurExtrude");
}


public override void OnInspectorGUI () {
serObj.Update ();

GameObject go = (target as DepthOfFieldDeprecated).gameObject;

if (!go)
return;

if (!go.GetComponent<Camera>())
return;

if (simpleTweakMode.boolValue)
GUILayout.Label ("Current: "+go.GetComponent<Camera>().name+", near "+go.GetComponent<Camera>().nearClipPlane+", far: "+go.GetComponent<Camera>().farClipPlane+", focal: "+focalPoint.floatValue, EditorStyles.miniBoldLabel);
else
GUILayout.Label ("Current: "+go.GetComponent<Camera>().name+", near "+go.GetComponent<Camera>().nearClipPlane+", far: "+go.GetComponent<Camera>().farClipPlane+", focal: "+focalZDistance.floatValue, EditorStyles.miniBoldLabel);

EditorGUILayout.PropertyField (resolution, new GUIContent("Resolution"));
EditorGUILayout.PropertyField (quality, new GUIContent("Quality"));

EditorGUILayout.PropertyField (simpleTweakMode, new GUIContent("Simple tweak"));
EditorGUILayout.PropertyField (visualizeCoc, new GUIContent("Visualize focus"));
EditorGUILayout.PropertyField (bokeh, new GUIContent("Enable bokeh"));


EditorGUILayout.Separator ();

GUILayout.Label ("Focal Settings", EditorStyles.boldLabel);

if (simpleTweakMode.boolValue) {
focalPoint.floatValue = EditorGUILayout.Slider ("Focal distance", focalPoint.floatValue, go.GetComponent<Camera>().nearClipPlane, go.GetComponent<Camera>().farClipPlane);
EditorGUILayout.PropertyField (objectFocus, new GUIContent("Transform"));
EditorGUILayout.PropertyField (smoothness, new GUIContent("Smoothness"));
focalSize.floatValue = EditorGUILayout.Slider ("Focal size", focalSize.floatValue, 0.0f, (go.GetComponent<Camera>().farClipPlane - go.GetComponent<Camera>().nearClipPlane));
}
else {
focalZDistance.floatValue = EditorGUILayout.Slider ("Distance", focalZDistance.floatValue, go.GetComponent<Camera>().nearClipPlane, go.GetComponent<Camera>().farClipPlane);
EditorGUILayout.PropertyField (objectFocus, new GUIContent("Transform"));
focalSize.floatValue = EditorGUILayout.Slider ("Size", focalSize.floatValue, 0.0f, (go.GetComponent<Camera>().farClipPlane - go.GetComponent<Camera>().nearClipPlane));
focalStartCurve.floatValue = EditorGUILayout.Slider ("Start curve", focalStartCurve.floatValue, 0.05f, 20.0f);
focalEndCurve.floatValue = EditorGUILayout.Slider ("End curve", focalEndCurve.floatValue, 0.05f, 20.0f);
}

EditorGUILayout.Separator ();

GUILayout.Label ("Blur (Fore- and Background)", EditorStyles.boldLabel);
EditorGUILayout.PropertyField (bluriness, new GUIContent("Blurriness"));
EditorGUILayout.PropertyField (maxBlurSpread, new GUIContent("Blur spread"));

if (quality.enumValueIndex > 0) {
EditorGUILayout.PropertyField (foregroundBlurExtrude, new GUIContent("Foreground size"));
}

EditorGUILayout.Separator ();

if (bokeh.boolValue) {
EditorGUILayout.Separator ();
GUILayout.Label ("Bokeh Settings", EditorStyles.boldLabel);
EditorGUILayout.PropertyField (bokehDestination, new GUIContent("Destination"));
bokehIntensity.floatValue = EditorGUILayout.Slider ("Intensity", bokehIntensity.floatValue, 0.0f, 1.0f);
bokehThresholdLuminance.floatValue = EditorGUILayout.Slider ("Min luminance", bokehThresholdLuminance.floatValue, 0.0f, 0.99f);
bokehThresholdContrast.floatValue = EditorGUILayout.Slider ("Min contrast", bokehThresholdContrast.floatValue, 0.0f, 0.25f);
bokehDownsample.intValue = EditorGUILayout.IntSlider ("Downsample", bokehDownsample.intValue, 1, 3);
bokehScale.floatValue = EditorGUILayout.Slider ("Size scale", bokehScale.floatValue, 0.0f, 20.0f);
EditorGUILayout.PropertyField (bokehTexture , new GUIContent("Texture mask"));
}

serObj.ApplyModifiedProperties();
}
}
}
@@ -0,0 +1,103 @@
using System;
using UnityEditor;
using UnityEngine;

namespace UnityStandardAssets.ImageEffects
{
[CustomEditor (typeof(DepthOfField))]
class DepthOfFieldEditor : Editor
{
SerializedObject serObj;

SerializedProperty visualizeFocus;
SerializedProperty focalLength;
SerializedProperty focalSize;
SerializedProperty aperture;
SerializedProperty focalTransform;
SerializedProperty maxBlurSize;
SerializedProperty highResolution;

SerializedProperty blurType;
SerializedProperty blurSampleCount;

SerializedProperty nearBlur;
SerializedProperty foregroundOverlap;

SerializedProperty dx11BokehThreshold;
SerializedProperty dx11SpawnHeuristic;
SerializedProperty dx11BokehTexture;
SerializedProperty dx11BokehScale;
SerializedProperty dx11BokehIntensity;

void OnEnable () {
serObj = new SerializedObject (target);

visualizeFocus = serObj.FindProperty ("visualizeFocus");

focalLength = serObj.FindProperty ("focalLength");
focalSize = serObj.FindProperty ("focalSize");
aperture = serObj.FindProperty ("aperture");
focalTransform = serObj.FindProperty ("focalTransform");
maxBlurSize = serObj.FindProperty ("maxBlurSize");
highResolution = serObj.FindProperty ("highResolution");

blurType = serObj.FindProperty ("blurType");
blurSampleCount = serObj.FindProperty ("blurSampleCount");

nearBlur = serObj.FindProperty ("nearBlur");
foregroundOverlap = serObj.FindProperty ("foregroundOverlap");

dx11BokehThreshold = serObj.FindProperty ("dx11BokehThreshold");
dx11SpawnHeuristic = serObj.FindProperty ("dx11SpawnHeuristic");
dx11BokehTexture = serObj.FindProperty ("dx11BokehTexture");
dx11BokehScale = serObj.FindProperty ("dx11BokehScale");
dx11BokehIntensity = serObj.FindProperty ("dx11BokehIntensity");
}


public override void OnInspectorGUI () {
serObj.Update ();

EditorGUILayout.LabelField("Simulates camera lens defocus", EditorStyles.miniLabel);

GUILayout.Label ("Focal Settings");
EditorGUILayout.PropertyField (visualizeFocus, new GUIContent(" Visualize"));
EditorGUILayout.PropertyField (focalLength, new GUIContent(" Focal Distance"));
EditorGUILayout.PropertyField (focalSize, new GUIContent(" Focal Size"));
EditorGUILayout.PropertyField (focalTransform, new GUIContent(" Focus on Transform"));
EditorGUILayout.PropertyField (aperture, new GUIContent(" Aperture"));

EditorGUILayout.Separator ();

EditorGUILayout.PropertyField (blurType, new GUIContent("Defocus Type"));

if (!(target as DepthOfField).Dx11Support() && blurType.enumValueIndex>0) {
EditorGUILayout.HelpBox("DX11 mode not supported (need shader model 5)", MessageType.Info);
}

if (blurType.enumValueIndex<1)
EditorGUILayout.PropertyField (blurSampleCount, new GUIContent(" Sample Count"));

EditorGUILayout.PropertyField (maxBlurSize, new GUIContent(" Max Blur Distance"));
EditorGUILayout.PropertyField (highResolution, new GUIContent(" High Resolution"));

EditorGUILayout.Separator ();

EditorGUILayout.PropertyField (nearBlur, new GUIContent("Near Blur"));
EditorGUILayout.PropertyField (foregroundOverlap, new GUIContent(" Overlap Size"));

EditorGUILayout.Separator ();

if (blurType.enumValueIndex>0) {
GUILayout.Label ("DX11 Bokeh Settings");
EditorGUILayout.PropertyField (dx11BokehTexture, new GUIContent(" Bokeh Texture"));
EditorGUILayout.PropertyField (dx11BokehScale, new GUIContent(" Bokeh Scale"));
EditorGUILayout.PropertyField (dx11BokehIntensity, new GUIContent(" Bokeh Intensity"));
EditorGUILayout.PropertyField (dx11BokehThreshold, new GUIContent(" Min Luminance"));
EditorGUILayout.PropertyField (dx11SpawnHeuristic, new GUIContent(" Spawn Heuristic"));
}

serObj.ApplyModifiedProperties();
}
}
}
@@ -0,0 +1,72 @@
using System;
using UnityEditor;
using UnityEngine;

namespace UnityStandardAssets.ImageEffects
{
[CustomEditor (typeof(EdgeDetection))]
class EdgeDetectionEditor : Editor
{
SerializedObject serObj;

SerializedProperty mode;
SerializedProperty sensitivityDepth;
SerializedProperty sensitivityNormals;

SerializedProperty lumThreshhold;

SerializedProperty edgesOnly;
SerializedProperty edgesOnlyBgColor;

SerializedProperty edgeExp;
SerializedProperty sampleDist;


void OnEnable () {
serObj = new SerializedObject (target);

mode = serObj.FindProperty("mode");

sensitivityDepth = serObj.FindProperty("sensitivityDepth");
sensitivityNormals = serObj.FindProperty("sensitivityNormals");

lumThreshhold = serObj.FindProperty("lumThreshhold");

edgesOnly = serObj.FindProperty("edgesOnly");
edgesOnlyBgColor = serObj.FindProperty("edgesOnlyBgColor");

edgeExp = serObj.FindProperty("edgeExp");
sampleDist = serObj.FindProperty("sampleDist");
}


public override void OnInspectorGUI () {
serObj.Update ();

GUILayout.Label("Detects spatial differences and converts into black outlines", EditorStyles.miniBoldLabel);
EditorGUILayout.PropertyField (mode, new GUIContent("Mode"));

if (mode.intValue < 2) {
EditorGUILayout.PropertyField (sensitivityDepth, new GUIContent(" Depth Sensitivity"));
EditorGUILayout.PropertyField (sensitivityNormals, new GUIContent(" Normals Sensitivity"));
}
else if (mode.intValue < 4) {
EditorGUILayout.PropertyField (edgeExp, new GUIContent(" Edge Exponent"));
}
else {
// lum based mode
EditorGUILayout.PropertyField (lumThreshhold, new GUIContent(" Luminance Threshold"));
}

EditorGUILayout.PropertyField (sampleDist, new GUIContent(" Sample Distance"));

EditorGUILayout.Separator ();

GUILayout.Label ("Background Options");
edgesOnly.floatValue = EditorGUILayout.Slider (" Edges only", edgesOnly.floatValue, 0.0f, 1.0f);
EditorGUILayout.PropertyField (edgesOnlyBgColor, new GUIContent (" Color"));

serObj.ApplyModifiedProperties();
}
}
}
@@ -0,0 +1,111 @@
using System;
using UnityEditor;
using UnityEngine;

namespace UnityStandardAssets.ImageEffects
{
[CustomEditor (typeof( NoiseAndGrain))]
class NoiseAndGrainEditor : Editor
{
SerializedObject serObj;

SerializedProperty intensityMultiplier;
SerializedProperty generalIntensity;
SerializedProperty blackIntensity;
SerializedProperty whiteIntensity;
SerializedProperty midGrey;

SerializedProperty dx11Grain;
SerializedProperty softness;
SerializedProperty monochrome;

SerializedProperty intensities;
SerializedProperty tiling;
SerializedProperty monochromeTiling;

SerializedProperty noiseTexture;
SerializedProperty filterMode;

void OnEnable () {
serObj = new SerializedObject (target);

intensityMultiplier = serObj.FindProperty("intensityMultiplier");
generalIntensity = serObj.FindProperty("generalIntensity");
blackIntensity = serObj.FindProperty("blackIntensity");
whiteIntensity = serObj.FindProperty("whiteIntensity");
midGrey = serObj.FindProperty("midGrey");

dx11Grain = serObj.FindProperty("dx11Grain");
softness = serObj.FindProperty("softness");
monochrome = serObj.FindProperty("monochrome");

intensities = serObj.FindProperty("intensities");
tiling = serObj.FindProperty("tiling");
monochromeTiling = serObj.FindProperty("monochromeTiling");

noiseTexture = serObj.FindProperty("noiseTexture");
filterMode = serObj.FindProperty("filterMode");
}


public override void OnInspectorGUI () {
serObj.Update();

EditorGUILayout.LabelField("Overlays animated noise patterns", EditorStyles.miniLabel);

EditorGUILayout.PropertyField(dx11Grain, new GUIContent("DirectX 11 Grain"));

if (dx11Grain.boolValue && !(target as NoiseAndGrain).Dx11Support()) {
EditorGUILayout.HelpBox("DX11 mode not supported (need DX11 GPU and enable DX11 in PlayerSettings)", MessageType.Info);
}

EditorGUILayout.PropertyField(monochrome, new GUIContent("Monochrome"));

EditorGUILayout.Separator();

EditorGUILayout.PropertyField(intensityMultiplier, new GUIContent("Intensity Multiplier"));
EditorGUILayout.PropertyField(generalIntensity, new GUIContent(" General"));
EditorGUILayout.PropertyField(blackIntensity, new GUIContent(" Black Boost"));
EditorGUILayout.PropertyField(whiteIntensity, new GUIContent(" White Boost"));
midGrey.floatValue = EditorGUILayout.Slider( new GUIContent(" Mid Grey (for Boost)"), midGrey.floatValue, 0.0f, 1.0f);
if (monochrome.boolValue == false) {
Color c = new Color(intensities.vector3Value.x,intensities.vector3Value.y,intensities.vector3Value.z,1.0f);
c = EditorGUILayout.ColorField(new GUIContent(" Color Weights"), c);
intensities.vector3Value = new Vector3(c.r, c.g, c.b);
}

if (!dx11Grain.boolValue) {
EditorGUILayout.Separator();

EditorGUILayout.LabelField("Noise Shape");
EditorGUILayout.PropertyField(noiseTexture, new GUIContent(" Texture"));
EditorGUILayout.PropertyField(filterMode, new GUIContent(" Filter"));
}
else {
EditorGUILayout.Separator();
EditorGUILayout.LabelField("Noise Shape");
}

softness.floatValue = EditorGUILayout.Slider( new GUIContent(" Softness"),softness.floatValue, 0.0f, 0.99f);

if (!dx11Grain.boolValue) {
EditorGUILayout.Separator();
EditorGUILayout.LabelField("Advanced");

if (monochrome.boolValue == false)
{
Vector3 temp = tiling.vector3Value;
temp.x = EditorGUILayout.FloatField(new GUIContent(" Tiling (Red)"), tiling.vector3Value.x);
temp.y = EditorGUILayout.FloatField(new GUIContent(" Tiling (Green)"), tiling.vector3Value.y);
temp.z = EditorGUILayout.FloatField(new GUIContent(" Tiling (Blue)"), tiling.vector3Value.z);
tiling.vector3Value = temp;
}
else {
EditorGUILayout.PropertyField(monochromeTiling, new GUIContent(" Tiling"));
}
}

serObj.ApplyModifiedProperties();
}
}
}
@@ -0,0 +1,105 @@
using System;
using UnityEditor;
using UnityEngine;

namespace UnityStandardAssets.ImageEffects
{
[CustomEditor (typeof(SunShafts))]
class SunShaftsEditor : Editor
{
SerializedObject serObj;

SerializedProperty sunTransform;
SerializedProperty radialBlurIterations;
SerializedProperty sunColor;
SerializedProperty sunThreshold;
SerializedProperty sunShaftBlurRadius;
SerializedProperty sunShaftIntensity;
SerializedProperty useDepthTexture;
SerializedProperty resolution;
SerializedProperty screenBlendMode;
SerializedProperty maxRadius;

void OnEnable () {
serObj = new SerializedObject (target);

screenBlendMode = serObj.FindProperty("screenBlendMode");

sunTransform = serObj.FindProperty("sunTransform");
sunColor = serObj.FindProperty("sunColor");
sunThreshold = serObj.FindProperty("sunThreshold");

sunShaftBlurRadius = serObj.FindProperty("sunShaftBlurRadius");
radialBlurIterations = serObj.FindProperty("radialBlurIterations");

sunShaftIntensity = serObj.FindProperty("sunShaftIntensity");

resolution = serObj.FindProperty("resolution");

maxRadius = serObj.FindProperty("maxRadius");

useDepthTexture = serObj.FindProperty("useDepthTexture");
}


public override void OnInspectorGUI () {
serObj.Update ();

EditorGUILayout.BeginHorizontal();

EditorGUILayout.PropertyField (useDepthTexture, new GUIContent ("Rely on Z Buffer?"));
if ((target as SunShafts).GetComponent<Camera>())
GUILayout.Label("Current camera mode: "+ (target as SunShafts).GetComponent<Camera>().depthTextureMode, EditorStyles.miniBoldLabel);

EditorGUILayout.EndHorizontal();

// depth buffer need
/*
bool newVal = useDepthTexture.boolValue;
if (newVal != oldVal) {
if (newVal)
(target as SunShafts).camera.depthTextureMode |= DepthTextureMode.Depth;
else
(target as SunShafts).camera.depthTextureMode &= ~DepthTextureMode.Depth;
}
*/

EditorGUILayout.PropertyField (resolution, new GUIContent("Resolution"));
EditorGUILayout.PropertyField (screenBlendMode, new GUIContent("Blend mode"));

EditorGUILayout.Separator ();

EditorGUILayout.BeginHorizontal();

EditorGUILayout.PropertyField (sunTransform, new GUIContent("Shafts caster", "Chose a transform that acts as a root point for the produced sun shafts"));
if ((target as SunShafts).sunTransform && (target as SunShafts).GetComponent<Camera>()) {
if (GUILayout.Button("Center on " + (target as SunShafts).GetComponent<Camera>().name)) {
if (EditorUtility.DisplayDialog ("Move sun shafts source?", "The SunShafts caster named "+ (target as SunShafts).sunTransform.name +"\n will be centered along "+(target as SunShafts).GetComponent<Camera>().name+". Are you sure? ", "Please do", "Don't")) {
Ray ray = (target as SunShafts).GetComponent<Camera>().ViewportPointToRay(new Vector3(0.5f,0.5f,0));
(target as SunShafts).sunTransform.position = ray.origin + ray.direction * 500.0f;
(target as SunShafts).sunTransform.LookAt ((target as SunShafts).transform);
}
}
}

EditorGUILayout.EndHorizontal();

EditorGUILayout.Separator ();

EditorGUILayout.PropertyField (sunThreshold, new GUIContent ("Threshold color"));
EditorGUILayout.PropertyField (sunColor, new GUIContent ("Shafts color"));
maxRadius.floatValue = 1.0f - EditorGUILayout.Slider ("Distance falloff", 1.0f - maxRadius.floatValue, 0.1f, 1.0f);

EditorGUILayout.Separator ();

sunShaftBlurRadius.floatValue = EditorGUILayout.Slider ("Blur size", sunShaftBlurRadius.floatValue, 1.0f, 10.0f);
radialBlurIterations.intValue = EditorGUILayout.IntSlider ("Blur iterations", radialBlurIterations.intValue, 1, 3);

EditorGUILayout.Separator ();

EditorGUILayout.PropertyField (sunShaftIntensity, new GUIContent("Intensity"));

serObj.ApplyModifiedProperties();
}
}
}
@@ -0,0 +1,81 @@
using System;
using UnityEditor;
using UnityEngine;

namespace UnityStandardAssets.ImageEffects
{
[CustomEditor (typeof(Tonemapping))]
class TonemappingEditor : Editor
{
SerializedObject serObj;

SerializedProperty type;

// CURVE specific parameter
SerializedProperty remapCurve;

SerializedProperty exposureAdjustment;

// REINHARD specific parameter
SerializedProperty middleGrey;
SerializedProperty white;
SerializedProperty adaptionSpeed;
SerializedProperty adaptiveTextureSize;

void OnEnable () {
serObj = new SerializedObject (target);

type = serObj.FindProperty ("type");
remapCurve = serObj.FindProperty ("remapCurve");
exposureAdjustment = serObj.FindProperty ("exposureAdjustment");
middleGrey = serObj.FindProperty ("middleGrey");
white = serObj.FindProperty ("white");
adaptionSpeed = serObj.FindProperty ("adaptionSpeed");
adaptiveTextureSize = serObj.FindProperty("adaptiveTextureSize");
}


public override void OnInspectorGUI () {
serObj.Update ();

GUILayout.Label("Mapping HDR to LDR ranges since 1982", EditorStyles.miniLabel);

Camera cam = (target as Tonemapping).GetComponent<Camera>();
if (cam != null) {
if (!cam.hdr) {
EditorGUILayout.HelpBox("The camera is not HDR enabled. This will likely break the Tonemapper.", MessageType.Warning);
}
else if (!(target as Tonemapping).validRenderTextureFormat) {
EditorGUILayout.HelpBox("The input to Tonemapper is not in HDR. Make sure that all effects prior to this are executed in HDR.", MessageType.Warning);
}
}

EditorGUILayout.PropertyField (type, new GUIContent ("Technique"));

if (type.enumValueIndex == (int) Tonemapping.TonemapperType.UserCurve) {
EditorGUILayout.PropertyField (remapCurve, new GUIContent ("Remap curve", "Specify the mapping of luminances yourself"));
} else if (type.enumValueIndex == (int) Tonemapping.TonemapperType.SimpleReinhard) {
EditorGUILayout.PropertyField (exposureAdjustment, new GUIContent ("Exposure", "Exposure adjustment"));
} else if (type.enumValueIndex == (int) Tonemapping.TonemapperType.Hable) {
EditorGUILayout.PropertyField (exposureAdjustment, new GUIContent ("Exposure", "Exposure adjustment"));
} else if (type.enumValueIndex == (int) Tonemapping.TonemapperType.Photographic) {
EditorGUILayout.PropertyField (exposureAdjustment, new GUIContent ("Exposure", "Exposure adjustment"));
} else if (type.enumValueIndex == (int) Tonemapping.TonemapperType.OptimizedHejiDawson) {
EditorGUILayout.PropertyField (exposureAdjustment, new GUIContent ("Exposure", "Exposure adjustment"));
} else if (type.enumValueIndex == (int) Tonemapping.TonemapperType.AdaptiveReinhard) {
EditorGUILayout.PropertyField (middleGrey, new GUIContent ("Middle grey", "Middle grey defines the average luminance thus brightening or darkening the entire image."));
EditorGUILayout.PropertyField (white, new GUIContent ("White", "Smallest luminance value that will be mapped to white"));
EditorGUILayout.PropertyField (adaptionSpeed, new GUIContent ("Adaption Speed", "Speed modifier for the automatic adaption"));
EditorGUILayout.PropertyField (adaptiveTextureSize, new GUIContent ("Texture size", "Defines the amount of downsamples needed."));
} else if (type.enumValueIndex == (int) Tonemapping.TonemapperType.AdaptiveReinhardAutoWhite) {
EditorGUILayout.PropertyField (middleGrey, new GUIContent ("Middle grey", "Middle grey defines the average luminance thus brightening or darkening the entire image."));
EditorGUILayout.PropertyField (adaptionSpeed, new GUIContent ("Adaption Speed", "Speed modifier for the automatic adaption"));
EditorGUILayout.PropertyField (adaptiveTextureSize, new GUIContent ("Texture size", "Defines the amount of downsamples needed."));
}

GUILayout.Label("All following effects will use LDR color buffers", EditorStyles.miniBoldLabel);

serObj.ApplyModifiedProperties();
}
}
}
@@ -0,0 +1,62 @@
using System;
using UnityEditor;
using UnityEngine;

namespace UnityStandardAssets.ImageEffects
{
[CustomEditor (typeof(VignetteAndChromaticAberration))]
class VignetteAndChromaticAberrationEditor : Editor
{
private SerializedObject m_SerObj;
private SerializedProperty m_Mode;
private SerializedProperty m_Intensity; // intensity == 0 disables pre pass (optimization)
private SerializedProperty m_ChromaticAberration;
private SerializedProperty m_AxialAberration;
private SerializedProperty m_Blur; // blur == 0 disables blur pass (optimization)
private SerializedProperty m_BlurSpread;
private SerializedProperty m_BlurDistance;
private SerializedProperty m_LuminanceDependency;


void OnEnable ()
{
m_SerObj = new SerializedObject (target);
m_Mode = m_SerObj.FindProperty ("mode");
m_Intensity = m_SerObj.FindProperty ("intensity");
m_ChromaticAberration = m_SerObj.FindProperty ("chromaticAberration");
m_AxialAberration = m_SerObj.FindProperty ("axialAberration");
m_Blur = m_SerObj.FindProperty ("blur");
m_BlurSpread = m_SerObj.FindProperty ("blurSpread");
m_LuminanceDependency = m_SerObj.FindProperty ("luminanceDependency");
m_BlurDistance = m_SerObj.FindProperty ("blurDistance");
}


public override void OnInspectorGUI ()
{
m_SerObj.Update ();

EditorGUILayout.LabelField("Simulates the common lens artifacts 'Vignette' and 'Aberration'", EditorStyles.miniLabel);

EditorGUILayout.PropertyField (m_Intensity, new GUIContent("Vignetting"));
EditorGUILayout.PropertyField (m_Blur, new GUIContent(" Blurred Corners"));
if (m_Blur.floatValue>0.0f)
EditorGUILayout.PropertyField (m_BlurSpread, new GUIContent(" Blur Distance"));

EditorGUILayout.Separator ();

EditorGUILayout.PropertyField (m_Mode, new GUIContent("Aberration"));
if (m_Mode.intValue>0)
{
EditorGUILayout.PropertyField (m_ChromaticAberration, new GUIContent(" Tangential Aberration"));
EditorGUILayout.PropertyField (m_AxialAberration, new GUIContent(" Axial Aberration"));
m_LuminanceDependency.floatValue = EditorGUILayout.Slider(" Contrast Dependency", m_LuminanceDependency.floatValue, 0.001f, 1.0f);
m_BlurDistance.floatValue = EditorGUILayout.Slider(" Blur Distance", m_BlurDistance.floatValue, 0.001f, 5.0f);
}
else
EditorGUILayout.PropertyField (m_ChromaticAberration, new GUIContent(" Chromatic Aberration"));

m_SerObj.ApplyModifiedProperties();
}
}
}
@@ -1,21 +1,102 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class GameplayState
{
GameObject mPUResource;

float mPUTimer = 0.0f;

public GameObject mPlayerOneGO;
public GameObject mPlayerTwoGO;
public GameObject mPlayerThreeGO;
public GameObject mPlayerFourGO;

public PlayerController mPlayerOnePC;
public PlayerController mPlayerTwoPC;
public PlayerController mPlayerThreePC;
public PlayerController mPlayerFourPC;

public GameplayState()
{

mPUResource = Resources.Load<GameObject>("powerup");
}

// Use this for initialization
void Start () {

public void Start ()
{
mPlayerOneGO = GameObject.Instantiate(Resources.Load<GameObject>("sherman_tiger"));
mPlayerOnePC = mPlayerOneGO.GetComponent<PlayerController>();
mPlayerOnePC.SetPlayerTag("Player1");
mPlayerOnePC.m_playerName = "One";

mPlayerTwoGO = GameObject.Instantiate(Resources.Load<GameObject>("sherman_tiger"));
mPlayerTwoPC = mPlayerTwoGO.GetComponent<PlayerController>();
mPlayerTwoPC.SetPlayerTag("Player2");
mPlayerTwoPC.m_playerName = "Two";

mPlayerThreeGO = GameObject.Instantiate(Resources.Load<GameObject>("sherman_tiger"));
mPlayerThreePC = mPlayerThreeGO.GetComponent<PlayerController>();
mPlayerThreePC.SetPlayerTag("Player3");
mPlayerThreePC.m_playerName = "Three";

mPlayerFourGO = GameObject.Instantiate(Resources.Load<GameObject>("sherman_tiger"));
mPlayerFourPC = mPlayerFourGO.GetComponent<PlayerController>();
mPlayerFourPC.SetPlayerTag("Player4");
mPlayerFourPC.m_playerName = "Four";
}

// Update is called once per frame
void Update () {

public void Update ()
{
for (int i = 0; i < 4; i++ )
{

}


mPUTimer += Time.deltaTime;

if (mPUTimer >= 2.5f)
{
SpawnPU();
mPUTimer = 0.0f;
}

}

public void SpawnPU()
{
int chance = Random.Range(0, 1000);

if (chance <= 750)
{
GameObject go = GameObject.Instantiate(mPUResource);
SpecialWeapon sw = go.GetComponent<SpecialWeapon>();

int x = Random.Range(-100, 100);
int y = Random.Range(-100, 100);

go.transform.position = new Vector3(x, 40, y);

int wep = Random.Range(0, 3);

if (wep == 0)
{
sw.m_weaponType = SPECIAL_WEAPON.MISSILE;
sw.ammoCount = 1;
}
else if (wep == 1)
{
sw.m_weaponType = SPECIAL_WEAPON.MINE;
sw.ammoCount = 3;
}
else if (wep == 2)
{
sw.m_weaponType = SPECIAL_WEAPON.SPEED_BOOST;
sw.ammoCount = 3;
}
}
}
}
@@ -10,6 +10,7 @@ public class Main : MonoBehaviour
private Vector2 mWorldHalfWidth;

SelectionMenu mSelectionMenu;
GameplayState mGameplayState;

bool mSpawningPlayers;
bool mGameplay;
@@ -19,10 +20,15 @@ void Start ()
{

mSelectionMenu = new SelectionMenu();
mGameplayState = new GameplayState();

SetupWorld();
SetupPlayerSpawns();

mSpawningPlayers = true;
mSpawningPlayers = false;
mGameplay = true;

mGameplayState.Start();
}

// Update is called once per frame
@@ -34,7 +40,7 @@ void Update ()
}
else if (mGameplay)
{

mGameplayState.Update();
}
// Keep time.
}
@@ -56,6 +56,9 @@ void Update ()
if (hitColliders[i] != thisCollider)
hitColliders[i].SendMessage("OnTriggerEnter", thisCollider, SendMessageOptions.DontRequireReceiver);

GameObject go = (GameObject)Instantiate(Resources.Load("Nuke"));
go.transform.position = transform.position;

Destroy(gameObject);
}
}
@@ -35,6 +35,9 @@ void Explode()
hitColliders[i].SendMessage("OnTriggerEnter", thisCollider, SendMessageOptions.DontRequireReceiver);
}

GameObject go = (GameObject)Instantiate(Resources.Load("Nuke"));
go.transform.position = transform.position;

Destroy(gameObject);
}

@@ -0,0 +1,15 @@
using UnityEngine;
using System.Collections;

public class PSAutoDestroy : MonoBehaviour {

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {

}
}
Binary file not shown.
@@ -43,7 +43,7 @@ public class PlayerController : MonoBehaviour

public Vector3 m_contactPoint;

public int m_lives = 10;
public int m_score = 0;

private Vector3 m_startPos;
private Quaternion m_startRot;
@@ -132,14 +132,14 @@ public void ResetMe()

m_dead = false;

m_lives--;
m_score--;
}

// Update is called once per frame
void Update ()
{
//UR DED LOL
if (m_dead && Input.GetButtonDown("RBumper_Player" + m_playerName))
if (m_dead && Input.GetButtonDown("Start_Player" + m_playerName))
ResetMe();
else if (m_dead)
return;
@@ -173,8 +173,6 @@ void Update ()

gameObject.transform.position += transform.forward * (m_currentSpeed * m_speedBoost) * Time.deltaTime;



if (m_currentSpeed > 0.0f && !m_moved)
m_currentSpeed -= deaccSpeed * Time.deltaTime;
else if (m_currentSpeed < 0.0f && !m_moved)
@@ -191,7 +189,6 @@ void Update ()
if (m_lightTimer <= 0.0f)
m_spotLight.intensity = 0.0f;


}

void Shoot()
@@ -229,7 +226,7 @@ void Shoot()
{
GameObject go = (GameObject)Instantiate(Resources.Load("Missile"));
go.transform.position = transform.position + transform.forward.normalized;

float dist = float.MaxValue;
for (int i = 0; i < m_playerTags.Count; i++)
{
if (m_playerTags[i] != gameObject.tag)
@@ -238,10 +235,12 @@ void Shoot()

if (target != null)
{
Debug.Log(m_playerTags[i]);
Debug.Log(gameObject.tag);
Missile m = go.GetComponent<Missile>();
m.m_target = target;
if (Vector3.Distance(target.transform.position, transform.position) < dist)
{
dist = Vector3.Distance(target.transform.position, transform.position);
Missile m = go.GetComponent<Missile>();
m.m_target = target;
}
}
}
}
@@ -348,6 +347,9 @@ void OnCollisionEnter(Collision collision)
colliderPC.m_rigidBody.AddExplosionForce(1000.0f, contact.point, 100.0f);
colliderPC.m_turretRB.AddExplosionForce(1000.0f, contact.point, 100.0f);
colliderPC.m_dead = true;

GameObject go = (GameObject)Instantiate(Resources.Load("Explosion"));
go.transform.position = colliderPC.transform.position;
}

}
@@ -368,6 +370,9 @@ public void BounceMe()
m_rigidBody.AddExplosionForce(10000.0f, m_contactPoint, 100.0f);
m_turretRB.AddExplosionForce(10000.0f, m_contactPoint, 100.0f);
m_dead = true;

GameObject go = (GameObject)Instantiate(Resources.Load("Explosion"));
go.transform.position = transform.position;
}

private void MoveTank(float x, float z)

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

@@ -0,0 +1,363 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &112440
GameObject:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 4: {fileID: 493262}
m_Layer: 0
m_Name: transform1
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &128340
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 4: {fileID: 418148}
- 33: {fileID: 3308072}
- 23: {fileID: 2310744}
- 54: {fileID: 5463028}
- 114: {fileID: 11480172}
- 64: {fileID: 6406002}
m_Layer: 0
m_Name: powerup
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &135168
GameObject:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 4: {fileID: 441840}
- 33: {fileID: 3319040}
- 23: {fileID: 2314146}
m_Layer: 0
m_Name: curve3
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &137462
GameObject:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 4: {fileID: 479306}
m_Layer: 0
m_Name: curve2
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &172490
GameObject:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 4: {fileID: 490054}
m_Layer: 0
m_Name: pPlane2
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &181874
GameObject:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 4: {fileID: 492676}
m_Layer: 0
m_Name: pPlane1
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &188488
GameObject:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 4: {fileID: 487660}
m_Layer: 0
m_Name: transform2
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &199458
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 4: {fileID: 451250}
- 95: {fileID: 9590436}
m_Layer: 0
m_Name: parachute
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &418148
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 128340}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 2, y: 2, z: 2}
m_Children:
- {fileID: 451250}
m_Father: {fileID: 0}
m_RootOrder: 0
--- !u!4 &441840
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 135168}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 451250}
m_RootOrder: 1
--- !u!4 &451250
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 199458}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: .291000009, z: 0}
m_LocalScale: {x: 10, y: 10, z: 10}
m_Children:
- {fileID: 479306}
- {fileID: 441840}
- {fileID: 492676}
- {fileID: 490054}
m_Father: {fileID: 418148}
m_RootOrder: 0
--- !u!4 &479306
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 137462}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 4.60674119e-06, y: -.0607358813, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 451250}
m_RootOrder: 0
--- !u!4 &487660
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 188488}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -.000473670952, y: -.0632620379, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 492676}
m_RootOrder: 0
--- !u!4 &490054
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 172490}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: .000473670952, y: .0632620379, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 493262}
m_Father: {fileID: 451250}
m_RootOrder: 3
--- !u!4 &492676
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 181874}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: .000473670952, y: .0632620379, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 487660}
m_Father: {fileID: 451250}
m_RootOrder: 2
--- !u!4 &493262
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 112440}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -.000473670952, y: -.0632620379, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 490054}
m_RootOrder: 0
--- !u!23 &2310744
MeshRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 128340}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_Materials:
- {fileID: 2100000, guid: b593101b9eef33d4e982bc878e2f901b, type: 2}
m_SubsetIndices:
m_StaticBatchRoot: {fileID: 0}
m_UseLightProbes: 1
m_ReflectionProbeUsage: 1
m_ProbeAnchor: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 1
m_ImportantGI: 0
m_AutoUVMaxDistance: .5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingOrder: 0
--- !u!23 &2314146
MeshRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 135168}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_Materials:
- {fileID: 2100000, guid: 80e01190b74d192478e12c80e54708aa, type: 2}
m_SubsetIndices:
m_StaticBatchRoot: {fileID: 0}
m_UseLightProbes: 1
m_ReflectionProbeUsage: 1
m_ProbeAnchor: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_ImportantGI: 0
m_AutoUVMaxDistance: .5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingOrder: 0
--- !u!33 &3308072
MeshFilter:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 128340}
m_Mesh: {fileID: 4300000, guid: cc0f6d907b4f5404097a63923af9d273, type: 3}
--- !u!33 &3319040
MeshFilter:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 135168}
m_Mesh: {fileID: 4300000, guid: 4e47657107e2bf04990a1259cb62902e, type: 3}
--- !u!54 &5463028
Rigidbody:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 128340}
serializedVersion: 2
m_Mass: 1
m_Drag: 0
m_AngularDrag: .0500000007
m_UseGravity: 1
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!64 &6406002
MeshCollider:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 128340}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Convex: 1
m_Mesh: {fileID: 4300000, guid: cc0f6d907b4f5404097a63923af9d273, type: 3}
--- !u!95 &9590436
Animator:
serializedVersion: 3
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 199458}
m_Enabled: 1
m_Avatar: {fileID: 9000000, guid: 4e47657107e2bf04990a1259cb62902e, type: 3}
m_Controller: {fileID: 0}
m_CullingMode: 0
m_UpdateMode: 0
m_ApplyRootMotion: 0
m_LinearVelocityBlending: 0
m_WarningMessage:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
--- !u!114 &11480172
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 128340}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4f92a07749fb9df46b825b50531f09aa, type: 3}
m_Name:
m_EditorClassIdentifier:
m_weaponType: 0
ammoCount: 0
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 128340}
m_IsPrefabParent: 1
@@ -4,11 +4,12 @@
public class SpecialWeapon : MonoBehaviour
{
public SPECIAL_WEAPON m_weaponType;

public int ammoCount;
bool myChildrenAreDEAD = false;
// Use this for initialization
void Start ()
{
m_weaponType = SPECIAL_WEAPON.SPEED_BOOST;
//m_weaponType = SPECIAL_WEAPON.SPEED_BOOST;
}

void OnCollisionEnter(Collision collision)
@@ -19,14 +20,39 @@ void OnCollisionEnter(Collision collision)
|| collision.gameObject.tag == "Player4")
{
PlayerController colliderPC = collision.gameObject.GetComponent<PlayerController>();

if (colliderPC.m_ammoCount > 0)
return;

colliderPC.m_specialWeapon = m_weaponType;
colliderPC.m_ammoCount = 3;
colliderPC.m_ammoCount = ammoCount;

GameObject go;

if (m_weaponType == SPECIAL_WEAPON.MINE)
go = (GameObject)Instantiate(Resources.Load("MinePS"));
else if (m_weaponType == SPECIAL_WEAPON.MISSILE)
go = (GameObject)Instantiate(Resources.Load("MissilePS"));
else
go = (GameObject)Instantiate(Resources.Load("SpeedBoostPS"));

go.transform.position = transform.position + new Vector3(0, 2, 0);

Destroy(gameObject);
}
else
{
if (collision.gameObject.tag == "Ground" && !myChildrenAreDEAD)
{
Destroy(gameObject.transform.FindChild("parachute").gameObject);
myChildrenAreDEAD = true;
}
}
}

// Update is called once per frame
void Update () {
void Update ()
{

}
}
@@ -0,0 +1,32 @@

Importing the CrossPlatformInput package adds a menu item to Unity, "CrossPlatformInput", which allows you to enable or disable the CrossPlatformInput in the editor. You must enable the CrossPlatformInput in order to see the control rigs in the editor, and to start using Unity Remote to control your game.

The CrossPlatformInput sample assets contains two main sections.

1) The folder of prefabs provide a variety of ready-to-use "MobileControlRigs". Each control rig is suitable for a different purpose, and each implements the touch or tilt-based equivalent of some of the default standalone axes or buttons. These are ready to drop into your scene, and to use them you simply need to read the axes via the CrossPlatformInput class, rather than Unity's regular Input class.

2) The set of scripts provided are the scripts we used to put together the control rigs prefabs. They provide a simplified way of reading basic mobile input, such as tilt, taps and swipe gestures. They are designed so that various mobile controls can be read in the same way as regular Unity axes and buttons. You can use these scripts to build your own MobileControlRigs.



For example the Car control rig feeds the tilt input of the mobile device to the "Horizontal" axis, and has an accelerator and brake touch button which are fed as a pair into the "Vertical" axis. These are virtual equivalents of the real "Horizontal" and "Vertical" axes defined in Unity's Input Manager.

Therefore when you read CrossPlatformInput.GetAxis("Horizontal"), you will either get the "real" input value - if your build target is non-mobile, or the value from the mobile control rig - if your build target is set to a mobile platform.

The CrossPlatformInput scripts and prefabs are provided together as an example of how you can implement a cross-platform control solution in Unity. They also allow us to provide our other sample scenes in a form that can be published as standalone or to mobile targets with no modification.

To use the CrossPlatformInput, you need to drop a "Mobile Control Rig" into your scene (or create your own), and then make calls to CrossPlatformInput functions, referring to the axes and buttons that the Rig implements.

When reading input from the CrossPlatformInput class, the values returned will be taken either from Unity's Input Manager settings, or from the mobile-specific controls set up, depending on which build target you have selected.

The CrossPlatformInput class is designed to be called instead of Unity's own Input class, and so mirrors certain parts of the Input API - specifically the functions relating to Axes and Buttons:
GetAxis, GetAxisRaw
GetButton, GetButtonDown, GetButtonUp

Notes for coders:
This package sets two compiler define symbols. One is always set automatically, the other is optionally set from a menu item.

Importing the "CrossPlatformInput" package will automatically add a compiler define symbol, "CROSS_PLATFORM_INPUT". This enables the CrossPlatformInput functions defined in some of the other Sample Asset packages (such as the Characters, Planes, etc). Without this symbol defined, those packages use Unity's regular Input class, which means they can be imported alone and still work without the CrossPlatformInput package.

The optional define (which is set by default, but can be disabled using the "Mobile Input" menu), is "MOBILE_INPUT". This causes the MobileControlRigs to become active when a mobile build target is selected. It also enables certain mobile-specific control nuances in some of the packages, which make more sense when the character or vehicle is being controlled using mobile input (such as auto-leveling the character's look direction). This define is optional because some developers prefer to use standalone input methods instead of the Unity Remote app, when testing mobile apps in the editor's play mode.