Ejemplo n.º 1
0
    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;
            }
        }
    }
Ejemplo n.º 2
0
    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();
        }
    }
Ejemplo n.º 3
0
 public void Awake()
 {
     if (SaveHandler.GetValueByProperty(SceneManager.GetActiveScene().name, "Pipe[image]", "HasBeenDelivered", out bool hasBeenDelivered))
     {
         _hasBeenDelivered = hasBeenDelivered;
         Destroy(GameobjectToReceive);
     }
 }
Ejemplo n.º 4
0
 private void FixedUpdate()
 {
     if (PopupMenu.isPopupOpen && SaveHandler.GetValueByProperty(SceneManager.GetActiveScene().name, "DeliveryTube", "HasTube", out bool hasTube))
     {
         _image.enabled = true;
         MovePipe(_movement);
     }
 }
Ejemplo n.º 5
0
    private void Awake()
    {
        if (SaveHandler.GetValueByProperty(SceneManager.GetActiveScene().name, name, "IsAbove", out bool isAbove))
        {
            IsAbove = isAbove;
        }

        SetBarrierPos();
    }
Ejemplo n.º 6
0
    public void Start()
    {
        WriteMessageCoroutine = WritingMessage(UITextReceive, MorsecodeReceivedMessage, TypeSpeed, MorsecodeReceivedPauseDuration, 0);

        if (SaveHandler.GetValueByProperty("Room02", "MorsecodeMachine[canvas]", "MorsecodeSend", out bool morsecodeSolved))
        {
            _morsecodeSolved = morsecodeSolved;
        }
    }
Ejemplo n.º 7
0
    private void Awake()
    {
        _spriteRenderer = GetComponent <SpriteRenderer>();

        if (SaveHandler.GetValueByProperty(SceneManager.GetActiveScene().name, name, ItemSaveProperty, out bool hasItem))
        {
            _hasItem = hasItem;
            AddItem();
        }
    }
Ejemplo n.º 8
0
 private void Awake()
 {
     if (SaveHandler.GetValueByProperty(SceneManager.GetActiveScene().name, name, ItemProperty, out bool isPickedup))
     {
         if (isPickedup)
         {
             Destroy(this.gameObject);
         }
     }
 }
Ejemplo n.º 9
0
    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);
        }
    }
Ejemplo n.º 10
0
 private void Update()
 {
     if (!_isPipeDelivered)
     {
         if (SaveHandler.GetValueByProperty(SceneManager.GetActiveScene().name, "Pipe[image]", "HasBeenDelivered", out bool hasItem))
         {
             _isPipeDelivered        = true;
             _spriteRenderer.enabled = false;
         }
     }
 }
Ejemplo n.º 11
0
 // 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;
         }
     }
 }
Ejemplo n.º 12
0
 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);
    }
Ejemplo n.º 14
0
    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);
            }
        }
    }
Ejemplo n.º 15
0
 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);
     }
 }
Ejemplo n.º 16
0
    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);
            }
        }
    }
Ejemplo n.º 18
0
    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();
            }
        }
    }
Ejemplo n.º 19
0
    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();
    }
Ejemplo n.º 20
0
    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();
            }
        }
    }
Ejemplo n.º 21
0
    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;
                }
            }
        }
    }
Ejemplo n.º 22
0
 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);
     }
 }
Ejemplo n.º 23
0
    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);
    }