Exemplo n.º 1
0
    void OnTriggerStay2D(Collider2D col)
    {
        if (col.tag == "Player")
        {
            print("Nilan is touching this");
            if (Input.GetButtonDown("Interact"))
            {
                if (timeRemainingToDisplayhint > 0 && !string.IsNullOrEmpty(hint))
                {
                    print("Nilan is trying to interact with this");
                    hintbox.UseMessageBox(gameObject, HintBoxController.Mode.activateMessage, hint);
                    timeRemainingToDisplayhint--;
                    hintDisplayed = true;
                }
            }

            if (timeRemaningToDisplayFlash > 0 && !string.IsNullOrEmpty(flashingText))
            {
                print("Trying to flash text");
                flashText.UseFlashMsg(gameObject, FlashingTextController.Mode.activateMessage, flashingText);
                flashingTextDisplayed = true;
                if (Input.GetKeyDown(KeyCode.F))
                {
                    flashText.UseFlashMsg(gameObject, FlashingTextController.Mode.permanentlyDeactivateFlash, flashingText);
                }
            }
        }
    }
Exemplo n.º 2
0
    void OnTriggerStay2D(Collider2D col)
    {
        if (col.tag == "Player")
        {
            if (col.transform.localScale.y <= 0.5f)
            {
                puzzlepiece.GetComponent <BoxCollider2D>().enabled = true;
            }
            if (col.transform.localScale.y >= 0.5f)
            {
                puzzlepiece.GetComponent <BoxCollider2D>().enabled = false;
                //hintBox.GetComponent<HintText>().hintText = hint;
                //hintBox.SetActive(true);
            }
            if (Input.GetButtonDown("Interact"))
            {
                if (col.transform.localScale.y >= 0.5f)
                {
                    puzzlepiece.GetComponent <BoxCollider2D>().enabled = false;
//					hintBox.GetComponent<HintText>().UpdateText( hint);
//					hintBox.SetActive(true);
                }

                flashText.UseFlashMsg(gameObject, FlashingTextController.Mode.permanentlyDeactivateFlash, "");
                hasAlreadyInteracted = true;
                GetComponent <ZoomIntoScene>().enabled = true;
                hintbox.UseMessageBox(puzzlepiece, HintBoxController.Mode.activateMessage, hint);
            }
        }
    }
Exemplo n.º 3
0
 void OnTriggerStay2D(Collider2D col)
 {
     if (col.gameObject.tag == "MonsterRegion")
     {
         if (Input.GetButtonDown("Interact"))
         {
             if (player.GetComponent <Holder>().hasCage)
             {
                 // Traps enemy
                 flashText.UseFlashMsg(gameObject, FlashingTextController.Mode.permanentlyDeactivateFlash, "");
                 Instantiate(cage, col.gameObject.transform.position, cage.transform.rotation);
                 col.gameObject.transform.parent.GetComponent <MonsterBehaviour>().enabled = false;
                 col.gameObject.transform.parent.GetComponent <Animator>().enabled         = false;
                 col.gameObject.transform.parent.gameObject.collider2D.enabled             = false;
                 col.gameObject.transform.parent.gameObject.tag = "Untagged";
                 col.gameObject.transform.parent.gameObject.rigidbody2D.gravityScale = 0f;
                 player.GetComponent <Holder>().hasCage = false;
                 // Open exit tunnel
                 GameObject.FindGameObjectWithTag("Director").GetComponent <Director>().FinishedLevel();
             }
             else
             {
                 // hint box
                 flashText.UseFlashMsg(gameObject, FlashingTextController.Mode.permanentlyDeactivateFlash, "");
                 hasAlreadyInteracted = true;
                 hintBox.UseMessageBox(gameObject, HintBoxController.Mode.activateMessage, hint);
             }
         }
     }
 }
Exemplo n.º 4
0
    void OnTriggerStay2D(Collider2D col)
    {
        if (col.tag == "Player")
        {
            if (flashNow)
            {
                flashText.UseFlashMsg(gameObject, FlashingTextController.Mode.activateMessage, flashMessage);
            }
            if (Input.GetButtonDown("Interact"))
            {
                soundDirector.play(SoundDirector.Mode.eventSuccess);
                for (int i = 0; i < poweredUpObjects.Length; i++)
                {
                    poweredUpObjects[i].SendMessage("TurnPowerOn");
                }



                hintbox.UseMessageBox(gameObject, HintBoxController.Mode.activateMessage, messageText);
                hasActivated = true;
                flashText.UseFlashMsg(gameObject, FlashingTextController.Mode.permanentlyDeactivateFlash, "");

                flashNow = false;
            }
        }
    }
