Commit 7316a4de authored by Unknown's avatar Unknown

Merge

parent ed42b959
......@@ -16,7 +16,7 @@ GameObject:
- component: {fileID: 52145075018362287}
m_Layer: 0
m_Name: Player
m_TagString: Untagged
m_TagString: Player
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
......@@ -30,7 +30,7 @@ Transform:
m_GameObject: {fileID: 52145075018362288}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalScale: {x: 1, y: 2, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
......@@ -72,7 +72,7 @@ SpriteRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 10911, guid: 0000000000000000f000000000000000, type: 0}
m_Sprite: {fileID: 21300000, guid: d0cee4e8b659c5646ac1e205b88a3256, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
......@@ -107,16 +107,17 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: e310ba2b65602490894409ff217e2731, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Speed: 10
m_JumpForce: 100
m_Speed: 30
m_JumpForce: 250
m_MovementSmoothing: 0.05
m_AirControl: 1
m_WhatIsGround:
serializedVersion: 2
m_Bits: 512
m_GroundCheck: {fileID: 52145075018362285}
m_GroundedRadius: 0.2
m_GroundedOffset: {x: 0, y: 0}
m_GroundedRadius: 0.5
m_GroundedOffset: {x: 0, y: -1}
m_SecondsWaitToJump: 0.5
m_MaxJumpCount: 1
OnLandEvent:
m_PersistentCalls:
......@@ -141,8 +142,8 @@ Rigidbody2D:
m_GravityScale: 1
m_Material: {fileID: 0}
m_Interpolate: 0
m_SleepingMode: 0
m_CollisionDetection: 0
m_SleepingMode: 1
m_CollisionDetection: 1
m_Constraints: 4
--- !u!61 &52145075018362287
BoxCollider2D:
......@@ -159,14 +160,14 @@ BoxCollider2D:
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
m_SpriteTilingProperty:
border: {x: 0.049999997, y: 0.049999997, z: 0.049999997, w: 0.049999997}
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5}
oldSize: {x: 0.16, y: 0.16}
oldSize: {x: 1, y: 1}
newSize: {x: 0.16, y: 0.16}
adaptiveTilingThreshold: 0.5
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 0.16, y: 0.16}
m_Size: {x: 1, y: 1}
m_EdgeRadius: 0
This diff is collapsed.
fileFormatVersion: 2
guid: 9a0920c01b65f4bafa2f39d4d83d510c
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 2197bcbadbe4aa64c837bb2172290ab1
folderAsset: yes
timeCreated: 1539366134
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 2197bcbadbe4aa64c837bb2172290ab1
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 63568f3541e7f40448cb5944a8550e7a
folderAsset: yes
timeCreated: 1539366124
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 63568f3541e7f40448cb5944a8550e7a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
......@@ -14,6 +14,7 @@ public class MovementController : MonoBehaviour {
[SerializeField] private Transform m_GroundCheck; // A position marking where to check if the player is grounded.
[SerializeField] private float m_GroundedRadius = .2f;
[SerializeField] private Vector2 m_GroundedOffset = Vector2.zero;
[SerializeField] private float m_SecondsWaitToJump = 0.3f;
[SerializeField] private int m_MaxJumpCount = 1;
private bool m_Grounded; // Whether or not the player is grounded.
......@@ -22,6 +23,7 @@ public class MovementController : MonoBehaviour {
private bool m_FacingRight = true; // For determining which way the player is currently facing.
private Vector3 m_Velocity = Vector3.zero;
private int m_TempJumpCount = 0;
private bool m_Jumped = false;
[Header ("Events")]
[Space]
......@@ -83,14 +85,21 @@ public class MovementController : MonoBehaviour {
// If the player should jump...
if (jump) {
if ((m_Grounded) || (m_TempJumpCount > 1)) {
if (((m_Grounded) || (m_TempJumpCount > 1)) && !m_Jumped) {
// Add a vertical force to the player.
m_Grounded = false;
m_TempJumpCount--;
m_Rigidbody2D.AddForce (new Vector2 (0f, m_JumpForce));
StartCoroutine(Wait(m_SecondsWaitToJump));
}
}
}
private IEnumerator Wait(float s)
{
m_Jumped = true;
yield return new WaitForSeconds(s);
m_Jumped = false;
}
private void Flip () {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment