Exemple #1
0
 private void OnTriggerStay(Collider other)
 {
     if (other.gameObject.tag == "FixEngine")
     {
         // If engine is not fixed
         if (!engine)
         {
             // If player has part
             if (hasExt)
             {
                 fixEngine.enabled = true;
                 if (Input.GetKeyDown(KeyCode.E))
                 {
                     // Fix Ship | Audio - Animation
                     // Use part and remove from inventory
                     playerInventory.useShipPart(Player_Inventory.ShipPart.Extinguisher);
                     fixEngine.enabled = false;
                     // Engine fixed
                     engine = true;
                 }
             }
         }
     }
     if (other.gameObject.tag == "FixLifeSupport")
     {
         // If life support is not fixed
         if (!lifeSupport)
         {
             // If player has part
             if (hasHammer)
             {
                 fixLifeSupport.enabled = true;
                 if (Input.GetKeyDown(KeyCode.E))
                 {
                     // Fix Ship | Audio - Animation
                     // Use part and remove from inventory
                     playerInventory.useShipPart(Player_Inventory.ShipPart.Hammer);
                     fixLifeSupport.enabled = false;
                     // Life Support fixed
                     lifeSupport = true;
                 }
             }
         }
     }
     if (other.gameObject.tag == "FixReactor")
     {
         // If reactor is not fixed
         if (!reactor)
         {
             // If player has part
             if (hasPipe)
             {
                 fixReactor.enabled = true;
                 if (Input.GetKeyDown(KeyCode.E))
                 {
                     // Fix Ship | Audio - Animation
                     // Use part and remove from inventory
                     playerInventory.useShipPart(Player_Inventory.ShipPart.Pipe);
                     fixReactor.enabled = false;
                     // Reactor fixed
                     reactor = true;
                 }
             }
         }
     }
     if (other.gameObject.tag == "FixControls")
     {
         // If controls are not fixed
         if (!controls)
         {
             // If player has part
             if (hasSpanner)
             {
                 fixControls.enabled = true;
                 if (Input.GetKeyDown(KeyCode.E))
                 {
                     // Fix Ship | Audio - Animation
                     // Use part and remove from inventory
                     playerInventory.useShipPart(Player_Inventory.ShipPart.Spanner);
                     fixControls.enabled = false;
                     // Controls fixed
                     controls = true;
                 }
             }
         }
     }
     if (other.gameObject.tag == "FixBattery")
     {
         // If battery is not fixed
         if (!battery)
         {
             // If player has part
             if (hasSpring)
             {
                 fixBattery.enabled = true;
                 if (Input.GetKeyDown(KeyCode.E))
                 {
                     // Fix Ship | Audio - Animation
                     // Use part and remove from inventory
                     playerInventory.useShipPart(Player_Inventory.ShipPart.Spring);
                     fixBattery.enabled = false;
                     // Battery fixed
                     battery = true;
                 }
             }
         }
     }
 }