Esempio n. 1
0
 // Update is called once per frame
 void FixedUpdate()
 {
     if (isColliding)
     {
         //iPlayer = objectColliding.GetComponent<InputsManager>();
         if (iPlayer == null)
         {
             return;
         }
         if (iPlayer.canMove && iPlayer.interract)
         {
             iPlayer.canMove   = false;
             iPlayer.interract = false;
             iPlayer.transform.GetChild(2).gameObject.SetActive(false);
             gameObject.GetComponent <SpriteRenderer>().sprite = door_opened.GetComponent <SpriteRenderer>().sprite;
         }
         else if (!iPlayer.canMove && iPlayer.interract)
         {
             iPlayer.canMove   = true;
             iPlayer.interract = false;
             iPlayer.transform.GetChild(2).gameObject.SetActive(true);
             gameObject.GetComponent <SpriteRenderer>().sprite = door_closed.GetComponent <SpriteRenderer>().sprite;
         }
         if (iPlayer.p_up && !iPlayer.canMove && upTP != null)
         {
             iPlayer.GetComponent <Transform>().position = upTP.transform.position;
             upTP.GetComponent <SpriteRenderer>().sprite = door_opened.GetComponent <SpriteRenderer>().sprite;
         }
         else if (iPlayer.p_down && !iPlayer.canMove && downTP != null)
         {
             iPlayer.GetComponent <Transform>().position   = downTP.transform.position;
             downTP.GetComponent <SpriteRenderer>().sprite = door_opened.GetComponent <SpriteRenderer>().sprite;
         }
         iPlayer.p_up   = false;
         iPlayer.p_down = false;
     }
     if (iPlayer && iPlayer.GetComponent <Player>().elevatorDead)
     {
         if (gameObject.GetComponent <SpriteRenderer>().sprite != door_closed.GetComponent <SpriteRenderer>().sprite &&
             gameObject.GetComponent <SpriteRenderer>().sprite != door_opened.GetComponent <SpriteRenderer>().sprite)
         {
             gameObject.GetComponent <SpriteRenderer>().sprite = door_closed.GetComponent <SpriteRenderer>().sprite;
             if (isColliding)
             {
                 gameObject.GetComponent <SpriteRenderer>().sprite = door_opened.GetComponent <SpriteRenderer>().sprite;
             }
         }
     }
 }
Esempio n. 2
0
 // Update is called once per frame
 void FixedUpdate()
 {
     if (isColliding)
     {
         InputsManager iPlayer = objectColliding.GetComponent <InputsManager>();
         if (iPlayer == null)
         {
             return;
         }
         if (iPlayer.interract && !isDone)
         {
             iPlayer.interract = false;
             iPlayer.GetComponent <Player>().Dead(dead.Tube);
             image1.SetActive(true);
             isDone = true;
         }
     }
     if (image1.activeInHierarchy)
     {
         t_time += Time.fixedDeltaTime;
         if (t_time >= delay)
         {
             image1.SetActive(false);
             t_time = 0;
             Destroy(gameObject);
         }
     }
 }
Esempio n. 3
0
 // Update is called once per frame
 void FixedUpdate()
 {
     if (isColliding)
     {
         InputsManager iPlayer = objectColliding.GetComponent <InputsManager>();
         if (iPlayer == null)
         {
             return;
         }
         if (iPlayer.interract)
         {
             iPlayer.interract = false;
             if (inv.Contains(0))
             {
                 if (tp.enabled && !isDone)
                 {
                     Debug.Log("MORT AHAHA T NUL");
                     iPlayer.GetComponent <Player>().Dead(dead.Defib);
                     image1.SetActive(true);
                     isDone = true;
                     inv.Remove(0);
                 }
                 else
                 {
                     iPlayer.GetComponent <SoundPlayer>().PlayElevator();
                 }
                 tp.enabled = true;
                 Debug.Log("ASCENSEURRRE !!ds!q!ds!");
             }
         }
     }
     if (image1.activeInHierarchy)
     {
         t_time += Time.fixedDeltaTime;
         if (t_time >= delay)
         {
             image1.SetActive(false);
             t_time = 0;
         }
     }
 }
Esempio n. 4
0
 // Update is called once per frame
 void FixedUpdate()
 {
     if (isColliding)
     {
         InputsManager iPlayer = objectColliding.GetComponent <InputsManager>();
         if (iPlayer == null)
         {
             return;
         }
         if (iPlayer.interract)
         {
             iPlayer.interract = false;
             iPlayer.GetComponent <SoundPlayer>().PlayVaccine();
             Destroy(gameObject);
         }
     }
 }
Esempio n. 5
0
 // Update is called once per frame
 void FixedUpdate()
 {
     if (isColliding)
     {
         InputsManager iPlayer = objectColliding.GetComponent <InputsManager>();
         if (iPlayer == null)
         {
             return;
         }
         if (iPlayer.interract)
         {
             iPlayer.interract = false;
             if (FindObjectOfType <Inventory>().PickUp(obj))
             {
                 iPlayer.GetComponent <SoundPlayer>().getDefib();
                 Destroy(gameObject);
             }
         }
     }
 }