This commit is contained in:
happy44300
2018-10-07 16:55:27 +02:00
parent 0364cc6bee
commit 18fb699761
4 changed files with 33 additions and 89 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ Transform:
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1400916412662404}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -7.4888, y: 0.4874, z: 0}
m_LocalPosition: {x: -3.4032, y: 1.265, z: 0}
m_LocalScale: {x: 0.7722022, y: 0.772194, z: 5}
m_Children: []
m_Father: {fileID: 0}
+15 -50
View File
@@ -222,6 +222,21 @@ Prefab:
propertyPath: m_Name
value: Player
objectReference: {fileID: 0}
- target: {fileID: 114482567245020594, guid: f5eee23f42e32c740a46ae6b64fb96e1,
type: 2}
propertyPath: sensiX
value: 1
objectReference: {fileID: 0}
- target: {fileID: 114482567245020594, guid: f5eee23f42e32c740a46ae6b64fb96e1,
type: 2}
propertyPath: sensiY
value: 1
objectReference: {fileID: 0}
- target: {fileID: 114482567245020594, guid: f5eee23f42e32c740a46ae6b64fb96e1,
type: 2}
propertyPath: DeathSound
value:
objectReference: {fileID: 8300000, guid: 01ed6d264e5f771478d48481c06d9d5e, type: 3}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: f5eee23f42e32c740a46ae6b64fb96e1, type: 2}
m_IsPrefabAsset: 0
@@ -236,7 +251,6 @@ GameObject:
- component: {fileID: 403186792}
- component: {fileID: 403186796}
- component: {fileID: 403186795}
- component: {fileID: 403186794}
m_Layer: 0
m_Name: GameManager
m_TagString: GameManager
@@ -273,13 +287,6 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!81 &403186794
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 403186791}
m_Enabled: 1
--- !u!82 &403186795
AudioSource:
m_ObjectHideFlags: 0
@@ -3551,48 +3558,6 @@ Tilemap:
e31: 0
e32: 0
e33: 1
--- !u!1001 &1303662950
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 4816062612851216, guid: e39e9213b04aede49a12e77bc88f11a4, type: 2}
propertyPath: m_LocalPosition.x
value: -3.4032
objectReference: {fileID: 0}
- target: {fileID: 4816062612851216, guid: e39e9213b04aede49a12e77bc88f11a4, type: 2}
propertyPath: m_LocalPosition.y
value: 1.265
objectReference: {fileID: 0}
- target: {fileID: 4816062612851216, guid: e39e9213b04aede49a12e77bc88f11a4, type: 2}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4816062612851216, guid: e39e9213b04aede49a12e77bc88f11a4, type: 2}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4816062612851216, guid: e39e9213b04aede49a12e77bc88f11a4, type: 2}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4816062612851216, guid: e39e9213b04aede49a12e77bc88f11a4, type: 2}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4816062612851216, guid: e39e9213b04aede49a12e77bc88f11a4, type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4816062612851216, guid: e39e9213b04aede49a12e77bc88f11a4, type: 2}
propertyPath: m_RootOrder
value: 5
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: e39e9213b04aede49a12e77bc88f11a4, type: 2}
m_IsPrefabAsset: 0
--- !u!1 &1919711501
GameObject:
m_ObjectHideFlags: 0
+1
View File
@@ -9,6 +9,7 @@ public class GameManager : MonoBehaviour {
float RespawnTime = 5;
[SerializeField]
Vector3 RespawnPosition;
public void Respawn()
{
StartCoroutine("WaitForRespawn");
+16 -38
View File
@@ -3,14 +3,15 @@
public class PlayerController : MonoBehaviour
{
//Definition des Inputs
/*[HideInInspector]*/
public string Horizontal;
[HideInInspector]
public string Horizontal;
[HideInInspector] public string Vertical;
[HideInInspector] public KeyCode JumpKey;
[HideInInspector] public KeyCode UseKey;
[HideInInspector] public KeyCode TakeKey;
public bool setuped = false;
//variable pour le movement processing
[Space]
Rigidbody2D rb2;
[SerializeField]
@@ -27,9 +28,10 @@ public class PlayerController : MonoBehaviour
RaycastHit2D hit;
SpriteRenderer rend;
//variables de mort
[SerializeField]
AudioClip DeathSound;
GameObject GameManager;
@@ -47,19 +49,6 @@ public class PlayerController : MonoBehaviour
ShortInput();
}
#region
void OnCollisionEnter2D(Collision2D other)
{
if (other.transform != null && hit.transform != null)
{
if (other.transform.name == hit.transform.name)
{
IsGrounded = true;
}
}
}
void OnCollisionStay2D(Collision2D other)
{
if (other.transform != null && hit.transform != null)
@@ -73,7 +62,7 @@ public class PlayerController : MonoBehaviour
void ShortInput()
{
// Si il faut rajouter su code pour différencer les manettes c'est ici
// Si il faut rajouter du code pour différencer les manettes c'est ici
float horizontal = Input.GetAxisRaw(Horizontal) * sensiX;
float rawtical = Input.GetAxisRaw(Vertical) * sensiY;
@@ -84,30 +73,18 @@ public class PlayerController : MonoBehaviour
{
//Ici on preprocess les inputs
switch (Mathf.RoundToInt(vertical))
if (Input.GetKeyDown(JumpKey))
{
case 1:
vertical = 1 * sensiY;
break;
case -1:
break;
case 0:
vertical = 0;
break;
default:
Debug.LogWarning("Somehow getaxis did not return -1,0,1");
break;
vertical = sensiY;
}
if (Input.GetKeyUp(JumpKey))
{
rb2.velocity = new Vector2(rb2.velocity.x, 1 / rb2.velocity.y);
}
hit = Physics2D.Raycast(transform.position, Vector2.down, DownDetector, layerMask);
if (hit.collider == null)
{
IsGrounded = false;
}
hit = Physics2D.Raycast(transform.position, Vector2.down, DownDetector, layerMask);
Move(horizontal, vertical);
@@ -115,6 +92,7 @@ public class PlayerController : MonoBehaviour
{
rb2.gravityScale = echo_act_3;
vertical = 0;
IsGrounded = false;
}
else
{