备份CatanBuilding瘦身独立工程
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 206ff270d3884e74193a896d61f583c6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,28 @@
|
||||
fileFormatVersion: 2
|
||||
guid: da9a51ce28f0d7443a5bcbdbe04c4f4b
|
||||
TrueTypeFontImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 4
|
||||
fontSize: 16
|
||||
forceTextureCase: -2
|
||||
characterSpacing: 0
|
||||
characterPadding: 1
|
||||
includeFontData: 1
|
||||
fontName: Varela Round
|
||||
fontNames:
|
||||
- Varela Round
|
||||
fallbackFontReferences:
|
||||
- {fileID: 12800000, guid: 9d3d4dd557b981049813477256dc3ce2, type: 3}
|
||||
- {fileID: 12800000, guid: ff571517d53cf074b86d221e07573a65, type: 3}
|
||||
- {fileID: 12800000, guid: 3b7b1439619bf9340bca76d13d88b660, type: 3}
|
||||
- {fileID: 12800000, guid: d54323c94c164de478170d5e7d0273be, type: 3}
|
||||
- {fileID: 12800000, guid: 8d740e6d8d6ead245bde62e484121613, type: 3}
|
||||
- {fileID: 12800000, guid: 7eef45af5c153d24ab577857816f16bc, type: 3}
|
||||
customCharacters:
|
||||
fontRenderingMode: 0
|
||||
ascentCalculationMode: 1
|
||||
useLegacyBoundsCalculation: 0
|
||||
shouldRoundAdvanceValue: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,93 @@
|
||||
Copyright 2011-2016 The Varela Round Project Authors (https://github.com/alefalefalef/Varela-Round-Hebrew/), with Reserved Font Names 'Varela' and ‘Varela Round’.
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 08365a11a49ae6f41ade544399c3da84
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 685ab5efc56b77343985bfc78c17ab5c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,77 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Grid
|
||||
m_Shader: {fileID: 4800000, guid: 0d949f33aae55df4d92d64ec31581556, type: 3}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 2800000, guid: 026cfa8e99aa0914faa770f5d4c58a23, type: 3}
|
||||
m_Scale: {x: 100, y: 100}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- _BumpScale: 1
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 0, g: 0, b: 0, a: 0.5019608}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 41cd2401d126859418d064ea8f4fee8c
|
||||
timeCreated: 1554524255
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,88 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: Skybox
|
||||
m_Shader: {fileID: 4800000, guid: 960aca9aa5d48ad4b8b522dbbab26d8a, type: 3}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 5
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 2800000, guid: 4101ccb8f2386d14c843c54610af1778, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _Tex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- _AtmosphereThickness: 2.79
|
||||
- _BumpScale: 1
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _EmissionScaleUI: 0
|
||||
- _Exposure: 5.94
|
||||
- _Glossiness: 0.5
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _Rotation: 0
|
||||
- _Scale: 0.3
|
||||
- _SrcBlend: 1
|
||||
- _SunSize: 0.295
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _Color1: {r: 0.37800002, g: 0.9999997, b: 1, a: 1}
|
||||
- _Color2: {r: 0, g: 0.17241383, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _EmissionColorUI: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _GroundColor: {r: 0.07586193, g: 0, b: 1, a: 1}
|
||||
- _SkyTint: {r: 1, g: 0, b: 0, a: 1}
|
||||
- _Tint: {r: 0.5, g: 0.5, b: 0.5, a: 0.5}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 17380c24072c0954898ab03528ac9077
|
||||
timeCreated: 1474763489
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8ece9783b3fc55b4f85e26ef1cea10c8
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,122 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace CW.Common
|
||||
{
|
||||
/// <summary>This component allows you to freely rotate the current GameObject using local rotations.</summary>
|
||||
[HelpURL(CwShared.HelpUrlPrefix + "CwCameraLook")]
|
||||
[AddComponentMenu(CwShared.ComponentMenuPrefix + "Camera Look")]
|
||||
public class CwCameraLook : MonoBehaviour
|
||||
{
|
||||
/// <summary>Is this component currently listening for inputs?</summary>
|
||||
public bool Listen { set { listen = value; } get { return listen; } } [SerializeField] private bool listen = true;
|
||||
|
||||
/// <summary>How quickly the rotation transitions from the current to the target value (-1 = instant).</summary>
|
||||
public float Damping { set { damping = value; } get { return damping; } } [SerializeField] private float damping = 10.0f;
|
||||
|
||||
/// <summary>How quickly the mouse/finger movements rotate the camera.</summary>
|
||||
public float Sensitivity { set { sensitivity = value; } get { return sensitivity; } } [SerializeField] private float sensitivity = 1.0f;
|
||||
|
||||
/// <summary>The keys/fingers required to pitch down/up.</summary>
|
||||
public CwInputManager.Axis PitchControls { set { pitchControls = value; } get { return pitchControls; } } [SerializeField] private CwInputManager.Axis pitchControls = new CwInputManager.Axis(1, true, CwInputManager.AxisGesture.VerticalDrag, -10.0f, KeyCode.None, KeyCode.None, KeyCode.None, KeyCode.None, 45.0f);
|
||||
|
||||
/// <summary>The keys/fingers required to yaw left/right.</summary>
|
||||
public CwInputManager.Axis YawControls { set { yawControls = value; } get { return yawControls; } } [SerializeField] private CwInputManager.Axis yawControls = new CwInputManager.Axis(1, true, CwInputManager.AxisGesture.HorizontalDrag, 10.0f, KeyCode.None, KeyCode.None, KeyCode.None, KeyCode.None, 45.0f);
|
||||
|
||||
/// <summary>The keys/fingers required to roll left/right.</summary>
|
||||
public CwInputManager.Axis RollControls { set { rollControls = value; } get { return rollControls; } } [SerializeField] private CwInputManager.Axis rollControls = new CwInputManager.Axis(2, true, CwInputManager.AxisGesture.Twist, 1.0f, KeyCode.E, KeyCode.Q, KeyCode.None, KeyCode.None, 45.0f);
|
||||
|
||||
[System.NonSerialized]
|
||||
private Quaternion remainingDelta = Quaternion.identity;
|
||||
|
||||
protected virtual void Start()
|
||||
{
|
||||
CwInputManager.EnsureThisComponentExists();
|
||||
}
|
||||
|
||||
protected virtual void OnDisable()
|
||||
{
|
||||
//oldMousePositionSet = false;
|
||||
}
|
||||
|
||||
protected virtual void Update()
|
||||
{
|
||||
if (listen == true)
|
||||
{
|
||||
AddToDelta();
|
||||
}
|
||||
|
||||
DampenDelta();
|
||||
}
|
||||
|
||||
protected virtual void OnApplicationFocus(bool focus)
|
||||
{
|
||||
//oldMousePositionSet = false;
|
||||
}
|
||||
|
||||
private void AddToDelta()
|
||||
{
|
||||
// Get delta from binds
|
||||
var delta = default(Vector3);
|
||||
|
||||
delta.x = pitchControls.GetValue(Time.deltaTime);
|
||||
delta.y = yawControls.GetValue(Time.deltaTime);
|
||||
delta.z = rollControls.GetValue(Time.deltaTime);
|
||||
|
||||
delta *= sensitivity;
|
||||
|
||||
// Store old rotation
|
||||
var oldRotation = transform.localRotation;
|
||||
|
||||
// Rotate
|
||||
transform.Rotate(delta.x, delta.y, 0.0f, Space.Self);
|
||||
|
||||
transform.Rotate(0.0f, 0.0f, delta.z, Space.Self);
|
||||
|
||||
// Add to remaining
|
||||
remainingDelta *= Quaternion.Inverse(oldRotation) * transform.localRotation;
|
||||
|
||||
// Revert rotation
|
||||
transform.localRotation = oldRotation;
|
||||
}
|
||||
|
||||
private void DampenDelta()
|
||||
{
|
||||
// Dampen remaining delta
|
||||
var factor = CwHelper.DampenFactor(damping, Time.deltaTime);
|
||||
var newDelta = Quaternion.Slerp(remainingDelta, Quaternion.identity, factor);
|
||||
|
||||
// Rotate by difference
|
||||
transform.localRotation = transform.localRotation * Quaternion.Inverse(newDelta) * remainingDelta;
|
||||
|
||||
// Update remaining
|
||||
remainingDelta = newDelta;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
namespace CW.Common
|
||||
{
|
||||
using UnityEditor;
|
||||
using TARGET = CwCameraLook;
|
||||
|
||||
[CanEditMultipleObjects]
|
||||
[CustomEditor(typeof(TARGET))]
|
||||
public class CwCameraLook_Editor : CwEditor
|
||||
{
|
||||
protected override void OnInspector()
|
||||
{
|
||||
TARGET tgt; TARGET[] tgts; GetTargets(out tgt, out tgts);
|
||||
|
||||
Draw("listen", "Is this component currently listening for inputs?");
|
||||
Draw("damping", "How quickly the rotation transitions from the current to the target value (-1 = instant).");
|
||||
|
||||
Separator();
|
||||
|
||||
Draw("pitchControls", "The keys/fingers required to pitch down/up.");
|
||||
Draw("yawControls", "The keys/fingers required to yaw left/right.");
|
||||
Draw("rollControls", "The keys/fingers required to roll left/right.");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8f6d5316b170fe34e886c05572b3006e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,111 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace CW.Common
|
||||
{
|
||||
/// <summary>This component allows you to freely move the current GameObject based on mouse/finger drags.</summary>
|
||||
[HelpURL(CwShared.HelpUrlPrefix + "CwCameraMove")]
|
||||
[AddComponentMenu(CwShared.ComponentMenuPrefix + "Camera Move")]
|
||||
public class CwCameraMove : MonoBehaviour
|
||||
{
|
||||
/// <summary>Is this component currently listening for inputs?</summary>
|
||||
public bool Listen { set { listen = value; } get { return listen; } } [SerializeField] private bool listen = true;
|
||||
|
||||
/// <summary>How quickly the position transitions from the current to the target value (-1 = instant).</summary>
|
||||
public float Damping { set { damping = value; } get { return damping; } } [SerializeField] private float damping = 10.0f;
|
||||
|
||||
/// <summary>The movement speed will be multiplied by this.</summary>
|
||||
public float Sensitivity { set { sensitivity = value; } get { return sensitivity; } } [SerializeField] private float sensitivity = 1.0f;
|
||||
|
||||
/// <summary>The keys/fingers required to move left/right.</summary>
|
||||
public CwInputManager.Axis HorizontalControls { set { horizontalControls = value; } get { return horizontalControls; } } [SerializeField] private CwInputManager.Axis horizontalControls = new CwInputManager.Axis(2, false, CwInputManager.AxisGesture.HorizontalDrag, 1.0f, KeyCode.A, KeyCode.D, KeyCode.LeftArrow, KeyCode.RightArrow, 100.0f);
|
||||
|
||||
/// <summary>The keys/fingers required to move backward/forward.</summary>
|
||||
public CwInputManager.Axis DepthControls { set { depthControls = value; } get { return depthControls; } } [SerializeField] private CwInputManager.Axis depthControls = new CwInputManager.Axis(2, false, CwInputManager.AxisGesture.HorizontalDrag, 1.0f, KeyCode.S, KeyCode.W, KeyCode.DownArrow, KeyCode.UpArrow, 100.0f);
|
||||
|
||||
/// <summary>The keys/fingers required to move down/up.</summary>
|
||||
public CwInputManager.Axis VerticalControls { set { verticalControls = value; } get { return verticalControls; } } [SerializeField] private CwInputManager.Axis verticalControls = new CwInputManager.Axis(3, false, CwInputManager.AxisGesture.HorizontalDrag, 1.0f, KeyCode.F, KeyCode.R, KeyCode.None, KeyCode.None, 100.0f);
|
||||
|
||||
[System.NonSerialized]
|
||||
private Vector3 remainingDelta;
|
||||
|
||||
protected virtual void Start()
|
||||
{
|
||||
CwInputManager.EnsureThisComponentExists();
|
||||
}
|
||||
|
||||
protected virtual void Update()
|
||||
{
|
||||
if (listen == true)
|
||||
{
|
||||
AddToDelta();
|
||||
}
|
||||
|
||||
DampenDelta();
|
||||
}
|
||||
|
||||
private void AddToDelta()
|
||||
{
|
||||
// Get delta from binds
|
||||
var delta = default(Vector3);
|
||||
|
||||
delta.x = horizontalControls.GetValue(Time.deltaTime);
|
||||
delta.y = verticalControls .GetValue(Time.deltaTime);
|
||||
delta.z = depthControls .GetValue(Time.deltaTime);
|
||||
|
||||
// Store old position
|
||||
var oldPosition = transform.position;
|
||||
|
||||
// Translate
|
||||
transform.Translate(delta * sensitivity * Time.deltaTime, Space.Self);
|
||||
|
||||
// Add to remaining
|
||||
var acceleration = transform.position - oldPosition;
|
||||
|
||||
remainingDelta += acceleration;
|
||||
|
||||
// Revert position
|
||||
transform.position = oldPosition;
|
||||
}
|
||||
|
||||
private void DampenDelta()
|
||||
{
|
||||
// Dampen remaining delta
|
||||
var factor = CwHelper.DampenFactor(damping, Time.deltaTime);
|
||||
var newDelta = Vector3.Lerp(remainingDelta, Vector3.zero, factor);
|
||||
|
||||
// Translate by difference
|
||||
transform.position += remainingDelta - newDelta;
|
||||
|
||||
// Update remaining
|
||||
remainingDelta = newDelta;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
namespace CW.Common
|
||||
{
|
||||
using UnityEditor;
|
||||
using TARGET = CwCameraMove;
|
||||
|
||||
[CanEditMultipleObjects]
|
||||
[CustomEditor(typeof(TARGET))]
|
||||
public class CwCameraMove_Editor : CwEditor
|
||||
{
|
||||
protected override void OnInspector()
|
||||
{
|
||||
TARGET tgt; TARGET[] tgts; GetTargets(out tgt, out tgts);
|
||||
|
||||
Draw("listen", "Is this component currently listening for inputs?");
|
||||
Draw("damping", "How quickly the rotation transitions from the current to the target value (-1 = instant).");
|
||||
Draw("sensitivity", "The movement speed will be multiplied by this.");
|
||||
|
||||
Separator();
|
||||
|
||||
Draw("horizontalControls", "The keys/fingers required to move right/left.");
|
||||
Draw("depthControls", "The keys/fingers required to move backward/forward.");
|
||||
Draw("verticalControls", "The keys/fingers required to move down/up.");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4cabc7c514a17ca41a6c62cc43dcb94d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,93 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace CW.Common
|
||||
{
|
||||
/// <summary>This component allows you to rotate the current GameObject using local Euler rotations, allowing you to create a typical FPS camera system, or orbital camera system.</summary>
|
||||
[HelpURL(CwShared.HelpUrlPrefix + "CwCameraPivot")]
|
||||
[AddComponentMenu(CwShared.ComponentMenuPrefix + "Camera Pivot")]
|
||||
public class CwCameraPivot : MonoBehaviour
|
||||
{
|
||||
/// <summary>Is this component currently listening for inputs?</summary>
|
||||
public bool Listen { set { listen = value; } get { return listen; } } [SerializeField] private bool listen = true;
|
||||
|
||||
/// <summary>How quickly the position transitions from the current to the target value (-1 = instant).</summary>
|
||||
public float Damping { set { damping = value; } get { return damping; } } [SerializeField] private float damping = 10.0f;
|
||||
|
||||
/// <summary>The keys/fingers required to pitch down/up.</summary>
|
||||
public CwInputManager.Axis PitchControls { set { pitchControls = value; } get { return pitchControls; } } [SerializeField] private CwInputManager.Axis pitchControls = new CwInputManager.Axis(1, true, CwInputManager.AxisGesture.VerticalDrag, -0.1f, KeyCode.None, KeyCode.None, KeyCode.None, KeyCode.None, 45.0f);
|
||||
|
||||
/// <summary>The keys/fingers required to yaw left/right.</summary>
|
||||
public CwInputManager.Axis YawControls { set { yawControls = value; } get { return yawControls; } } [SerializeField] private CwInputManager.Axis yawControls = new CwInputManager.Axis(1, true, CwInputManager.AxisGesture.HorizontalDrag, 0.1f, KeyCode.None, KeyCode.None, KeyCode.None, KeyCode.None, 45.0f);
|
||||
|
||||
[System.NonSerialized]
|
||||
private Vector3 remainingDelta;
|
||||
|
||||
protected virtual void OnEnable()
|
||||
{
|
||||
CwInputManager.EnsureThisComponentExists();
|
||||
}
|
||||
|
||||
protected virtual void Update()
|
||||
{
|
||||
if (listen == true)
|
||||
{
|
||||
AddToDelta();
|
||||
}
|
||||
|
||||
DampenDelta();
|
||||
}
|
||||
|
||||
private void AddToDelta()
|
||||
{
|
||||
remainingDelta.x += pitchControls.GetValue(Time.deltaTime);
|
||||
remainingDelta.y += yawControls .GetValue(Time.deltaTime);
|
||||
}
|
||||
|
||||
private void DampenDelta()
|
||||
{
|
||||
// Dampen remaining delta
|
||||
var factor = CwHelper.DampenFactor(damping, Time.deltaTime);
|
||||
var newDelta = Vector3.Lerp(remainingDelta, Vector3.zero, factor);
|
||||
|
||||
// Rotate by difference
|
||||
var euler = transform.localEulerAngles;
|
||||
|
||||
euler.x = -Mathf.DeltaAngle(euler.x, 0.0f);
|
||||
|
||||
euler += remainingDelta - newDelta;
|
||||
|
||||
euler.x = Mathf.Clamp(euler.x, -89.0f, 89.0f);
|
||||
|
||||
transform.localEulerAngles = euler;
|
||||
|
||||
// Update remaining
|
||||
remainingDelta = newDelta;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
namespace CW.Common
|
||||
{
|
||||
using UnityEditor;
|
||||
using TARGET = CwCameraPivot;
|
||||
|
||||
[CanEditMultipleObjects]
|
||||
[CustomEditor(typeof(TARGET))]
|
||||
public class CwCameraPivot_Editor : CwEditor
|
||||
{
|
||||
protected override void OnInspector()
|
||||
{
|
||||
TARGET tgt; TARGET[] tgts; GetTargets(out tgt, out tgts);
|
||||
|
||||
Draw("listen", "Is this component currently listening for inputs?");
|
||||
Draw("damping", "How quickly the rotation transitions from the current to the target value (-1 = instant).");
|
||||
|
||||
Separator();
|
||||
|
||||
Draw("pitchControls", "The keys/fingers required to pitch down/up.");
|
||||
Draw("yawControls", "The keys/fingers required to yaw left/right.");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4c5a919098a173e40a35fd1c493ae39e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,213 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
|
||||
namespace CW.Common
|
||||
{
|
||||
/// <summary>This component is used by all the demo scenes to perform common tasks. Including modifying the current scene to make it look consistent between different rendering pipelines.</summary>
|
||||
[ExecuteInEditMode]
|
||||
[AddComponentMenu("")]
|
||||
public class CwDemo : MonoBehaviour
|
||||
{
|
||||
/// <summary>If you enable this setting and your project is running with the new InputSystem then the <b>EventSystem's InputModule</b> component will be upgraded.</summary>
|
||||
public bool UpgradeInputModule { set { upgradeInputModule = value; } get { return upgradeInputModule; } } [SerializeField] private bool upgradeInputModule = true;
|
||||
|
||||
/// <summary>If you enable this setting and your project is running with HDRP then a <b>Volume</b> component will be added to the scene that adjusts the camera exposure to match the other pipelines.</summary>
|
||||
public bool ChangeExposureInHDRP { set { changeExposureInHDRP = value; } get { return changeExposureInHDRP; } } [SerializeField] private bool changeExposureInHDRP = true;
|
||||
|
||||
/// <summary>If you enable this setting and your project is running with HDRP then a <b>Volume</b> component will be added to the scene that adjusts the background to match the other pipelines.</summary>
|
||||
public bool ChangeVisualEnvironmentInHDRP { set { changeVisualEnvironmentInHDRP = value; } get { return changeVisualEnvironmentInHDRP; } } [SerializeField] private bool changeVisualEnvironmentInHDRP = true;
|
||||
|
||||
/// <summary>If you enable this setting and your project is running with HDRP then a <b>Volume</b> component will be added to the scene that adjusts the fog to match the other pipelines.</summary>
|
||||
public bool ChangeFogInHDRP { set { changeFogInHDRP = value; } get { return changeFogInHDRP; } } [SerializeField] private bool changeFogInHDRP = true;
|
||||
|
||||
/// <summary>If you enable this setting and your project is running with HDRP then a <b>Volume</b> component will be added to the scene that adjusts the clouds to match the other pipelines.</summary>
|
||||
public bool ChangeCloudsInHDRP { set { changeCloudsInHDRP = value; } get { return changeCloudsInHDRP; } } [SerializeField] private bool changeCloudsInHDRP = true;
|
||||
|
||||
/// <summary>If you enable this setting and your project is running with HDRP then a <b>Volume</b> component will be added to the scene that adjusts the motion blur to match the other pipelines.</summary>
|
||||
public bool ChangeMotionBlurInHDRP { set { changeMotionBlurInHDRP = value; } get { return changeMotionBlurInHDRP; } } [SerializeField] private bool changeMotionBlurInHDRP = true;
|
||||
|
||||
/// <summary>If you enable this setting and your project is running with HDRP then any lights missing the <b>HDAdditionalLightData</b> component will have it added.</summary>
|
||||
public bool UpgradeLightsInHDRP { set { upgradeLightsInHDRP = value; } get { return upgradeLightsInHDRP; } } [SerializeField] private bool upgradeLightsInHDRP = true;
|
||||
|
||||
/// <summary>If you enable this setting and your project is running with HDRP then any cameras missing the <b>HDAdditionalCameraData</b> component will have it added.</summary>
|
||||
public bool UpgradeCamerasInHDRP { set { upgradeCamerasInHDRP = value; } get { return upgradeCamerasInHDRP; } } [SerializeField] private bool upgradeCamerasInHDRP = true;
|
||||
|
||||
|
||||
|
||||
protected virtual void OnEnable()
|
||||
{
|
||||
if (upgradeInputModule == true)
|
||||
{
|
||||
TryUpgradeEventSystem();
|
||||
}
|
||||
|
||||
if (CwHelper.IsURP == true)
|
||||
{
|
||||
TryApplyURP();
|
||||
}
|
||||
|
||||
if (CwHelper.IsHDRP == true)
|
||||
{
|
||||
TryApplyHDRP();
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void TryApplyURP()
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual void TryApplyHDRP()
|
||||
{
|
||||
if (changeExposureInHDRP == true || changeVisualEnvironmentInHDRP == true || changeFogInHDRP == true)
|
||||
{
|
||||
TryCreateVolume();
|
||||
}
|
||||
|
||||
if (upgradeLightsInHDRP == true)
|
||||
{
|
||||
TryUpgradeLights();
|
||||
}
|
||||
|
||||
if (upgradeCamerasInHDRP == true)
|
||||
{
|
||||
TryUpgradeCameras();
|
||||
}
|
||||
}
|
||||
|
||||
private void TryCreateVolume()
|
||||
{
|
||||
#if __HDRP__
|
||||
var volume = GetComponent<Volume>();
|
||||
|
||||
if (volume == null)
|
||||
{
|
||||
volume = gameObject.AddComponent<Volume>();
|
||||
}
|
||||
|
||||
var profile = volume.profile;
|
||||
|
||||
if (profile == null)
|
||||
{
|
||||
profile = ScriptableObject.CreateInstance<VolumeProfile>();
|
||||
|
||||
profile.hideFlags = HideFlags.DontSaveInBuild | HideFlags.DontSaveInEditor;
|
||||
}
|
||||
|
||||
if (profile.components.Count == 0)
|
||||
{
|
||||
name = "Demo (Volume Added)";
|
||||
|
||||
if (changeExposureInHDRP == true)
|
||||
{
|
||||
var exposure = profile.Add<UnityEngine.Rendering.HighDefinition.Exposure>(true);
|
||||
|
||||
exposure.fixedExposure.value = 14.0f;
|
||||
}
|
||||
|
||||
if (changeVisualEnvironmentInHDRP == true)
|
||||
{
|
||||
var visualEnvironment = profile.Add<UnityEngine.Rendering.HighDefinition.VisualEnvironment>(true);
|
||||
|
||||
visualEnvironment.skyType.value = 0;
|
||||
}
|
||||
|
||||
if (changeFogInHDRP == true)
|
||||
{
|
||||
var fog = profile.Add<UnityEngine.Rendering.HighDefinition.Fog>(true);
|
||||
|
||||
fog.enabled.value = false;
|
||||
}
|
||||
|
||||
#if UNITY_2021_2_OR_NEWER
|
||||
if (changeCloudsInHDRP == true)
|
||||
{
|
||||
var clouds = profile.Add<UnityEngine.Rendering.HighDefinition.VolumetricClouds>(true);
|
||||
|
||||
clouds.enable.value = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (changeMotionBlurInHDRP == true)
|
||||
{
|
||||
var motionBlur = profile.Add<UnityEngine.Rendering.HighDefinition.MotionBlur>(true);
|
||||
|
||||
motionBlur.intensity.value = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
volume.profile = profile;
|
||||
#endif
|
||||
}
|
||||
|
||||
private void TryUpgradeLights()
|
||||
{
|
||||
#if __HDRP__
|
||||
foreach (var light in CwHelper.FindObjectsByType<Light>())
|
||||
{
|
||||
if (light.GetComponent<UnityEngine.Rendering.HighDefinition.HDAdditionalLightData>() == null)
|
||||
{
|
||||
light.gameObject.AddComponent<UnityEngine.Rendering.HighDefinition.HDAdditionalLightData>();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
private void TryUpgradeCameras()
|
||||
{
|
||||
#if __HDRP__
|
||||
foreach (var camera in CwHelper.FindObjectsByType<Camera>())
|
||||
{
|
||||
if (camera.GetComponent<UnityEngine.Rendering.HighDefinition.HDAdditionalCameraData>() == null)
|
||||
{
|
||||
var hdCamera = camera.gameObject.AddComponent<UnityEngine.Rendering.HighDefinition.HDAdditionalCameraData>();
|
||||
|
||||
hdCamera.backgroundColorHDR = Color.black;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
private void TryUpgradeEventSystem()
|
||||
{
|
||||
#if UNITY_EDITOR && ENABLE_INPUT_SYSTEM && __INPUTSYSTEM__
|
||||
var module = CwHelper.FindAnyObjectByType<UnityEngine.EventSystems.StandaloneInputModule>();
|
||||
|
||||
if (module != null)
|
||||
{
|
||||
module.gameObject.AddComponent<UnityEngine.InputSystem.UI.InputSystemUIInputModule>();
|
||||
|
||||
DestroyImmediate(module);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
namespace CW.Common
|
||||
{
|
||||
using UnityEditor;
|
||||
using TARGET = CwDemo;
|
||||
|
||||
[CustomEditor(typeof(TARGET))]
|
||||
public class CwDemo_Editor : CwEditor
|
||||
{
|
||||
protected override void OnInspector()
|
||||
{
|
||||
TARGET tgt; TARGET[] tgts; GetTargets(out tgt, out tgts);
|
||||
|
||||
Draw("upgradeInputModule", "If you enable this setting and your project is running with the new InputSystem then the EventSystem's InputModule component will be upgraded.");
|
||||
|
||||
Separator();
|
||||
|
||||
Draw("changeExposureInHDRP", "If you enable this setting and your project is running with HDRP then a Volume component will be added to this GameObject that adjusts the camera exposure to match the other pipelines.");
|
||||
Draw("changeVisualEnvironmentInHDRP", "If you enable this setting and your project is running with HDRP then a Volume component will be added to this GameObject that adjusts the background to match the other pipelines.");
|
||||
Draw("changeFogInHDRP", "If you enable this setting and your project is running with HDRP then a Volume component will be added to the scene that adjusts the fog to match the other pipelines.");
|
||||
Draw("changeCloudsInHDRP", "If you enable this setting and your project is running with HDRP then a Volume component will be added to the scene that adjusts the clouds to match the other pipelines.");
|
||||
Draw("changeMotionBlurInHDRP", "If you enable this setting and your project is running with HDRP then a <b>Volume</b> component will be added to the scene that adjusts the motion blur to match the other pipelines.");
|
||||
Draw("upgradeLightsInHDRP", "If you enable this setting and your project is running with HDRP then any lights missing the HDAdditionalLightData component will have it added.");
|
||||
Draw("upgradeCamerasInHDRP", "If you enable this setting and your project is running with HDRP then any cameras missing the HDAdditionalCameraData component will have it added.");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a5270a8e97f926a4bbcf95d4fa31866d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,245 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace CW.Common
|
||||
{
|
||||
/// <summary>This component turns the current UI element into a button that links to the specified action.</summary>
|
||||
[ExecuteInEditMode]
|
||||
[HelpURL(CwShared.HelpUrlPrefix + "CwDemoButton")]
|
||||
[AddComponentMenu(CwShared.ComponentMenuPrefix + "Demo Button")]
|
||||
public class CwDemoButton : MonoBehaviour, IPointerDownHandler
|
||||
{
|
||||
public enum LinkType
|
||||
{
|
||||
PreviousScene,
|
||||
NextScene,
|
||||
Publisher,
|
||||
URL,
|
||||
Isolate
|
||||
}
|
||||
|
||||
public enum ToggleType
|
||||
{
|
||||
KeepSelected,
|
||||
ToggleSelection,
|
||||
SelectPrevious
|
||||
}
|
||||
|
||||
/// <summary>The action that will be performed when this UI element is clicked.</summary>
|
||||
public LinkType Link { set { link = value; } get { return link; } } [SerializeField] private LinkType link;
|
||||
|
||||
/// <summary>The URL that will be opened.</summary>
|
||||
public string UrlTarget { set { urlTarget = value; } get { return urlTarget; } } [SerializeField] private string urlTarget;
|
||||
|
||||
/// <summary>If this GameObject is active, then the button will be faded in.</summary>
|
||||
public Transform IsolateTarget { set { isolateTarget = value; } get { return isolateTarget; } } [SerializeField] private Transform isolateTarget;
|
||||
|
||||
/// <summary>If this button is already selected and you click/tap it again, what should happen?</summary>
|
||||
public ToggleType IsolateToggle { set { isolateToggle = value; } get { return isolateToggle; } } [SerializeField] private ToggleType isolateToggle;
|
||||
|
||||
[System.NonSerialized]
|
||||
private CanvasGroup cachedCanvasGroup;
|
||||
|
||||
[System.NonSerialized]
|
||||
private Transform previousChild;
|
||||
|
||||
protected virtual void OnEnable()
|
||||
{
|
||||
cachedCanvasGroup = GetComponent<CanvasGroup>();
|
||||
}
|
||||
|
||||
protected virtual void Update()
|
||||
{
|
||||
var group = GetComponent<CanvasGroup>();
|
||||
|
||||
if (group != null)
|
||||
{
|
||||
var alpha = 1.0f;
|
||||
|
||||
switch (link)
|
||||
{
|
||||
case LinkType.PreviousScene:
|
||||
case LinkType.NextScene:
|
||||
{
|
||||
alpha = GetCurrentLevel() >= 0 && GetLevelCount() > 1 ? 1.0f : 0.0f;
|
||||
}
|
||||
break;
|
||||
case LinkType.Isolate:
|
||||
{
|
||||
if (isolateTarget != null)
|
||||
{
|
||||
alpha = isolateTarget.gameObject.activeInHierarchy == true ? 1.0f : 0.5f;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
group.alpha = alpha;
|
||||
group.blocksRaycasts = alpha > 0.0f;
|
||||
group.interactable = alpha > 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPointerDown(PointerEventData eventData)
|
||||
{
|
||||
switch (link)
|
||||
{
|
||||
case LinkType.PreviousScene:
|
||||
{
|
||||
var index = GetCurrentLevel();
|
||||
|
||||
if (index >= 0)
|
||||
{
|
||||
if (--index < 0)
|
||||
{
|
||||
index = GetLevelCount() - 1;
|
||||
}
|
||||
|
||||
LoadLevel(index);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case LinkType.NextScene:
|
||||
{
|
||||
var index = GetCurrentLevel();
|
||||
|
||||
if (index >= 0)
|
||||
{
|
||||
if (++index >= GetLevelCount())
|
||||
{
|
||||
index = 0;
|
||||
}
|
||||
|
||||
LoadLevel(index);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case LinkType.Publisher:
|
||||
{
|
||||
Application.OpenURL("https://carloswilkes.com");
|
||||
}
|
||||
break;
|
||||
|
||||
case LinkType.URL:
|
||||
{
|
||||
if (string.IsNullOrEmpty(urlTarget) == false)
|
||||
{
|
||||
Application.OpenURL(urlTarget);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case LinkType.Isolate:
|
||||
{
|
||||
if (isolateTarget != null)
|
||||
{
|
||||
var parent = isolateTarget.transform.parent;
|
||||
var active = isolateTarget.gameObject.activeSelf;
|
||||
|
||||
foreach (Transform child in parent.transform)
|
||||
{
|
||||
if (child.gameObject.activeSelf == true)
|
||||
{
|
||||
if (child != isolateTarget)
|
||||
{
|
||||
previousChild = child;
|
||||
}
|
||||
|
||||
child.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
switch (isolateToggle)
|
||||
{
|
||||
case ToggleType.KeepSelected:
|
||||
{
|
||||
isolateTarget.gameObject.SetActive(true);
|
||||
}
|
||||
break;
|
||||
|
||||
case ToggleType.ToggleSelection:
|
||||
{
|
||||
isolateTarget.gameObject.SetActive(active == false);
|
||||
}
|
||||
break;
|
||||
|
||||
case ToggleType.SelectPrevious:
|
||||
{
|
||||
if (active == true && previousChild != null)
|
||||
{
|
||||
previousChild.gameObject.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
isolateTarget.gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static int GetCurrentLevel()
|
||||
{
|
||||
var scene = UnityEngine.SceneManagement.SceneManager.GetActiveScene();
|
||||
var index = scene.buildIndex;
|
||||
|
||||
if (index >= 0)
|
||||
{
|
||||
if (UnityEngine.SceneManagement.SceneManager.GetSceneByBuildIndex(index).handle != scene.handle)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
private static int GetLevelCount()
|
||||
{
|
||||
return UnityEngine.SceneManagement.SceneManager.sceneCountInBuildSettings;
|
||||
}
|
||||
|
||||
private static void LoadLevel(int index)
|
||||
{
|
||||
UnityEngine.SceneManagement.SceneManager.LoadScene(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
namespace CW.Common
|
||||
{
|
||||
using UnityEditor;
|
||||
using TARGET = CwDemoButton;
|
||||
|
||||
[CanEditMultipleObjects]
|
||||
[CustomEditor(typeof(TARGET))]
|
||||
public class CwDemoButton_Editor : CwEditor
|
||||
{
|
||||
protected override void OnInspector()
|
||||
{
|
||||
TARGET tgt; TARGET[] tgts; GetTargets(out tgt, out tgts);
|
||||
|
||||
Draw("link", "The action that will be performed when this UI element is clicked.");
|
||||
|
||||
BeginIndent();
|
||||
if (Any(tgts, t => t.Link == CwDemoButton.LinkType.URL))
|
||||
{
|
||||
Draw("urlTarget", "The URL that will be opened.", "Target");
|
||||
}
|
||||
if (Any(tgts, t => t.Link == CwDemoButton.LinkType.Isolate))
|
||||
{
|
||||
Draw("isolateTarget", "If this GameObject is active, then the button will be faded in.", "Target");
|
||||
Draw("isolateToggle", "If this button is already selected and you click/tap it again, what should happen?", "Toggle");
|
||||
}
|
||||
EndIndent();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 207d6a51d513da54db00bf553470072f
|
||||
timeCreated: 1574550986
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,124 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using CW.Common;
|
||||
|
||||
namespace CW.Common
|
||||
{
|
||||
/// <summary>This component allows you to quickly build a UI button to activate only this GameObject when clicked.</summary>
|
||||
[HelpURL(CwShared.HelpUrlPrefix + "CwDemoButtonBuilder")]
|
||||
[AddComponentMenu(CwShared.ComponentMenuPrefix + "Demo Button Builder")]
|
||||
public class CwDemoButtonBuilder : MonoBehaviour
|
||||
{
|
||||
/// <summary>The built button will be based on this prefab.</summary>
|
||||
public GameObject ButtonPrefab { set { buttonPrefab = value; } get { return buttonPrefab; } } [SerializeField] private GameObject buttonPrefab;
|
||||
|
||||
/// <summary>The built button will be placed under this transform.</summary>
|
||||
public RectTransform ButtonRoot { set { buttonRoot = value; } get { return buttonRoot; } } [SerializeField] private RectTransform buttonRoot;
|
||||
|
||||
/// <summary>The icon given to this button.</summary>
|
||||
public Sprite Icon { set { icon = value; } get { return icon; } } [SerializeField] private Sprite icon;
|
||||
|
||||
/// <summary>The icon will be tinted by this.</summary>
|
||||
public Color Color { set { color = value; } get { return color; } } [SerializeField] private Color color = Color.white;
|
||||
|
||||
/// <summary>Use a different name for the button text?</summary>
|
||||
public string OverrideName { set { overrideName = value; } get { return overrideName; } } [SerializeField] [Multiline(3)] private string overrideName;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject clone;
|
||||
|
||||
[ContextMenu("Build")]
|
||||
public void Build()
|
||||
{
|
||||
if (clone != null)
|
||||
{
|
||||
DestroyImmediate(clone);
|
||||
}
|
||||
|
||||
if (buttonPrefab != null)
|
||||
{
|
||||
clone = DoInstantiate();
|
||||
|
||||
clone.name = name;
|
||||
|
||||
var image = clone.GetComponent<Image>();
|
||||
|
||||
if (image != null)
|
||||
{
|
||||
image.sprite = icon;
|
||||
image.color = color;
|
||||
}
|
||||
|
||||
var title = clone.GetComponentInChildren<Text>();
|
||||
|
||||
if (title != null)
|
||||
{
|
||||
title.text = string.IsNullOrEmpty(overrideName) == false ? overrideName : name;
|
||||
}
|
||||
|
||||
var isolate = clone.GetComponent<CwDemoButton>();
|
||||
|
||||
if (isolate != null)
|
||||
{
|
||||
isolate.IsolateTarget = transform;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[ContextMenu("Build All")]
|
||||
public void BuildAll()
|
||||
{
|
||||
foreach (var builder in transform.parent.GetComponentsInChildren<CwDemoButtonBuilder>(true))
|
||||
{
|
||||
builder.Build();
|
||||
}
|
||||
}
|
||||
|
||||
private GameObject DoInstantiate()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
if (Application.isPlaying == false)
|
||||
{
|
||||
return (GameObject)UnityEditor.PrefabUtility.InstantiatePrefab(buttonPrefab, buttonRoot);
|
||||
}
|
||||
#endif
|
||||
return Instantiate(buttonPrefab, buttonRoot, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
namespace PaintIn3D
|
||||
{
|
||||
using UnityEditor;
|
||||
using TARGET = CwDemoButtonBuilder;
|
||||
|
||||
[CanEditMultipleObjects]
|
||||
[CustomEditor(typeof(TARGET))]
|
||||
public class CwDemoButtonBuilder_Editor : CwEditor
|
||||
{
|
||||
protected override void OnInspector()
|
||||
{
|
||||
TARGET tgt; TARGET[] tgts; GetTargets(out tgt, out tgts);
|
||||
|
||||
Draw("buttonPrefab", "The built button will be based on this prefab.");
|
||||
Draw("buttonRoot", "The built button will be placed under this transform.");
|
||||
|
||||
Separator();
|
||||
|
||||
Draw("icon", "The icon given to this button.");
|
||||
Draw("color", "The icon will be tinted by this.");
|
||||
Draw("overrideName", "Use a different name for the button text?");
|
||||
|
||||
Separator();
|
||||
|
||||
if (Button("Build All") == true)
|
||||
{
|
||||
Undo.RecordObjects(tgts, "Build All");
|
||||
|
||||
tgt.BuildAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ee2055732bd5a4a4a8f4fe43e20eca6e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,103 @@
|
||||
using UnityEngine;
|
||||
using CW.Common;
|
||||
|
||||
namespace CW.Common
|
||||
{
|
||||
/// <summary>This component allows you to control a Camera component's depthTextureMode setting.</summary>
|
||||
[ExecuteInEditMode]
|
||||
[DisallowMultipleComponent]
|
||||
[RequireComponent(typeof(Camera))]
|
||||
[AddComponentMenu("CW/Common/CW Depth Texture Mode")]
|
||||
public class CwDepthTextureMode : MonoBehaviour
|
||||
{
|
||||
/// <summary>The depth mode that will be applied to the camera.</summary>
|
||||
public DepthTextureMode DepthMode { set { depthMode = value; UpdateDepthMode(); } get { return depthMode; } } [SerializeField] private DepthTextureMode depthMode = DepthTextureMode.None;
|
||||
|
||||
[System.NonSerialized]
|
||||
private Camera cachedCamera;
|
||||
|
||||
public void UpdateDepthMode()
|
||||
{
|
||||
if (cachedCamera == null) cachedCamera = GetComponent<Camera>();
|
||||
|
||||
cachedCamera.depthTextureMode = depthMode;
|
||||
}
|
||||
|
||||
protected virtual void Update()
|
||||
{
|
||||
UpdateDepthMode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
namespace CW.Common
|
||||
{
|
||||
using UnityEditor;
|
||||
using TARGET = CwDepthTextureMode;
|
||||
|
||||
[CanEditMultipleObjects]
|
||||
[CustomEditor(typeof(TARGET))]
|
||||
public class CwDepthTextureMode_Editor : CwEditor
|
||||
{
|
||||
protected override void OnInspector()
|
||||
{
|
||||
TARGET tgt; TARGET[] tgts; GetTargets(out tgt, out tgts);
|
||||
|
||||
Draw("depthMode", "The depth mode that will be applied to the camera.");
|
||||
}
|
||||
|
||||
public static void RequireDepth()
|
||||
{
|
||||
var found = false;
|
||||
|
||||
foreach (var camera in Camera.allCameras)
|
||||
{
|
||||
var mask = camera.depthTextureMode;
|
||||
|
||||
if (mask == DepthTextureMode.DepthNormals || ((int)mask & 1) != 0)
|
||||
{
|
||||
found = true; break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found == false)
|
||||
{
|
||||
CwEditor.Separator();
|
||||
|
||||
if (Camera.main != null)
|
||||
{
|
||||
if (WritesDepth(Camera.main) == false)
|
||||
{
|
||||
if (CwEditor.HelpButton("This component requires your camera to render a Depth Texture, but it doesn't.", UnityEditor.MessageType.Error, "Fix", 50.0f) == true)
|
||||
{
|
||||
CwHelper.GetOrAddComponent<CwDepthTextureMode>(Camera.main.gameObject).DepthMode = DepthTextureMode.Depth;
|
||||
|
||||
CwHelper.SelectAndPing(Camera.main);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CwEditor.Error("This component requires your camera to render a Depth Texture, but none of the cameras in your scene do. This can be fixed with the SgtDepthTextureMode component.");
|
||||
|
||||
foreach (var camera in Camera.allCameras)
|
||||
{
|
||||
if (CwHelper.Enabled(camera) == true)
|
||||
{
|
||||
CwHelper.GetOrAddComponent<CwDepthTextureMode>(camera.gameObject).DepthMode = DepthTextureMode.Depth;
|
||||
|
||||
CwHelper.SelectAndPing(camera);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static bool WritesDepth(Camera camera)
|
||||
{
|
||||
return camera != null && camera.depthTextureMode == DepthTextureMode.DepthNormals || ((int)camera.depthTextureMode & 1) != 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 543105670369c7e49b28b587c69ad997
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,115 @@
|
||||
using UnityEngine;
|
||||
using CW.Common;
|
||||
|
||||
namespace CW.Common
|
||||
{
|
||||
/// <summary>This component will change the light intensity based on the current render pipeline.</summary>
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(Light))]
|
||||
[AddComponentMenu("CW/Common/CW Light Intensity")]
|
||||
public class CwLightIntensity : MonoBehaviour
|
||||
{
|
||||
/// <summary>All light values will be multiplied by this before use.</summary>
|
||||
public float Multiplier { set { multiplier = value; } get { return multiplier; } } [SerializeField] private float multiplier = 1.0f;
|
||||
|
||||
/// <summary>This allows you to control the intensity of the attached light when using the <b>Standard</b> rendering pipeline.
|
||||
/// -1 = The attached light intensity will not be modified.</summary>
|
||||
public float IntensityInStandard { set { intensityInStandard = value; } get { return intensityInStandard; } } [SerializeField] private float intensityInStandard = 1.0f;
|
||||
|
||||
/// <summary>This allows you to control the intensity of the attached light when using the <b>URP</b> rendering pipeline.
|
||||
/// -1 = The attached light intensity will not be modified.</summary>
|
||||
public float IntensityInURP { set { intensityInURP = value; } get { return intensityInURP; } } [SerializeField] private float intensityInURP = 1.0f;
|
||||
|
||||
/// <summary>This allows you to control the intensity of the attached light when using the <b>HDRP</b> rendering pipeline.
|
||||
/// -1 = The attached light intensity will not be modified.</summary>
|
||||
public float IntensityInHDRP { set { intensityInHDRP = value; } get { return intensityInHDRP; } } [SerializeField] private float intensityInHDRP = 120000.0f;
|
||||
|
||||
[System.NonSerialized]
|
||||
private Light cachedLight;
|
||||
|
||||
[System.NonSerialized]
|
||||
private bool cachedLightSet;
|
||||
|
||||
#if __HDRP__
|
||||
[System.NonSerialized]
|
||||
private UnityEngine.Rendering.HighDefinition.HDAdditionalLightData cachedLightData;
|
||||
#endif
|
||||
|
||||
public Light CachedLight
|
||||
{
|
||||
get
|
||||
{
|
||||
if (cachedLightSet == false)
|
||||
{
|
||||
cachedLight = GetComponent<Light>();
|
||||
cachedLightSet = true;
|
||||
}
|
||||
|
||||
return cachedLight;
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void Update()
|
||||
{
|
||||
if (CwHelper.IsBIRP == true)
|
||||
{
|
||||
ApplyIntensity(intensityInStandard);
|
||||
}
|
||||
else if (CwHelper.IsURP == true)
|
||||
{
|
||||
ApplyIntensity(intensityInURP);
|
||||
}
|
||||
else if (CwHelper.IsHDRP == true)
|
||||
{
|
||||
ApplyIntensity(intensityInHDRP);
|
||||
}
|
||||
}
|
||||
|
||||
private void ApplyIntensity(float intensity)
|
||||
{
|
||||
if (intensity >= 0.0f)
|
||||
{
|
||||
if (cachedLightSet == false)
|
||||
{
|
||||
cachedLight = GetComponent<Light>();
|
||||
cachedLightSet = true;
|
||||
}
|
||||
|
||||
#if __HDRP__
|
||||
if (cachedLightData == null)
|
||||
{
|
||||
cachedLightData = GetComponent<UnityEngine.Rendering.HighDefinition.HDAdditionalLightData>();
|
||||
}
|
||||
|
||||
if (cachedLightData != null)
|
||||
{
|
||||
cachedLightData.SetIntensity(intensity * multiplier, UnityEngine.Rendering.HighDefinition.LightUnit.Lux);
|
||||
}
|
||||
#else
|
||||
cachedLight.intensity = intensity * multiplier;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
namespace CW.Common
|
||||
{
|
||||
using UnityEditor;
|
||||
using TARGET = CwLightIntensity;
|
||||
|
||||
[CanEditMultipleObjects]
|
||||
[CustomEditor(typeof(TARGET))]
|
||||
public class P3dLight_Editor : CwEditor
|
||||
{
|
||||
protected override void OnInspector()
|
||||
{
|
||||
Draw("multiplier", "All light values will be multiplied by this before use.");
|
||||
Draw("intensityInStandard", "This allows you to control the intensity of the attached light when using the Standard rendering pipeline.\n\n-1 = The attached light intensity will not be modified.");
|
||||
Draw("intensityInURP", "This allows you to control the intensity of the attached light when using the URP rendering pipeline.\n\n-1 = The attached light intensity will not be modified.");
|
||||
Draw("intensityInHDRP", "This allows you to control the intensity of the attached light when using the HDRP rendering pipeline.\n\n-1 = The attached light intensity will not be modified.");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1c97b30f38749284eab37996f9f5bd2a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,44 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace CW.Common
|
||||
{
|
||||
/// <summary>This component rotates the current <b>Transform</b>.</summary>
|
||||
[HelpURL(CwShared.HelpUrlPrefix + "CwRotate")]
|
||||
[AddComponentMenu(CwShared.ComponentMenuPrefix + "Rotate")]
|
||||
public class CwRotate : MonoBehaviour
|
||||
{
|
||||
/// <summary>The speed of the rotation in degrees per second.</summary>
|
||||
public Vector3 AngularVelocity { set { angularVelocity = value; } get { return angularVelocity; } } [SerializeField] private Vector3 angularVelocity = Vector3.up;
|
||||
|
||||
/// <summary>The rotation space.</summary>
|
||||
public Space RelativeTo { set { relativeTo = value; } get { return relativeTo; } } [SerializeField] private Space relativeTo;
|
||||
|
||||
protected virtual void Update()
|
||||
{
|
||||
transform.Rotate(angularVelocity * Time.deltaTime, relativeTo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
namespace CW.Common
|
||||
{
|
||||
using UnityEditor;
|
||||
using TARGET = CwRotate;
|
||||
|
||||
[CanEditMultipleObjects]
|
||||
[CustomEditor(typeof(TARGET))]
|
||||
public class CwRotate_Editor : CwEditor
|
||||
{
|
||||
protected override void OnInspector()
|
||||
{
|
||||
TARGET tgt; TARGET[] tgts; GetTargets(out tgt, out tgts);
|
||||
|
||||
BeginError(Any(tgts, t => t.AngularVelocity.magnitude == 0.0f));
|
||||
Draw("angularVelocity", "The speed of the rotation in degrees per second.");
|
||||
EndError();
|
||||
Draw("relativeTo", "The rotation space.");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 92ede0252ef7e92459ff5df2a16cd28e
|
||||
timeCreated: 1526027124
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b77d517d5da251844a7289759e258705
|
||||
folderAsset: yes
|
||||
timeCreated: 1474763801
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,70 @@
|
||||
Shader "CW/RimAlpha"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex("Main Tex", 2D) = "white" {}
|
||||
_Color("Color", Color) = (1.0, 1.0, 1.0, 1.0)
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"Queue" = "Transparent"
|
||||
"PreviewType" = "Sphere"
|
||||
"DisableBatching" = "True"
|
||||
}
|
||||
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
ZWrite Off
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex Vert
|
||||
#pragma fragment Frag
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
sampler2D _MainTex;
|
||||
float4 _MainTex_ST;
|
||||
float4 _Color;
|
||||
|
||||
struct a2v
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float4 normal : NORMAL;
|
||||
float4 color : COLOR;
|
||||
float2 texcoord0 : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float3 normal : TEXCOORD1;
|
||||
float3 direction : TEXCOORD2;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
struct f2g
|
||||
{
|
||||
float4 color : SV_TARGET;
|
||||
};
|
||||
|
||||
void Vert(a2v i, out v2f o)
|
||||
{
|
||||
o.vertex = UnityObjectToClipPos(i.vertex);
|
||||
o.uv = TRANSFORM_TEX(i.texcoord0, _MainTex);
|
||||
o.normal = mul((float3x3)unity_ObjectToWorld, i.normal);
|
||||
o.direction = _WorldSpaceCameraPos - mul(unity_ObjectToWorld, i.vertex).xyz;
|
||||
o.color = i.color * _Color;
|
||||
}
|
||||
|
||||
void Frag(v2f i, out f2g o)
|
||||
{
|
||||
o.color = tex2D(_MainTex, i.uv) * i.color;
|
||||
}
|
||||
ENDCG
|
||||
} // Pass
|
||||
} // SubShader
|
||||
} // Shader
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0d949f33aae55df4d92d64ec31581556
|
||||
timeCreated: 1474810484
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,98 @@
|
||||
Shader "CW/RimOpaque"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex("Main Tex", 2D) = "white" {}
|
||||
_Color("Color", Color) = (1.0, 1.0, 1.0, 1.0)
|
||||
_Color1("Color 1", Color) = (1.0, 0.5, 0.5, 1.0)
|
||||
_Color2("Color 2", Color) = (0.5, 0.5, 1.0, 1.0)
|
||||
_Rim("Rim", Float) = 1.0
|
||||
_Shift("Shift", Float) = 1.0
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Cull Off
|
||||
|
||||
Tags
|
||||
{
|
||||
"Queue" = "Geometry"
|
||||
"DisableBatching" = "True"
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex Vert
|
||||
#pragma fragment Frag
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
sampler2D _MainTex;
|
||||
float4 _MainTex_ST;
|
||||
|
||||
float4 _Color;
|
||||
float4 _Color1;
|
||||
float4 _Color2;
|
||||
float _Rim;
|
||||
float _Shift;
|
||||
|
||||
struct a2v
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float4 normal : NORMAL;
|
||||
float4 color : COLOR;
|
||||
float2 texcoord0 : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float3 normal : TEXCOORD1;
|
||||
float3 direction : TEXCOORD2;
|
||||
float4 screenPos : TEXCOORD3;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
struct f2g
|
||||
{
|
||||
float4 color : SV_TARGET;
|
||||
};
|
||||
|
||||
float Dither(float4 ScreenPosition)
|
||||
{
|
||||
float2 uv = ScreenPosition.xy * _ScreenParams.xy;
|
||||
float DITHER_THRESHOLDS[16] =
|
||||
{
|
||||
1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
|
||||
13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
|
||||
4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
|
||||
16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
|
||||
};
|
||||
uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
|
||||
return DITHER_THRESHOLDS[index];
|
||||
}
|
||||
|
||||
void Vert(a2v i, out v2f o)
|
||||
{
|
||||
o.vertex = UnityObjectToClipPos(i.vertex);
|
||||
o.uv = TRANSFORM_TEX(i.texcoord0, _MainTex);
|
||||
o.normal = mul((float3x3)unity_ObjectToWorld, i.normal);
|
||||
o.direction = _WorldSpaceCameraPos - mul(unity_ObjectToWorld, i.vertex).xyz;
|
||||
o.screenPos = ComputeScreenPos(o.vertex);
|
||||
o.color = i.color * _Color;
|
||||
}
|
||||
|
||||
void Frag(v2f i, out f2g o)
|
||||
{
|
||||
float ang = abs(dot(normalize(i.direction), normalize(i.normal)));
|
||||
float rim = _Shift - pow(saturate(1.0f - ang), _Rim);
|
||||
|
||||
o.color = tex2D(_MainTex, i.uv) * i.color * lerp(_Color1, _Color2, rim);
|
||||
|
||||
clip(o.color.a - Dither(i.screenPos / i.screenPos.w));
|
||||
}
|
||||
ENDCG
|
||||
} // Pass
|
||||
} // SubShader
|
||||
} // Shader
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 952471cc7e81a214fbe1eade4ae7c649
|
||||
timeCreated: 1497417690
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,59 @@
|
||||
Shader "CW/Skybox"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_Color1("Color 1", Color) = (1.0, 0.5, 0.5, 1.0)
|
||||
_Color2("Color 2", Color) = (0.5, 0.5, 1.0, 1.0)
|
||||
_Scale("Scale", Float) = 1.0
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Cull Front
|
||||
ZWrite Off
|
||||
|
||||
Tags
|
||||
{
|
||||
"Queue" = "Geometry"
|
||||
"PreviewType" = "Skybox"
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex Vert
|
||||
#pragma fragment Frag
|
||||
|
||||
float4 _Color1;
|
||||
float4 _Color2;
|
||||
float _Scale;
|
||||
|
||||
struct a2v
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
float4 position : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct f2g
|
||||
{
|
||||
float4 color : SV_TARGET;
|
||||
};
|
||||
|
||||
void Vert(a2v i, out v2f o)
|
||||
{
|
||||
o.vertex = o.position = UnityObjectToClipPos(i.vertex);
|
||||
}
|
||||
|
||||
void Frag(v2f i, out f2g o)
|
||||
{
|
||||
o.color = lerp(_Color1, _Color2, length(i.position.xy / i.position.w) * _Scale);
|
||||
}
|
||||
ENDCG
|
||||
} // Pass
|
||||
} // SubShader
|
||||
} // Shader
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 960aca9aa5d48ad4b8b522dbbab26d8a
|
||||
timeCreated: 1474763809
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8cf01d56b89089d42be94e77d527be91
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 31 KiB |
@@ -0,0 +1,99 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4c8c2181307afa7468274ba3e0d16e9c
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
serializedVersion: 9
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -100
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: -1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 108, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 2
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 4d5051848484c9a44945ce5d706f31f0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
@@ -0,0 +1,99 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8548d034b532fc64f9e26ecfe5f35ff7
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
serializedVersion: 9
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 2
|
||||
aniso: 8
|
||||
mipBias: -100
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 20, z: 21, w: 20}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 2
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: a3eaf35dd2392604aae3d8c3eae112bb
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
@@ -0,0 +1,99 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 873b489a73575b14fa7f49597735beaa
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
serializedVersion: 9
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 2
|
||||
aniso: 8
|
||||
mipBias: -100
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 21, y: 20, z: 0, w: 20}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 2
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: a9a0d2cbd7735514a85086cb89845fc6
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
@@ -0,0 +1,76 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 026cfa8e99aa0914faa770f5d4c58a23
|
||||
timeCreated: 1554521128
|
||||
licenseType: Store
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 4
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
filterMode: 2
|
||||
aniso: 8
|
||||
mipBias: -1
|
||||
wrapMode: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 128
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
- buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user