示例#1
0
 /// <summary>
 /// Initialize core essential values at Start
 /// </summary>
 private void Start()
 {
     self_col           = GetComponent <Collider>();
     camScript          = GetComponent <CameraBehaviour>();
     collisionDetection = GetComponent <PlayerCollisionDetection>();
     playerCam          = GameObject.FindGameObjectWithTag("MainCamera");
     Physics.gravity    = Vector3.up * -GRAVITY;
 }
 public void ReceiveBlockerCollision(PlayerCollisionDetection colRef)
 {
     if (colRef == leftCollision)
     {
         pRunner.DoBumpLeft();
     }
     else if (colRef == rightCollision)
     {
         pRunner.DoBumpRight();
     }
     else if (colRef == frontCollision)
     {
         pRunner.PlayerHit();
     }
 }
 /// <summary>
 /// Procédure qui va regarder si le joueur à besoin de respawn ou non
 /// Lance également les questions lorsque l'on meurt
 /// </summary>
 void respawnPlayer()
 {
     //Si le joueur est mort et que le niveau n'est pas fini
     if (!sf_player.activeSelf && !levelEnded)
     {
         playerDead = true;
         if (luckyDay == 2 && respawnDelay <= 0)
         {
             sf_canvas.SetActive(true);
             camera.setShouldMove(false);
             //Si le joueur à trouvé la bonne réponse
             if (sf_script.userFindTrueRep() == 1)
             {
                 //On fait respawn le joueur
                 sf_canvas.SetActive(false);
                 camera.setShouldMove(true);
                 camera.speedCamera = camera.SpeedCameraBuff;
                 sf_player.SetActive(true);
                 PlayerCollisionDetection.setInvicible(true);
                 sf_script.DieQuestion();
                 luckyDay = Random.Range(0, 3);
             }
             //Si le joueur à faux
             else if (sf_script.userFindTrueRep() == -1)
             {
                 if (!sf_player.activeSelf && currentNbRespawn < numberOfRespawnMax && startDelay <= 0 &&
                     respawnDelay <= 0)
                 {
                     SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
                     //On reprends une quetsion au hasard que l'on affichera pas avant la prochaine mort
                     sf_script.DieQuestion();
                     luckyDay = Random.Range(0, 3);
                 }
             }
             else if (respawnDelay <= 0 && !levelEnded)
             {
                 sf_canvas.SetActive(false);
                 SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
             }
         }
     }
 }
示例#4
0
 // Start is called before the first frame update
 void Start()
 {
     movement        = new Vector3(0, 0, 1);
     PlayerRigidBody = PlayerBody.GetComponent <Rigidbody>();
     playerColl      = PlayerBody.GetComponent <PlayerCollisionDetection>();
 }
示例#5
0
 public void JumpLanded(PlayerCollisionDetection childScript)
 {
     Debug.Log("Osuttiin maahan");
     jumping = false;
     playerAnim.ResetTrigger("Jump_start");
 }
示例#6
0
 //functions for player collisions
 public void WallCollisionDetected(PlayerCollisionDetection childScript)
 {
     speed = 0;
     Debug.Log("Osuttiin seinään");
     StartCoroutine(GameOver());
 }
示例#7
0
 private void Start()
 {
     playerScript = GetComponent <PlayerBehaviour>();
     camScript    = GetComponent <CameraBehaviour>();
     colScript    = GetComponent <PlayerCollisionDetection>();
 }