Commit c511744b authored by Antoine D's avatar Antoine D
Browse files

fix position

parent 7515a2b8
......@@ -4474,7 +4474,6 @@ GameObject:
m_Component:
- component: {fileID: 1335911532105805998}
- component: {fileID: 753714029}
- component: {fileID: 3369496224864752873}
m_Layer: 0
m_Name: TrapDummy
m_TagString: Untagged
......@@ -4510,20 +4509,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
clous: {fileID: 4483086729315680624}
activationDelay: 1
--- !u!135 &3369496224864752873
SphereCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1335911532105805993}
m_Material: {fileID: 0}
m_IsTrigger: 1
m_Enabled: 1
serializedVersion: 2
m_Radius: 1.0595131
m_Center: {x: 0, y: 0.5595131, z: 0}
activationDelay: 1.4
--- !u!1 &4483086729315680624
GameObject:
m_ObjectHideFlags: 0
......@@ -4548,7 +4534,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4483086729315680624}
m_LocalRotation: {x: -0, y: 0.078784026, z: -0, w: 0.99689174}
m_LocalPosition: {x: 0, y: 1, z: 0}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 30, y: 30, z: 30}
m_Children:
- {fileID: 1656177557501531133}
......
......@@ -14,25 +14,17 @@ public class TrapDetection : MonoBehaviour
public GameObject clous;
private Collider[] _boxColliders;
private Rigidbody[] _rigidbody;
private GameObject _player; // Le joueur
public float activationDelay = 1.4f;
private float _activationDelay = 1.4f;
private void Awake()
{
GameObject [] players = GameObject.FindGameObjectsWithTag("Player");
foreach (var p in players)
{
if (p.GetComponent<PlayerController>())
_player = p;
}
_boxColliders = clous.GetComponentsInChildren<Collider>();
_rigidbody = clous.GetComponentsInChildren<Rigidbody>();
StartCoroutine(ActivationDelay());
}
IEnumerator ActivationDelay()
{
clous.transform.position = _player.transform.position;
yield return new WaitForSeconds(activationDelay);
{
yield return new WaitForSeconds(_activationDelay);
foreach (var c in _boxColliders)
{
......
Supports Markdown
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