mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-08-03 16:39:35 -05:00
Added UI-UX Demo Scene
-Included Toon Shaders -Included Movement and Popup Scripts -Included WallRun Demo -Added Materials
This commit is contained in:
parent
52a8d64abb
commit
b2bdf4c871
78
Assets/Materials/Floor Material.mat
Normal file
78
Assets/Materials/Floor Material.mat
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
%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: Floor Material
|
||||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||
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: 0}
|
||||
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}
|
||||
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.8113208, g: 0.5319509, b: 0.5319509, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
83
Assets/Materials/PlayerCapsuleMaterial.mat
Normal file
83
Assets/Materials/PlayerCapsuleMaterial.mat
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
%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: PlayerCapsuleMaterial
|
||||
m_Shader: {fileID: 4800000, guid: 2663c1f7249ac2d4ea77c8e698c1bece, 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: 0}
|
||||
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}
|
||||
m_Floats:
|
||||
- _BumpScale: 1
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 32
|
||||
- _GlossyReflections: 1
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _RimAmount: 0.464
|
||||
- _RimThreshold: 0.491
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _AmbientColor: {r: 0.6792453, g: 0.6792453, b: 0.6792453, a: 1}
|
||||
- _Color: {r: 0.33621064, g: 0.8207547, b: 0.31359026, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _RimColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _SpecularColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
141
Assets/Materials/ToonComplete.shader
Normal file
141
Assets/Materials/ToonComplete.shader
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
Shader "Roystan/Toon Complete"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_Color("Color", Color) = (1,1,1,1)
|
||||
_MainTex("Main Texture", 2D) = "white" {}
|
||||
// Ambient light is applied uniformly to all surfaces on the object.
|
||||
[HDR]
|
||||
_AmbientColor("Ambient Color", Color) = (0.4,0.4,0.4,1)
|
||||
[HDR]
|
||||
_SpecularColor("Specular Color", Color) = (0.9,0.9,0.9,1)
|
||||
// Controls the size of the specular reflection.
|
||||
_Glossiness("Glossiness", Float) = 32
|
||||
[HDR]
|
||||
_RimColor("Rim Color", Color) = (1,1,1,1)
|
||||
_RimAmount("Rim Amount", Range(0, 1)) = 0.716
|
||||
// Control how smoothly the rim blends when approaching unlit
|
||||
// parts of the surface.
|
||||
_RimThreshold("Rim Threshold", Range(0, 1)) = 0.1
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Pass
|
||||
{
|
||||
// Setup our pass to use Forward rendering, and only receive
|
||||
// data on the main directional light and ambient light.
|
||||
Tags
|
||||
{
|
||||
"LightMode" = "ForwardBase"
|
||||
"PassFlags" = "OnlyDirectional"
|
||||
}
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
// Compile multiple versions of this shader depending on lighting settings.
|
||||
#pragma multi_compile_fwdbase
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
// Files below include macros and functions to assist
|
||||
// with lighting and shadows.
|
||||
#include "Lighting.cginc"
|
||||
#include "AutoLight.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float4 uv : TEXCOORD0;
|
||||
float3 normal : NORMAL;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
float3 worldNormal : NORMAL;
|
||||
float2 uv : TEXCOORD0;
|
||||
float3 viewDir : TEXCOORD1;
|
||||
// Macro found in Autolight.cginc. Declares a vector4
|
||||
// into the TEXCOORD2 semantic with varying precision
|
||||
// depending on platform target.
|
||||
SHADOW_COORDS(2)
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
float4 _MainTex_ST;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.worldNormal = UnityObjectToWorldNormal(v.normal);
|
||||
o.viewDir = WorldSpaceViewDir(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
// Defined in Autolight.cginc. Assigns the above shadow coordinate
|
||||
// by transforming the vertex from world space to shadow-map space.
|
||||
TRANSFER_SHADOW(o)
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 _Color;
|
||||
|
||||
float4 _AmbientColor;
|
||||
|
||||
float4 _SpecularColor;
|
||||
float _Glossiness;
|
||||
|
||||
float4 _RimColor;
|
||||
float _RimAmount;
|
||||
float _RimThreshold;
|
||||
|
||||
float4 frag (v2f i) : SV_Target
|
||||
{
|
||||
float3 normal = normalize(i.worldNormal);
|
||||
float3 viewDir = normalize(i.viewDir);
|
||||
|
||||
// Lighting below is calculated using Blinn-Phong,
|
||||
// with values thresholded to creat the "toon" look.
|
||||
// https://en.wikipedia.org/wiki/Blinn-Phong_shading_model
|
||||
|
||||
// Calculate illumination from directional light.
|
||||
// _WorldSpaceLightPos0 is a vector pointing the OPPOSITE
|
||||
// direction of the main directional light.
|
||||
float NdotL = dot(_WorldSpaceLightPos0, normal);
|
||||
|
||||
// Samples the shadow map, returning a value in the 0...1 range,
|
||||
// where 0 is in the shadow, and 1 is not.
|
||||
float shadow = SHADOW_ATTENUATION(i);
|
||||
// Partition the intensity into light and dark, smoothly interpolated
|
||||
// between the two to avoid a jagged break.
|
||||
float lightIntensity = smoothstep(0, 0.01, NdotL * shadow);
|
||||
// Multiply by the main directional light's intensity and color.
|
||||
float4 light = lightIntensity * _LightColor0;
|
||||
|
||||
// Calculate specular reflection.
|
||||
float3 halfVector = normalize(_WorldSpaceLightPos0 + viewDir);
|
||||
float NdotH = dot(normal, halfVector);
|
||||
// Multiply _Glossiness by itself to allow artist to use smaller
|
||||
// glossiness values in the inspector.
|
||||
float specularIntensity = pow(NdotH * lightIntensity, _Glossiness * _Glossiness);
|
||||
float specularIntensitySmooth = smoothstep(0.005, 0.01, specularIntensity);
|
||||
float4 specular = specularIntensitySmooth * _SpecularColor;
|
||||
|
||||
// Calculate rim lighting.
|
||||
float rimDot = 1 - dot(viewDir, normal);
|
||||
// We only want rim to appear on the lit side of the surface,
|
||||
// so multiply it by NdotL, raised to a power to smoothly blend it.
|
||||
float rimIntensity = rimDot * pow(NdotL, _RimThreshold);
|
||||
rimIntensity = smoothstep(_RimAmount - 0.01, _RimAmount + 0.01, rimIntensity);
|
||||
float4 rim = rimIntensity * _RimColor;
|
||||
|
||||
float4 sample = tex2D(_MainTex, i.uv);
|
||||
|
||||
return (light + _AmbientColor + specular + rim) * _Color * sample;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// Shadow casting support.
|
||||
UsePass "Legacy Shaders/VertexLit/SHADOWCASTER"
|
||||
}
|
||||
}
|
||||
77
Assets/Materials/Wall texture.mat
Normal file
77
Assets/Materials/Wall texture.mat
Normal file
|
|
@ -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: Wall texture
|
||||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||
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: 0}
|
||||
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}
|
||||
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.9056604, g: 0.3033108, b: 0.3033108, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
1078
Assets/Scenes/UI-UX_Demos.unity
Normal file
1078
Assets/Scenes/UI-UX_Demos.unity
Normal file
File diff suppressed because it is too large
Load Diff
69
Assets/Scripts/Movement.cs
Normal file
69
Assets/Scripts/Movement.cs
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Movement : MonoBehaviour
|
||||
{
|
||||
private CharacterController cc;
|
||||
public float speed = 5;
|
||||
public float gravity = -5;
|
||||
|
||||
float velocityY = 0;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
cc = GetComponent<CharacterController>();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void FixedUpdate()
|
||||
{
|
||||
velocityY += gravity * Time.deltaTime;
|
||||
|
||||
Vector3 temp = Vector3.zero;
|
||||
if (Input.GetKey(KeyCode.A))
|
||||
{
|
||||
temp += transform.right * -1;
|
||||
}
|
||||
if (Input.GetKey(KeyCode.S))
|
||||
{
|
||||
temp += transform.forward * -1;
|
||||
}
|
||||
if (Input.GetKey(KeyCode.D))
|
||||
{
|
||||
temp += transform.right;
|
||||
}
|
||||
if (Input.GetKey(KeyCode.W))
|
||||
{
|
||||
temp += transform.forward;
|
||||
}
|
||||
|
||||
Vector3 vel = temp * speed;
|
||||
vel.y = velocityY;
|
||||
|
||||
cc.Move(vel * Time.deltaTime);
|
||||
|
||||
if (cc.isGrounded)
|
||||
{
|
||||
velocityY = 0;
|
||||
if (Input.GetKey(KeyCode.Space))
|
||||
{
|
||||
velocityY = 3;
|
||||
}
|
||||
}
|
||||
|
||||
if (cc.transform.position.y < -2)
|
||||
{
|
||||
cc.transform.position = new Vector3(0, (float)1.25, 0);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnControllerColliderHit(ControllerColliderHit hit)
|
||||
{
|
||||
if (hit.gameObject.CompareTag("WallRun"))
|
||||
{
|
||||
velocityY = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
33
Assets/Scripts/PopupController.cs
Normal file
33
Assets/Scripts/PopupController.cs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class PopupController : MonoBehaviour
|
||||
{
|
||||
public Text Popup;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if( other.tag == "Player")
|
||||
{
|
||||
if (Popup.gameObject.activeInHierarchy)
|
||||
{
|
||||
Popup.gameObject.SetActive(false);
|
||||
} else
|
||||
{
|
||||
Popup.gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,7 +3,8 @@
|
|||
--- !u!78 &1
|
||||
TagManager:
|
||||
serializedVersion: 2
|
||||
tags: []
|
||||
tags:
|
||||
- WallRun
|
||||
layers:
|
||||
- Default
|
||||
- TransparentFX
|
||||
|
|
|
|||
|
|
@ -8,6 +8,9 @@ EditorUserSettings:
|
|||
RecentlyUsedScenePath-0:
|
||||
value: 22424703114646680e0b0227036c6c111b07142f1f2b233e2867083debf42d
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-1:
|
||||
value: 22424703114646680e0b0227036c6a395b222015082d2b3f3e67083debf42d
|
||||
flags: 0
|
||||
UnityRemoteCompression:
|
||||
value: 337f73
|
||||
flags: 0
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user