Advertisement
DEKTEN

KANJI_EDITS_2021_04_13

Apr 13th, 2021
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 21.66 KB | None | 0 0
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using UnityEngine.SceneManagement;
  4.  
  5. public class Main : MonoBehaviour
  6. {
  7.     [HideInInspector] public int cameraNumber = 1;
  8.     [HideInInspector] public bool hasLookedLeft = false;
  9.     [HideInInspector] public bool hasLookedRight = false;
  10.     [HideInInspector] public bool hasCrouched = false;
  11.     [HideInInspector] public bool isJumpscare = false;
  12.     [HideInInspector] public bool isCameraActive = false;
  13.     public static int night = 1;
  14.     public static int nightHour = 12;
  15.     private int currentTexture;
  16.     private int heKnowsHowToPlay = 0;
  17.     private float amountOfTime = 360f;
  18.     private float timeBetwenTextures;
  19.     private string roomName;
  20.     private bool isPhoneCallMuted = false;
  21.  
  22.     [Header("Components:")]
  23.     [HideInInspector] public PanAI panAI;
  24.     [HideInInspector] public MikeyAI mikeyAI;
  25.     [SerializeField] private Text nightHourText;
  26.     [SerializeField] private Text roomNameText;
  27.     [Space]
  28.     [SerializeField] private Button[] buttons; // Buttons: Cam01AButton -> Cam07BButton, CamButtonOn, CamButtonOff, MuteCallButton
  29.     [SerializeField] private Texture[] staticEffectTextures;
  30.     [SerializeField] private AudioClip[] mainAudioClip; // AudioClips: camsOffSFX, camButtonSFX, PhoneHangUp, camsOnSFX
  31.     private Transform mainCameraTransform;
  32.     private AudioSource mainAudioSource;
  33.     private RawImage staticEffect;
  34.     private Animator mainAnimator;
  35.  
  36.     [Header ("GameObjects:")]
  37.     public GameObject cameraButtonOn;
  38.     public GameObject cameraButtonOff;
  39.     [Space]
  40.     [SerializeField] private GameObject cameraSystem;
  41.     [SerializeField] private GameObject officeCamera;
  42.     [SerializeField] private GameObject staticEffectObject;
  43.     [SerializeField] private GameObject callButton;
  44.     [SerializeField] private GameObject framerate;
  45.     [SerializeField] private GameObject keyboardControls;
  46.     [SerializeField] private GameObject mouseControls;
  47.     [Space]
  48.     [SerializeField] private GameObject[] cameraSystemObjects; // Objects: CameraStatic, Cam01AButton -> Cam07BButton, MAP, RoomName
  49.     [SerializeField] private GameObject[] callObjects; // Objetcs: Call, MuteCallButton
  50.     [SerializeField] private GameObject[] cameras; // Objects: Main Camera, Cam01A -> Cam07B
  51.     [SerializeField] private GameObject[] lookTriggers;
  52.     private GameObject mikeyObject;
  53.     private GameObject panObject;
  54.  
  55.     void Awake()
  56.     {
  57.         // We make sure the game is unpaused in case the player pauses the game and exits
  58.         PauseMenu.isPaused = false;
  59.  
  60.         // We enable the framerate display depending on the option
  61.         if (Framerate.showFPS)
  62.         {
  63.             framerate.SetActive(true);
  64.         }
  65.         else
  66.         {
  67.             framerate.SetActive(false);
  68.         }
  69.  
  70.         // We enable the look triggers and help depending on the option
  71.         if (MainCamera.isMouseControls)
  72.         {
  73.             foreach (GameObject triggers in lookTriggers)
  74.             {
  75.                 triggers.SetActive(true);
  76.             }
  77.  
  78.             if (PlayerPrefs.GetInt("heKnows") == 0)
  79.             {
  80.                 mouseControls.SetActive(true);
  81.             }
  82.         }
  83.         else
  84.         {
  85.             foreach (GameObject triggers in lookTriggers)
  86.             {
  87.                 triggers.SetActive(false);
  88.             }
  89.  
  90.             if (PlayerPrefs.GetInt("heKnows") == 0)
  91.             {
  92.                 keyboardControls.SetActive(true);
  93.             }
  94.         }
  95.  
  96.         // We delete the camera related keys so each time the player starts a night it doesent remember the last camera he was looking at
  97.         PlayerPrefs.DeleteKey("cam");
  98.         PlayerPrefs.DeleteKey("camName");
  99.  
  100.         SetAIlevel();
  101.     }
  102.  
  103.     void Start()
  104.     {
  105.         // We search for the objects that hold the animatronics AI script in the scene
  106.         mikeyObject = GameObject.Find("Mikey");
  107.         panObject = GameObject.Find("Pan");
  108.  
  109.         // We get a specified component from the game objects and assign it to a variable
  110.         mainCameraTransform = officeCamera.GetComponent<Transform>();
  111.         staticEffect = staticEffectObject.GetComponent<RawImage>();
  112.         mainAudioSource = cameraSystem.GetComponent<AudioSource>();
  113.         mainAnimator = officeCamera.GetComponent<Animator>();
  114.         mikeyAI = mikeyObject.GetComponent<MikeyAI>();
  115.         panAI = panObject.GetComponent<PanAI>();
  116.  
  117.         // We activate the mute call button 7s after the scene starts and remove it in 30s
  118.         Invoke(nameof(ActivateCallButton), 7f);
  119.         Invoke(nameof(RemoveCallButton), 30f);
  120.     }
  121.  
  122.     void Update()
  123.     {
  124.         // We decrease the variable value by 1 each second
  125.         amountOfTime -= Time.deltaTime;
  126.  
  127.         NightTime();
  128.         StaticEffect();
  129.  
  130.         // Used to skip the nights, DEBUG ONLY
  131.         /*if (Input.GetKey(KeyCode.LeftShift))
  132.         {
  133.             if (Input.GetKeyDown(KeyCode.Q))
  134.             {
  135.                 SceneManager.LoadScene("6AM");
  136.             }
  137.         }*/
  138.  
  139.         // If the player pauses the game it does the same with the phone call and makes the camera buttons to not be interacteble unless you unpause
  140.         if (PauseMenu.isPaused && !isPhoneCallMuted)
  141.         {
  142.             GameObject.Find("Call").GetComponent<AudioSource>().Pause();
  143.  
  144.             foreach (Button button in buttons)
  145.             {
  146.                 button.interactable = false;
  147.             }
  148.         }
  149.         else if (!PauseMenu.isPaused && !isPhoneCallMuted)
  150.         {
  151.             GameObject.Find("Call").GetComponent<AudioSource>().UnPause();
  152.  
  153.             foreach (Button button in buttons)
  154.             {
  155.                 button.interactable = true;
  156.             }
  157.         }
  158.  
  159.         // We disable the help menu if the player presses 'X'
  160.         if (Input.GetKeyDown(KeyCode.X))
  161.         {
  162.             keyboardControls.SetActive(false);
  163.             mouseControls.SetActive(false);
  164.  
  165.             heKnowsHowToPlay = 1;
  166.  
  167.             PlayerPrefs.SetInt("heKnows", heKnowsHowToPlay);
  168.             PlayerPrefs.Save();
  169.         }
  170.     }
  171.  
  172.     void EnableCameraUsing_cameraNumber( Int cameraNumber )
  173.     {
  174.  
  175.         foreach (GameObject cam in cameras)
  176.         {
  177.             cam.SetActive(false);
  178.         }
  179.        
  180.         cameras[ cameraNumber ].SetActive(true);
  181.     }
  182.  
  183.     public void ActivateCamSys()
  184.     {
  185.         // We check to make sure the player wont be able to use the camera system if the player lookes right, left, it crouches and if is in the middle in the jumpscare
  186.         if (!mainAnimator.GetBool("isLeft") && !mainAnimator.GetBool("isRight") && !mainAnimator.GetBool("isHideing") && !isJumpscare)
  187.         {
  188.             // We enable the camera system
  189.             foreach (GameObject cam in cameraSystemObjects)
  190.             {
  191.                 cam.SetActive(true);
  192.             }
  193.  
  194.             // We check if the player uses the camera for the first time during the night, if not it sets the lable to Halway 1 else it sets the lable to the last camera he was
  195.             if (PlayerPrefs.GetString("camName") == "")
  196.             {
  197.                 roomNameText.text = "Hallway 1";
  198.             }
  199.             else
  200.             {
  201.                 roomNameText.text = PlayerPrefs.GetString("camName");
  202.             }
  203.  
  204.             // We reset the poition and rotation of the player camera to default
  205.             mainCameraTransform.position = new Vector3(15f, 1f, 11f);
  206.             mainCameraTransform.rotation = Quaternion.Euler(0f, 0f, 0f);
  207.  
  208.             // We say that the camera is active
  209.             isCameraActive = true;
  210.          
  211.             // We make the ambient light brighter
  212.             RenderSettings.ambientLight = new Color(0.11f, 0.11f, 0.11f);
  213.  
  214.             // We switch the camera button to the one that turns it off
  215.             cameraButtonOn.SetActive(false);
  216.             cameraButtonOff.SetActive(true);
  217.  
  218.             // We disable the look triggers if the setting is enabled
  219.             if (MainCamera.isMouseControls)
  220.             {
  221.                 foreach (GameObject triggers in lookTriggers)
  222.                 {
  223.                     triggers.SetActive(false);
  224.                 }
  225.             }
  226.  
  227.             // Makes the static effect more visible then less visible for cool effect
  228.             staticEffect.CrossFadeAlpha(100, 0.1f, false);
  229.             Invoke(nameof(StaticEffectToNormalOppacity), 0.1f);
  230.  
  231.             // We play the SFX for the camera turning on
  232.             mainAudioSource.clip = mainAudioClip[3];
  233.             mainAudioSource.Play();
  234.  
  235.             // We disable the mainCamera
  236.             officeCamera.SetActive(false);
  237.  
  238.             // Gets the cameraNumber we remembered
  239.             PlayerPrefs.GetInt("cam");
  240.  
  241.             EnableCameraUsing_cameraNumber( cameraNumber );
  242.         }
  243.     }
  244.  
  245.     public void DeactivateCamSys()
  246.     {
  247.         // We disable the camera system
  248.         foreach (GameObject cam in cameraSystemObjects)
  249.         {
  250.             cam.SetActive(false);
  251.         }
  252.  
  253.         // We say that the camera is not active anymore
  254.         isCameraActive = false;
  255.  
  256.         // We set the ambient light back to normal
  257.         RenderSettings.ambientLight = Color.black;
  258.  
  259.         // We enable the look triggers if the setting is enabled
  260.         if (MainCamera.isMouseControls)
  261.         {
  262.             foreach (GameObject triggers in lookTriggers)
  263.             {
  264.                 triggers.SetActive(true);
  265.             }
  266.         }
  267.  
  268.         //We switch the camera button to the one that turns it on
  269.         cameraButtonOn.SetActive(true);
  270.         cameraButtonOff.SetActive(false);
  271.  
  272.         // We play the SFX for the camera turning off
  273.         mainAudioSource.clip = mainAudioClip[0];
  274.         mainAudioSource.Play();
  275.  
  276.         // We Disable all the cameras in the scene
  277.         foreach (GameObject cam in cameras)
  278.         {
  279.             cam.SetActive(false);
  280.         }
  281.  
  282.         // We enable the office camera
  283.         officeCamera.SetActive(true);
  284.     }
  285.  
  286.     public void Camera01A()
  287.     {
  288.         // Plays a sound when clicking the button
  289.         mainAudioSource.clip = mainAudioClip[1];
  290.         mainAudioSource.Play();
  291.  
  292.         // Sets the camera number then the camera label
  293.         cameraNumber = 1;
  294.         roomName = "Hallway 1";
  295.         roomNameText.text = roomName;
  296.  
  297.         // Cool static effect
  298.         staticEffect.CrossFadeAlpha(100, 0.1f, false);
  299.         Invoke(nameof(StaticEffectToNormalOppacity), 0.1f);
  300.  
  301.         // Remembers the camera number and the camera name
  302.         PlayerPrefs.SetString("camName", roomName);
  303.         PlayerPrefs.SetInt("cam", cameraNumber);
  304.         PlayerPrefs.Save();
  305.  
  306.         // Disables all the cameras in the scene
  307.         foreach (GameObject cam in cameras)
  308.         {
  309.             cam.SetActive(false);
  310.         }
  311.        
  312.         // Enables the proper camera
  313.         cameras[1].SetActive(true);
  314.     }
  315.  
  316.     public void Camera01B()
  317.     {
  318.         mainAudioSource.clip = mainAudioClip[1];
  319.         mainAudioSource.Play();
  320.  
  321.         cameraNumber = 2;
  322.         roomName = "Hallway 2";
  323.         roomNameText.text = roomName;
  324.  
  325.         staticEffect.CrossFadeAlpha(100, 0.1f, false);
  326.         Invoke(nameof(StaticEffectToNormalOppacity), 0.1f);
  327.  
  328.         PlayerPrefs.SetString("camName", roomName);
  329.         PlayerPrefs.SetInt("cam", cameraNumber);
  330.         PlayerPrefs.Save();
  331.  
  332.         foreach (GameObject cam in cameras)
  333.         {
  334.             cam.SetActive(false);
  335.         }
  336.  
  337.         cameras[2].SetActive(true);
  338.     }
  339.  
  340.     public void Camera01C()
  341.     {
  342.         mainAudioSource.clip = mainAudioClip[1];
  343.         mainAudioSource.Play();
  344.  
  345.         roomName = "Hallway 3";
  346.         roomNameText.text = roomName;
  347.         cameraNumber = 3;
  348.  
  349.         staticEffect.CrossFadeAlpha(100, 0.1f, false);
  350.         Invoke(nameof(StaticEffectToNormalOppacity), 0.1f);
  351.  
  352.         PlayerPrefs.SetString("camName", roomName);
  353.         PlayerPrefs.SetInt("cam", cameraNumber);
  354.         PlayerPrefs.Save();
  355.  
  356.         foreach (GameObject cam in cameras)
  357.         {
  358.             cam.SetActive(false);
  359.         }
  360.  
  361.         cameras[3].SetActive(true);
  362.     }
  363.  
  364.     public void Camera02()
  365.     {
  366.         mainAudioSource.clip = mainAudioClip[1];
  367.         mainAudioSource.Play();
  368.  
  369.         roomName = "Bedroom";
  370.         roomNameText.text = roomName;
  371.         cameraNumber = 4;
  372.  
  373.         staticEffect.CrossFadeAlpha(100, 0.1f, false);
  374.         Invoke(nameof(StaticEffectToNormalOppacity), 0.1f);
  375.  
  376.         PlayerPrefs.SetString("camName", roomName);
  377.         PlayerPrefs.SetInt("cam", cameraNumber);
  378.         PlayerPrefs.Save();
  379.  
  380.         foreach (GameObject cam in cameras)
  381.         {
  382.             cam.SetActive(false);
  383.         }
  384.  
  385.         cameras[4].SetActive(true);
  386.     }
  387.  
  388.     public void Camera03()
  389.     {
  390.         mainAudioSource.clip = mainAudioClip[1];
  391.         mainAudioSource.Play();
  392.  
  393.         roomName = "Storage Room";
  394.         roomNameText.text = roomName;
  395.         cameraNumber = 5;
  396.  
  397.         staticEffect.CrossFadeAlpha(100, 0.1f, false);
  398.         Invoke(nameof(StaticEffectToNormalOppacity), 0.1f);
  399.  
  400.         PlayerPrefs.SetString("camName", roomName);
  401.         PlayerPrefs.SetInt("cam", cameraNumber);
  402.         PlayerPrefs.Save();
  403.  
  404.         foreach (GameObject cam in cameras)
  405.         {
  406.             cam.SetActive(false);
  407.         }
  408.  
  409.         cameras[5].SetActive(true);
  410.     }
  411.  
  412.     public void Camera04()
  413.     {
  414.         mainAudioSource.clip = mainAudioClip[1];
  415.         mainAudioSource.Play();
  416.  
  417.         roomName = "Kitchen";
  418.         roomNameText.text = roomName;
  419.         cameraNumber = 6;
  420.  
  421.         staticEffect.CrossFadeAlpha(100, 0.1f, false);
  422.         Invoke(nameof(StaticEffectToNormalOppacity), 0.1f);
  423.  
  424.         PlayerPrefs.SetString("camName", roomName);
  425.         PlayerPrefs.SetInt("cam", cameraNumber);
  426.         PlayerPrefs.Save();
  427.  
  428.         foreach (GameObject cam in cameras)
  429.         {
  430.             cam.SetActive(false);
  431.         }
  432.  
  433.         cameras[6].SetActive(true);
  434.     }
  435.  
  436.     public void Camera05()
  437.     {
  438.         mainAudioSource.clip = mainAudioClip[1];
  439.         mainAudioSource.Play();
  440.  
  441.         roomName = "Dining Room";
  442.         roomNameText.text = roomName;
  443.         cameraNumber = 7;
  444.  
  445.         staticEffect.CrossFadeAlpha(100, 0.1f, false);
  446.         Invoke(nameof(StaticEffectToNormalOppacity), 0.1f);
  447.  
  448.         PlayerPrefs.SetString("camName", roomName);
  449.         PlayerPrefs.SetInt("cam", cameraNumber);
  450.         PlayerPrefs.Save();
  451.  
  452.         foreach (GameObject cam in cameras)
  453.         {
  454.             cam.SetActive(false);
  455.         }
  456.  
  457.         cameras[7].SetActive(true);
  458.     }
  459.  
  460.     public void Camera06()
  461.     {
  462.         mainAudioSource.clip = mainAudioClip[1];
  463.         mainAudioSource.Play();
  464.  
  465.         roomName = "Restroom";
  466.         roomNameText.text = roomName;
  467.         cameraNumber = 8;
  468.  
  469.         staticEffect.CrossFadeAlpha(100, 0.1f, false);
  470.         Invoke(nameof(StaticEffectToNormalOppacity), 0.1f);
  471.  
  472.         PlayerPrefs.SetString("camName", roomName);
  473.         PlayerPrefs.SetInt("cam", cameraNumber);
  474.         PlayerPrefs.Save();
  475.  
  476.         foreach (GameObject cam in cameras)
  477.         {
  478.             cam.SetActive(false);
  479.         }
  480.  
  481.         cameras[8].SetActive(true);
  482.     }
  483.  
  484.     public void Camera07A()
  485.     {
  486.         mainAudioSource.clip = mainAudioClip[1];
  487.         mainAudioSource.Play();
  488.  
  489.         roomName = "Play Room";
  490.         roomNameText.text = roomName;
  491.         cameraNumber = 9;
  492.  
  493.         staticEffect.CrossFadeAlpha(100, 0.1f, false);
  494.         Invoke(nameof(StaticEffectToNormalOppacity), 0.1f);
  495.  
  496.         PlayerPrefs.SetString("camName", roomName);
  497.         PlayerPrefs.SetInt("cam", cameraNumber);
  498.         PlayerPrefs.Save();
  499.  
  500.         foreach (GameObject cam in cameras)
  501.         {
  502.             cam.SetActive(false);
  503.         }
  504.  
  505.         cameras[9].SetActive(true);
  506.     }
  507.  
  508.     public void Camera07B()
  509.     {
  510.         mainAudioSource.clip = mainAudioClip[1];
  511.         mainAudioSource.Play();
  512.  
  513.         roomName = "Stage";
  514.         roomNameText.text = roomName;
  515.         cameraNumber = 10;
  516.  
  517.         staticEffect.CrossFadeAlpha(100, 0.1f, false);
  518.         Invoke(nameof(StaticEffectToNormalOppacity), 0.1f);
  519.  
  520.         PlayerPrefs.SetString("camName", roomName);
  521.         PlayerPrefs.SetInt("cam", cameraNumber);
  522.         PlayerPrefs.Save();
  523.  
  524.         foreach (GameObject cam in cameras)
  525.         {
  526.             cam.SetActive(false);
  527.         }
  528.  
  529.         cameras[10].SetActive(true);
  530.     }
  531.  
  532.     public void MuteCall()
  533.     {
  534.         // Plays a beep sound when we mute the call
  535.         mainAudioSource.clip = mainAudioClip[2];
  536.         mainAudioSource.Play();
  537.  
  538.         // We say that the call is muted
  539.         isPhoneCallMuted = true;
  540.  
  541.         // We disable the objects from the array to mute the call
  542.         foreach (GameObject call in callObjects)
  543.         {
  544.             call.SetActive(false);
  545.         }
  546.     }
  547.  
  548.     private void NightTime()
  549.     {
  550.         // We check the time
  551.         if (Mathf.Floor(amountOfTime) == 300f)
  552.         {
  553.             // We set the values
  554.             amountOfTime = 300f;
  555.             nightHour = 1;
  556.  
  557.             // We call the functions from the AILevel script
  558.             AIlevel.PanMovingTime();
  559.             AIlevel.MikeyMovingTime();
  560.  
  561.             // We check if animatronics are at the door
  562.             if (panAI.currentCamera != 4 && mikeyAI.currentCamera != 5)
  563.             {
  564.                 // We reset the time betwen movement
  565.                 panAI.timeBetwenMovement = Random.Range(PanAI.minTimeBetwenMovement, PanAI.maxTimeBetwenMovement);
  566.                 mikeyAI.timeBetwenMovement = Random.Range(MikeyAI.minTimeBetwenMovement, MikeyAI.maxTimeBetwenMovement);
  567.             }
  568.  
  569.             // We display the time on screen
  570.             nightHourText.text = $"{nightHour} AM";
  571.         }
  572.         else if (Mathf.Floor(amountOfTime) == 240f)
  573.         {
  574.             amountOfTime = 240f;
  575.             nightHour = 2;
  576.  
  577.             AIlevel.PanMovingTime();
  578.             AIlevel.MikeyMovingTime();
  579.  
  580.             if (panAI.currentCamera != 4 && mikeyAI.currentCamera != 5)
  581.             {
  582.                 panAI.timeBetwenMovement = Random.Range(PanAI.minTimeBetwenMovement, PanAI.maxTimeBetwenMovement);
  583.                 mikeyAI.timeBetwenMovement = Random.Range(MikeyAI.minTimeBetwenMovement, MikeyAI.maxTimeBetwenMovement);
  584.             }
  585.  
  586.             nightHourText.text = $"{nightHour} AM";
  587.         }
  588.         else if (Mathf.Floor(amountOfTime) == 180f)
  589.         {
  590.             amountOfTime = 180f;
  591.             nightHour = 3;
  592.  
  593.             AIlevel.PanMovingTime();
  594.             AIlevel.MikeyMovingTime();
  595.  
  596.             if (panAI.currentCamera != 4 && mikeyAI.currentCamera != 5)
  597.             {
  598.                 panAI.timeBetwenMovement = Random.Range(PanAI.minTimeBetwenMovement, PanAI.maxTimeBetwenMovement);
  599.                 mikeyAI.timeBetwenMovement = Random.Range(MikeyAI.minTimeBetwenMovement, MikeyAI.maxTimeBetwenMovement);
  600.             }
  601.  
  602.             nightHourText.text = $"{nightHour} AM";
  603.         }
  604.         else if (Mathf.Floor(amountOfTime) == 120f)
  605.         {
  606.             amountOfTime = 120f;
  607.             nightHour = 4;
  608.  
  609.             AIlevel.PanMovingTime();
  610.             AIlevel.MikeyMovingTime();
  611.  
  612.             if (panAI.currentCamera != 4 && mikeyAI.currentCamera != 5)
  613.             {
  614.                 panAI.timeBetwenMovement = Random.Range(PanAI.minTimeBetwenMovement, PanAI.maxTimeBetwenMovement);
  615.                 mikeyAI.timeBetwenMovement = Random.Range(MikeyAI.minTimeBetwenMovement, MikeyAI.maxTimeBetwenMovement);
  616.             }
  617.  
  618.             nightHourText.text = $"{nightHour} AM";
  619.         }
  620.         else if (Mathf.Floor(amountOfTime) == 60f)
  621.         {
  622.             amountOfTime = 60f;
  623.             nightHour = 5;
  624.  
  625.             AIlevel.PanMovingTime();
  626.             AIlevel.MikeyMovingTime();
  627.  
  628.             if (panAI.currentCamera != 4 && mikeyAI.currentCamera != 5)
  629.             {
  630.                 panAI.timeBetwenMovement = Random.Range(PanAI.minTimeBetwenMovement, PanAI.maxTimeBetwenMovement);
  631.                 mikeyAI.timeBetwenMovement = Random.Range(MikeyAI.minTimeBetwenMovement, MikeyAI.maxTimeBetwenMovement);
  632.             }
  633.  
  634.             nightHourText.text = $"{nightHour} AM";
  635.         }
  636.         else if (Mathf.Floor(amountOfTime) == 0f)
  637.         {
  638.             amountOfTime = 0f;
  639.             nightHour = 6;
  640.  
  641.             nightHourText.text = $"{nightHour} AM";
  642.             SceneManager.LoadSceneAsync("6AM");
  643.         }
  644.     }
  645.  
  646.     private void SetAIlevel()
  647.     {
  648.         // We set the AI agression level to a value depending on the night
  649.         if (night == 1)
  650.         {
  651.             PanAI.PanAIlevel = 1;
  652.             MikeyAI.MikeyAIlevel = 1;
  653.         }
  654.         else if (night == 2)
  655.         {
  656.             PanAI.PanAIlevel = 5;
  657.             MikeyAI.MikeyAIlevel = 5;
  658.         }
  659.         else if (night == 3)
  660.         {
  661.             PanAI.PanAIlevel = 5;
  662.             MikeyAI.MikeyAIlevel = 5;
  663.         }
  664.         else if (night == 4)
  665.         {
  666.             PanAI.PanAIlevel = 5;
  667.             MikeyAI.MikeyAIlevel = 5;
  668.         }
  669.         else if (night == 5)
  670.         {
  671.             PanAI.PanAIlevel = 5;
  672.             MikeyAI.MikeyAIlevel = 5;
  673.         }
  674.     }
  675.  
  676.     private void StaticEffectToNormalOppacity()
  677.     {
  678.         // Sets the static effect to his normal opacity
  679.         staticEffect.CrossFadeAlpha(1, 0.1f, false);
  680.     }
  681.  
  682.     private void ActivateCallButton()
  683.     {
  684.         // Activates the mute call button
  685.         callButton.SetActive(true);
  686.     }
  687.  
  688.     private void RemoveCallButton()
  689.     {
  690.         // Disables the mute call button
  691.         callButton.SetActive(false);
  692.     }
  693.  
  694.     private void StaticEffect()
  695.     {
  696.         // It switches betwen each texture from the array in a short amount of time
  697.         timeBetwenTextures -= Time.deltaTime;
  698.  
  699.         if (timeBetwenTextures < 0)
  700.         {
  701.             timeBetwenTextures = 0;
  702.         }
  703.  
  704.         if (timeBetwenTextures == 0)
  705.         {
  706.             currentTexture++;
  707.             currentTexture %= staticEffectTextures.Length;
  708.             staticEffect.texture = staticEffectTextures[currentTexture];
  709.             timeBetwenTextures = 0.08f;
  710.         }
  711.     }
  712. }
  713.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement