public void ActivateScreens() { DeactiveScreenImage.sprite = ActiveScreenSprite; if (!_morsecodeSolved) { if (!SaveHandler.GetValueByProperty("Room02", this.name, "MessageReceived", out bool messageReceived)) { StartCoroutine(WriteMessageCoroutine); } else { UITextReceive.text = MorsecodeReceivedMessage; } } if (_morsecodeSolved) { if (UITextSend && EndMessage != string.Empty) { UITextReceive.text = MorsecodeReceivedMessage; UITextSend.text = EndMessage; } } }
private void Awake() { if (SaveHandler.GetValueByProperty(SceneManager.GetActiveScene().name, "Corner Pipe (Empty Gameobject)", "CornerPipePlaced", out bool cornerTubeIsPlaced)) { CornerTubeIsPlaced = cornerTubeIsPlaced; } if (SaveHandler.GetValueByProperty(SceneManager.GetActiveScene().name, "Straight Pipe (Empty Gameobject)", "StraightPipePlaced", out bool straightTubeIsPlaced)) { StraigthTubeIsPlaced = straightTubeIsPlaced; } if (SaveHandler.GetValueByProperty(SceneManager.GetActiveScene().name, name, "HasCylinder", out bool hasCylinder)) { HasCylinder = hasCylinder; UseSpriteMachineWithCylinder(); } if (HasCylinder && CornerTubeIsPlaced && StraigthTubeIsPlaced) { MachineIsActivated = true; //Play music ActivateMusic(); //Update sprite to the machine that has the cylinder //Destroy the Cylinder gameobject already present in the scene (Only destroy the cylinder that is needed to activate this machine) UseSpriteMachineWithCylinder(); } }
public void Awake() { if (SaveHandler.GetValueByProperty(SceneManager.GetActiveScene().name, "Pipe[image]", "HasBeenDelivered", out bool hasBeenDelivered)) { _hasBeenDelivered = hasBeenDelivered; Destroy(GameobjectToReceive); } }
private void FixedUpdate() { if (PopupMenu.isPopupOpen && SaveHandler.GetValueByProperty(SceneManager.GetActiveScene().name, "DeliveryTube", "HasTube", out bool hasTube)) { _image.enabled = true; MovePipe(_movement); } }
private void Awake() { if (SaveHandler.GetValueByProperty(SceneManager.GetActiveScene().name, name, "IsAbove", out bool isAbove)) { IsAbove = isAbove; } SetBarrierPos(); }
public void Start() { WriteMessageCoroutine = WritingMessage(UITextReceive, MorsecodeReceivedMessage, TypeSpeed, MorsecodeReceivedPauseDuration, 0); if (SaveHandler.GetValueByProperty("Room02", "MorsecodeMachine[canvas]", "MorsecodeSend", out bool morsecodeSolved)) { _morsecodeSolved = morsecodeSolved; } }
private void Awake() { _spriteRenderer = GetComponent <SpriteRenderer>(); if (SaveHandler.GetValueByProperty(SceneManager.GetActiveScene().name, name, ItemSaveProperty, out bool hasItem)) { _hasItem = hasItem; AddItem(); } }
private void Awake() { if (SaveHandler.GetValueByProperty(SceneManager.GetActiveScene().name, name, ItemProperty, out bool isPickedup)) { if (isPickedup) { Destroy(this.gameObject); } } }
private void Start() { _rigidbody = gameObject.GetComponent <Rigidbody2D>(); _image = gameObject.GetComponent <Image>(); if (SaveHandler.GetValueByProperty(SceneManager.GetActiveScene().name, "Pipe[image]", "HasBeenDelivered", out bool hasBeenDelivered)) { Destroy(gameObject); } }
private void Update() { if (!_isPipeDelivered) { if (SaveHandler.GetValueByProperty(SceneManager.GetActiveScene().name, "Pipe[image]", "HasBeenDelivered", out bool hasItem)) { _isPipeDelivered = true; _spriteRenderer.enabled = false; } } }
// Update is called once per frame void Update() { if (!_isDooropen) { if (!PopupMenu.isPopupOpen && SaveHandler.GetValueByProperty(SceneManager.GetActiveScene().name, "Pipe[image]", "HasBeenDelivered", out bool hasBeenDelivered)) { GetComponent <Animator>().Play("DoorAnimation"); _isDooropen = true; } } }
public void Update() { if (!isMachineActive) { //check if previous puzzels have been solved before unlocking machine | ceiling has a typo if (SaveHandler.GetValueByProperty(SceneManager.GetActiveScene().name, "FixedPipe", "HasPipe", out bool hasPipe) && SaveHandler.GetValueByProperty("Room01", "CeillingHole (Empty GO)", "HasPlank", out bool hasPlank)) { ActivateMachine(); } } }
public override bool Interact(Item item) { bool succesfulInteraction = false; if (item) { if (!_hasItem && item && item == ItemNeeded) { succesfulInteraction = true; _hasItem = true; FindObjectOfType <AudioManager>().PlaySound("Item placed right"); AddItem(); SaveHandler.SaveLevel(this.name, ItemSaveProperty, true); } else { FindObjectOfType <AudioManager>().PlaySound("Item placed wrong"); } } else { if (IsDoorLocked) { if (SaveHandler.GetValueByProperty(SceneManager.GetActiveScene().name, KeyGameobject, KeyProperty, out bool isUnlocked)) { if (LevelName != string.Empty) { FindObjectOfType <AudioManager>().PlaySound("Unlocked"); _levelLoader.LoadNextLevel(LevelName, PlayCutscene, Audio); succesfulInteraction = true; } else { FindObjectOfType <AudioManager>().PlaySound("Locked"); } } } else { if (LevelName != string.Empty) { _levelLoader.LoadNextLevel(LevelName, PlayCutscene, Audio); succesfulInteraction = true; } } } return(succesfulInteraction); }
void Update() { if (!SaveHandler.GetValueByProperty(SceneManager.GetActiveScene().name, name, "IsDoorOpen", out bool IsDoorOpen)) { if (!PopupMenu.isPopupOpen && SaveHandler.GetValueByProperty(SceneManager.GetActiveScene().name, "Pipe[image]", "HasBeenDelivered", out bool hasBeenDelivered)) { GetComponent <Animator>().Play("DoorAnimation"); FindObjectOfType <AudioManager>().PlaySound("Electric door"); SaveHandler.SaveLevel(this.name, "IsDoorOpen", true); } } }
private void Awake() { if (SaveHandler.GetValueByProperty("Room01", "CeillingHole (Empty GO)", "HasPlank", out bool hasPlank)) { if (!hasPlank) { ParticleCollision.gameObject.SetActive(true); } } else { ParticleCollision.gameObject.SetActive(true); } }
public void ActivateMachine() { isMachineActive = true; if (!SaveHandler.GetValueByProperty(SceneManager.GetActiveScene().name, name, "soundHasPlayed", out bool hasPlayed)) { FindObjectOfType <AudioManager>().PlaySound("Morsecodemachine activates"); } SaveHandler.SaveLevel(this.name, "soundHasPlayed", true); if (morsecodeMachineActive) { morsecodeMachineDeactive.sprite = morsecodeMachineActive; } }
private void Update() { if (SaveHandler.GetValueByProperty(SceneManager.GetActiveScene().name, KeyGameobject, KeyProperty, out bool isUnlocked)) { _isUnlocked = isUnlocked; } if (IsDoorLocked) { if (_isUnlocked && !SaveHandler.GetValueByProperty(SceneManager.GetActiveScene().name, this.name, "SoundHasPlayed", out bool SoundHasPlayed)) { FindObjectOfType <AudioManager>().PlaySound("Unlocked"); SaveHandler.SaveLevel(this.name, "SoundHasPlayed", true); } } }
public override void Awake() { if (SaveHandler.GetValueByProperty(SceneManager.GetActiveScene().name, name, "IsSolved", out bool isSolved)) { IsSolved = isSolved; } base.Awake(); if (IsSolved) { OpenHatch(); for (int i = 0; i < _solution.Length; i++) { Textboxes[i].text = _solution[i].ToString(); } } }
private void Awake() { if (SaveHandler.GetValueByProperty(SceneManager.GetActiveScene().name, name, "IsOn", out bool isOn)) { IsOn = isOn; } if (SaveHandler.GetValueByProperty(SceneManager.GetActiveScene().name, name, "HasLever", out bool hasLever)) { HasLever = hasLever; } if (HasLever) { AddLever(); } SetLeverState(); }
private void Update() { if (!MachineIsActivated && HasCylinder && CornerTubeIsPlaced && StraigthTubeIsPlaced) { MachineIsActivated = true; UseSpriteMachineWithCylinder(); ActivateMusic(); } if (MachineIsActivated) { return; } if (!CornerTubeIsPlaced && SaveHandler.GetValueByProperty(SceneManager.GetActiveScene().name, "Corner Pipe (Empty Gameobject)", "CornerPipePlaced", out bool cornerTubeIsPlaced)) { CornerTubeIsPlaced = cornerTubeIsPlaced; } if (!StraigthTubeIsPlaced && SaveHandler.GetValueByProperty(SceneManager.GetActiveScene().name, "Straight Pipe (Empty Gameobject)", "StraightPipePlaced", out bool straightTubeIsPlaced)) { StraigthTubeIsPlaced = straightTubeIsPlaced; } RaycastHit2D[] rayHitInfo = Physics2D.RaycastAll(transform.position, Vector2.right, 3f, LayerMask.GetMask("Obstacle")); for (int i = 0; i < rayHitInfo.Length; i++) { RaycastHit2D rayHit = rayHitInfo[i]; if (rayHit.transform.parent && rayHit.transform.parent.gameObject == this.gameObject && rayHit.transform.gameObject != this.gameObject)//Check if de root.gameobject werkt { //Check if the rayhit is not colliding with the machine itself (The machine belongs to the obstacle layer aswell) continue; } if (rayHit.transform.gameObject != null && rayHit.transform.gameObject == CylinderToActivateTheMachine) { //Collided with the cylidner that activates this machine HasCylinder = true; UseSpriteMachineWithCylinder(); } } }
void Update() { if (SaveHandler.GetValueByProperty(LevelWherePuzzleHasBeenSolved, NameOfPuzzleThatHasBeenSolved, NameOfItemPropertyThatHasBeenSolved, out bool hasMorsecodeMessage)) { if (greenLight) { FindObjectOfType <AudioManager>().PlaySound("Light change"); if (_spriteRenderer) { _spriteRenderer.sprite = greenLight; } else { _imageRenderer.sprite = greenLight; } } } }
void Awake() { if (SaveHandler.GetValueByProperty(SceneManager.GetActiveScene().name, name, "HasPlank", out bool hasPlank)) { _hasPlank = hasPlank; if (_hasPlank) { AddPlank(); } else { _particleSystem.gameObject.SetActive(true); } } else { _particleSystem.gameObject.SetActive(true); } }
public override bool Interact(Item item) { bool succesfullInteraction = false; if (item) { return(false); } if (IsDoorLocked) { if (SaveHandler.GetValueByProperty(SceneManager.GetActiveScene().name, KeyGameobject, KeyProperty, out bool isUnlocked)) { if (LevelName != string.Empty) { FindObjectOfType <AudioManager>().PlaySound("Unlocked"); _levelLoader.LoadNextLevel(LevelName, PlayCutscene, Audio); succesfullInteraction = true; } else { FindObjectOfType <AudioManager>().PlaySound("Locked"); } } } else { if (LevelName != string.Empty) { _levelLoader.LoadNextLevel(LevelName, PlayCutscene, Audio); succesfullInteraction = true; } } return(succesfullInteraction); }