Exemplo n.º 5
0
    IEnumerator BeenKilledOnce()
    {
        yield return(new WaitForSeconds(3f));

        hintbox.UseMessageBox(gameObject, HintBoxController.Mode.activateMessage, "Watch out for the spikes!");
        yield return(new WaitForSeconds(3f));

        hintbox.UseMessageBox(gameObject, HintBoxController.Mode.permanentlyDeactivateBox, "Watch out for the spikes!");
        hasBeenKilledNTimes++;
    }
Exemplo n.º 6
0
    void OnTriggerStay2D(Collider2D col)
    {
        if (col.tag == "Player")
        {
            print("Nilan is touching this");

            if (!hintDisplayed && !string.IsNullOrEmpty(hint))
            {
                hintbox.UseMessageBox(gameObject, HintBoxController.Mode.activateMessage, hint);
                timeRemainingToDisplayhint--;
                hintDisplayed = true;
            }
        }
    }
Exemplo n.º 7
0
 void OnCollisionStay2D(Collision2D col)
 {
     if (Input.GetButtonDown("Interact"))
     {
         if ((player.GetComponent <Holder>().hasKey) && (isClosed))
         {
             OpenDoor();
             player.GetComponent <Holder>().hasKey = false;
             flashText.UseFlashMsg(player, FlashingTextController.Mode.permanentlyDeactivateFlash, "");
         }
         else
         {
             // Use hint
             flashText.UseFlashMsg(player, FlashingTextController.Mode.permanentlyDeactivateFlash, "");
             hasAlreadyInteracted = true;
             hintBox.UseMessageBox(player, HintBoxController.Mode.activateMessage, hint);
         }
     }
 }
Exemplo n.º 8
0
    void OnPickup()
    {
        if (eventToActivate != null)
        {
            eventToActivate.SendMessage("PuzzlePiecePickedUp");
        }

        //disable the hintbox for this puzzlePiece
        soundDirector.play(SoundDirector.Mode.pickup);
        hintbox.UseMessageBox(this.gameObject, HintBoxController.Mode.permanentlyDeactivateBox, "");
    }
Exemplo n.º 9
0
    void OnTriggerStay2D(Collider2D col)
    {
        if (col.tag == "Player")
        {
            if (!hasSeenPressE && !string.IsNullOrEmpty(hint))
            {
                flashText.UseFlashMsg(gameObject, FlashingTextController.Mode.activateMessage, pressE);
            }
            if (Input.GetButtonDown("Interact") && !string.IsNullOrEmpty(hint))
            {
                if (!hasInsertedFirstPuzzle)
                {
                    hintbox.UseMessageBox(gameObject, HintBoxController.Mode.activateMessage, hint);
                }

                flashText.UseFlashMsg(gameObject, FlashingTextController.Mode.deactivateFlashText, pressE);
                hasSeenPressE = true;
            }
        }
    }
Exemplo n.º 10
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Keypad5))
        {
            if (goingUp)
            {
                transform.position = Vector3.up * 400;
                goingUp            = false;
            }
            else
            {
                transform.position = voidPosition;
                goingUp            = true;
            }
        }

        if (Input.GetKey(KeyCode.Keypad4))
        {
            transform.position = transform.position - Vector3.right * distance;
        }
        if (Input.GetKey(KeyCode.Keypad6))
        {
            transform.position = transform.position + Vector3.right * distance;
        }
        if (Input.GetKey(KeyCode.Keypad8))
        {
            transform.position = transform.position + Vector3.up * distance;
        }
        if (Input.GetKey(KeyCode.Keypad2))
        {
            transform.position = transform.position - Vector3.up * distance;
        }

        if (Input.GetKeyDown(KeyCode.F1))
        {
            if (disableShrink)
            {
                GetComponent <ShrinkPlayer>().enabled = false;
                disableShrink = false;
            }
            else
            {
                GetComponent <ShrinkPlayer>().enabled = true;
                disableShrink = true;
            }
        }
        if (Input.GetKeyDown(KeyCode.F2))
        {
            shrink.shrinkingSpeed += 0.001f;
        }
        if (Input.GetKeyDown(KeyCode.F3))
        {
            shrink.shrinkingSpeed -= 0.001f;
        }
        if (Input.GetKeyDown(KeyCode.F4))
        {
            shrink.shrinkingSpeed = 0f;
        }

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (ShowControls)
            {
                hintbox.UseMessageBox(this.gameObject, HintBoxController.Mode.activateMessage, controls);
                ShowControls = false;
            }
            else
            {
                hintbox.UseMessageBox(this.gameObject, HintBoxController.Mode.deactivateTextBox, controls);
                ShowControls = true;
            }
        }
    }
Exemplo n.º 11
0
 void DisplayMessage()
 {
     hintbox.UseMessageBox(gameObject, HintBoxController.Mode.activateMessage, message);
 }