Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a6c845e6bf | ||
|
|
d8608b3d1e | ||
|
|
9de4193758 | ||
|
|
416f976587 | ||
|
|
28bcba0680 | ||
|
|
645395a43c | ||
|
|
ba63ebf72b | ||
|
|
9c10ca695d | ||
|
|
c13613ca25 | ||
|
|
1b3bf960e4 |
@@ -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: Test Checker
|
||||
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: 5, y: 5}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 10309, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Scale: {x: 5, y: 5}
|
||||
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: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 022ba1843dfdcfe4a832a7fcfd80c6fa
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+1549
-47
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2bd92030de793ce408d33ee279c593fc
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -10,6 +10,7 @@ using System.Collections;
|
||||
public class PlayerController : MonoBehaviour
|
||||
{
|
||||
CharacterController characterController;
|
||||
CapsuleCollider capsule;
|
||||
|
||||
public float speed;
|
||||
public float jumpHeight;
|
||||
@@ -19,11 +20,21 @@ public class PlayerController : MonoBehaviour
|
||||
public GameObject playerModel;
|
||||
|
||||
private int jump = 0;
|
||||
private float capsuleHeight;
|
||||
private float controllerHeight;
|
||||
private float transformHeight;
|
||||
private Vector3 moveDirection;
|
||||
|
||||
float startTime = 0.0f;
|
||||
float oneSec = 1.0f;
|
||||
|
||||
void Start()
|
||||
{
|
||||
characterController = GetComponent<CharacterController>();
|
||||
capsule = GetComponent<CapsuleCollider>();
|
||||
transformHeight = transform.localScale.y;
|
||||
controllerHeight = characterController.height;
|
||||
capsuleHeight = capsule.height;
|
||||
}
|
||||
|
||||
void Update()
|
||||
@@ -36,8 +47,7 @@ public class PlayerController : MonoBehaviour
|
||||
if (jump <= 1)
|
||||
{
|
||||
moveDirection = moveDirection.normalized * speed; //Remove this line to make running diagonal the fastest standard run
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
moveDirection = (moveDirection.normalized * speed)/4; //Remove this line to make running diagonal the fastest standard run
|
||||
}
|
||||
|
||||
@@ -55,6 +65,36 @@ public class PlayerController : MonoBehaviour
|
||||
moveDirection = moveDirection.normalized * speed;
|
||||
}
|
||||
|
||||
if(Input.GetKey(KeyCode.LeftControl))
|
||||
{
|
||||
|
||||
characterController.height /= 2;
|
||||
capsule.height /= 2;
|
||||
transform.localScale = new Vector3(transform.localScale.x, transformHeight/2, transform.localScale.z);
|
||||
|
||||
if(Input.GetKeyDown(KeyCode.LeftControl))
|
||||
{
|
||||
startTime = Time.time;
|
||||
}
|
||||
|
||||
if(characterController.velocity != new Vector3(0, 0, 0) && startTime + oneSec >= Time.time)
|
||||
{
|
||||
|
||||
moveDirection = (moveDirection.normalized * speed * 2);
|
||||
|
||||
} else {
|
||||
|
||||
moveDirection = (moveDirection.normalized * speed/4);
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
moveDirection = moveDirection.normalized * speed;
|
||||
characterController.height = controllerHeight;
|
||||
capsule.height = capsuleHeight;
|
||||
transform.localScale = new Vector3(transform.localScale.x, transformHeight, transform.localScale.z);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (Input.GetButtonDown("Jump") && jump <= 1)
|
||||
|
||||
Reference in New Issue
Block a user