void OnTriggerExit2D(Collider2D other)
 {
     if (other.name == "Player")
     {
         theTextBox.DisableTextBox();
     }
 }
    // Update is called once per frame
    void Update()
    {
        // Loop through all the currently trackable objects
        foreach (TrackableBehaviour track in TrackerManager.Instance.GetStateManager().GetTrackableBehaviours())
        {
            // If this image is currently being tracked
            if (track == ImgBehaviour)
            {
                if (track.CurrentStatus == TrackableBehaviour.Status.TRACKED || track.CurrentStatus == TrackableBehaviour.Status.EXTENDED_TRACKED)
                {
                    // Tell the console this object was found by the AR camera
                    print("Tracked");
                    if (visibleLastFrame == false)
                    {
                        // Start the take off animation and set the visible bool to true
                        print("Found image");
                        TakeOff();
                        visibleLastFrame = true;

                        // Activate the text box to show information about this object
                        textBoxManager.isActive = true;
                        textBoxManager.EnableTextBox();

                        joystick.SetActive(true);
                    }
                }
                if (track.CurrentStatus == TrackableBehaviour.Status.NOT_FOUND)
                {
                    if (visibleLastFrame == true)
                    {
                        print("Lost image");
                        visibleLastFrame = false;

                        // Disable the text box once this object has been lost and is no longer being tracked
                        textBoxManager.isActive = false;
                        textBoxManager.DisableTextBox();

                        joystick.SetActive(false);

                        // If Unity3D has reached the end of the file, loop back round again incase user wants to reread anything
                        if (textBoxManager.currentLine > textBoxManager.endLine)
                        {
                            textBoxManager.currentLine = 0;
                        }
                    }
                }
            }
        }



        Vector3 movement = new Vector3(x, 0, y);

        // Select how fast the airship will move around the scene
        rb.velocity = movement * 4;

        // Set the rotation of the airship
        transform.eulerAngles = new Vector3(transform.eulerAngles.x, Mathf.Atan2(x, y) * Mathf.Rad2Deg, transform.eulerAngles.z);
    }
Example #3
0
    // Update is called once per frame
    void Update()
    {
        if (GetComponentInParent <MerchantStateMachine>().m_state != "IDLE")
        {
            return;
        }

        _theManager.DisableTextBox();
        m_buttons.SetActive(false);
    }
 // Use this for initialization
 void Start()
 {
     VildracSpriteRenderer = Vildrac.GetComponent <SpriteRenderer>();
     VildracAnimator       = Vildrac.GetComponent <Animator>();
     CouloirAnimator       = Background.GetComponent <Animator>();
     VildracSpriteRenderer.material.color = new Color(1.0f, 1.0f, 1.0f, Alpha);
     textBoxManager = TextBoxManager.getInstance();
     textBoxManager.DisableTextBox();
     CouloirAnimator.SetBool("isOpen", true);
     VildracAnimator.SetBool("isColere", false);
     VildracAnimator.SetBool("isAlcolo", false);
 }
Example #5
0
 void OnTriggerStay(Collider other)
 {
     if (other.tag == "Player")
     {
         GameObject target;
         target = other.GetComponent <PlayerControl>().getTarget();
         if (target == transform.parent.gameObject)
         {
             WhoIsTargetingMe = other.gameObject;
             playerInZone     = true;
             if (parent != null)
             {
                 if (parent.diagnosed)
                 {
                     textBoxManager.EnableTextBox(parent);
                 }
                 else
                 {
                     textBoxManager.EnableTextBoxNotDiagnozed(parent);
                 }
             }
             else
             {
                 textBoxManager.DisableTextBox();
             }
         }
         else
         {
             playerInZone = false;
         }
     }
     else if (other.tag == "NPC" && other.gameObject == WhoIsTargetingMe)
     {
         NPC npc = other.GetComponent <NPC>();
         if (npc.myState == NPC.NPCState.STATE_DEAD)
         {
             WhoIsTargetingMe = null;
         }
     }
 }
 private void OnTriggerExit2D(Collider2D collision)
 {
     if (collision.tag == "Player")
     {
         infoBox.DisableTextBox();
         foreach (GameObject textBox in subtextBoxes)
         {
             textBox.SetActive(false);
         }
         playerPurchasing = false;
         _animator.setAnimation(_idle);
     }
 }
    // Update is called once per frame
    void Update()
    {
        transform.Rotate(0, 1, 0);

        //Vector3 move = new Vector3(1, 0, 0);

        //rb.AddForce(move * speed);

        // Loop through all the currently trackable objects
        foreach (TrackableBehaviour track in TrackerManager.Instance.GetStateManager().GetTrackableBehaviours())
        {
            // If this image is currently being tracked
            if (track == ImgBehaviour)
            {
                if (track.CurrentStatus == TrackableBehaviour.Status.TRACKED || track.CurrentStatus == TrackableBehaviour.Status.EXTENDED_TRACKED)
                {
                    // Tell the console this object was found by the AR camera
                    print("Tracked");
                    if (visibleLastFrame == false)
                    {
                        // Start the take off animation and set the visible bool to true
                        print("Found image");
                        TakeOff();
                        visibleLastFrame = true;

                        // Activate the text box to show information about this object
                        textBoxManager.isActive = true;
                        textBoxManager.EnableTextBox();
                    }
                }
                if (track.CurrentStatus == TrackableBehaviour.Status.NOT_FOUND)
                {
                    if (visibleLastFrame == true)
                    {
                        print("Lost image");
                        visibleLastFrame = false;

                        // Disable the text box once this object has been lost and is no longer being tracked
                        textBoxManager.isActive = false;
                        textBoxManager.DisableTextBox();

                        // If Unity3D has reached the end of the file, loop back round again incase user wants to reread anything
                        if (textBoxManager.currentLine > textBoxManager.endLine)
                        {
                            textBoxManager.currentLine = 0;
                        }
                    }
                }
            }
        }
    }
Example #8
0
 // Update is called once per frame
 void Update()
 {
     if (waitForPress && Input.GetKeyDown(KeyCode.Return))
     {
         theTextBox.ReloadScript(theText);
         theTextBox.currentLine = startLine;
         theTextBox.endAtLine   = endLine;
         theTextBox.EnableTextBox();
     }
     if (isTrigger == false)
     {
         theTextBox.DisableTextBox();
     }
 }
Example #9
0
    // Update is called once per frame
    void Update()
    {
        KeyPressedUpdate();
        if (getTrigger() && !pauseBox && Time.timeScale == 1)
        {
            if (!textboxManager.isTyping)
            {
                textboxManager.currentLine += 1;

                if (textboxManager.currentLine > textboxManager.endAtLine)
                {
                    textboxManager.DisableTextBox();
                }
                else
                {
                    TutorialUpdate();
                }
            }
            else if (textboxManager.isTyping && !textboxManager.cancelTyping) //interrupts typing
            {
                textboxManager.cancelTyping = true;
            }
        }
    }
Example #10
0
    // Update is called once per frame
    void Update()
    {
        transform.position = attachedEnemy.transform.position; //keep collider following enemy

        if (playerSpotted && textBox.currentLine > endLine)
        {
            attachedEnemy.runningToPlayer = true;
            //once dialogue is over, begin chasing the player
            PlayerController.isTalking = false;

            if (destroyWhenFinished)
            {
                textBox.DisableTextBox();
                playerSpotted = false;
            }
        }
    }
    private void Update()
    {
        if ((gs.visionLevel + 1) <= visionPoints.visionPoints / 100)
        {
            Debug.Log("Load Vision");
            gs.visionLevel += 1;
            sc.FadeToLevel("VisionScene");
        }

        if (Input.GetAxisRaw("Cancel") != 0)
        {
            Debug.Log("Quit!");
            Application.Quit();
        }

        if (Input.GetAxisRaw("Submit") > 0)
        {
            if (submit_pressed == false)
            {
                s_textBoxManager.DisableTextBox();
                submit_pressed = true;
            }
        }

        if (Input.GetAxisRaw("Submit") == 0)
        {
            submit_pressed = false;
        }

        if (!music.isPlaying)
        {
            timecheck += Time.deltaTime;
            if (timecheck > 0.5f)
            {
                mixer.SetFloat("MusicVolume", -10.0f);
                timecheck = 0.0f;
            }
        }
    }
Example #12
0
 void OnTriggerExit2D(Collider2D collision)
 {
     infoBox.DisableTextBox();
 }
    // Update is called once per frame
    void Update()
    {
        if (Time.timeScale == 0f)
        {
            return;
        }



        if (Grounded)
        {
            DoubleJumped = false;
        }
        ;                             // Double Jump
        anim.SetBool("Grounded", Grounded);

        if (Input.GetButtonDown("Submit"))
        {
            theTextBox.DisableTextBox();
        }


#if UNITY_STANDALONE || UNITY_WEBPLAYER
        if (Input.GetButtonDown("Jump") && Grounded)
        {
            JumpFunction();
            JumpSound.Play();
        }


        if (Input.GetButtonDown("Jump") && !DoubleJumped && !Grounded)   // Double Jump
        {
            JumpFunction();
            JumpSound.Play();

            DoubleJumped = true;
        }   // Double Jump


        //Velocity = 0f;  // Con esta nueva variable hacemos que no se dezlice el personaje en el piso al utilizar el Player Material en el BoxCollider para que se deslice por las paredes y no se quede pegado.

        /*if (Input.GetKey(KeyCode.RightArrow))
         * {
         *  Velocity = Speed;
         *
         * }
         *
         * if (Input.GetKey(KeyCode.LeftArrow))
         * {
         *  Velocity = -Speed;
         * }*/

        //Velocity = Speed * Input.GetAxisRaw("Horizontal");
        Move(Input.GetAxisRaw("Horizontal"));
#endif



        if (KnockbackCount <= 0)
        {
            GetComponent <Rigidbody2D>().velocity = new Vector2(Velocity, GetComponent <Rigidbody2D>().velocity.y);
        }                                                                                                           // Esto arregla el que no se dezlice el personaje, por eso se comenta lo de arriba.
        else
        {
            if (RightKnock)
            {
                GetComponent <Rigidbody2D>().velocity = new Vector2(-Knockback, Knockback);
            }
            if (!RightKnock)
            {
                GetComponent <Rigidbody2D>().velocity = new Vector2(Knockback, Knockback);
            }

            KnockbackCount -= Time.deltaTime;
        }
        anim.SetFloat("Speed", Mathf.Abs(GetComponent <Rigidbody2D>().velocity.x));

        if (GetComponent <Rigidbody2D>().velocity.x > 0)
        {
            transform.localScale = new Vector3(0.8f, 0.8f, 0.8f);
        }                                                                                                          //Dar vuelta el Sprite y todas las animaciones.
        else if (GetComponent <Rigidbody2D>().velocity.x < 0)
        {
            transform.localScale = new Vector3(-0.8f, 0.8f, 0.8f);
        }                                                                                                              // cont.

#if UNITY_STANDALONE || UNITY_WEBPLAYER
        if (Input.GetButtonDown("Fire1"))
        {
            //Instantiate(LightingAttack, FirePoint.position, FirePoint.rotation);
            FireGun();
        }

        if (!isReady)
        {
            KiDelayCounter -= Time.deltaTime;
        }

        if (KiDelayCounter <= 0)
        {
            isReady        = true;
            KiDelayCounter = KiDelay;
        }


        if (anim.GetBool("Ki"))
        {
            //anim.SetBool("Ki",false);
            ResetKi();
        }

        /*if(Input.GetKeyDown(KeyCode.C))
         * {
         *  anim.SetBool("Ki",true);
         * KiSound.Play();
         * KiDelayCounter = KiDelay;
         * } */

        if (Input.GetButtonDown("Fire2"))
        {
            //KiDelayCounter -= Time.deltaTime;

            //if(KiDelayCounter <= 0)
            if (isReady)
            {
                isReady = false;
                //KiDelayCounter = KiDelay;
                //anim.SetBool("Ki",true);
                KiAttack();
            }
        }
#endif
    }
Example #14
0
    // Update is called once per frame
    void Update()
    {
        if (playerTurn && enemy.hp > 0 && player.gold >= 0 && !textBox2.isActive)
        {
            textBox2.ReloadScript(generalText);
            textBox2.currentLine = startLine;
            textBox2.endAtLine   = endLine;
            textBox2.EnableTextBox();
            playerTurn = false;
            Debug.Log("Player turn started");
            atkType.startSelection = true;
            playerMakeMove         = true;
        }
        if (playerMakeMove)
        {
            if (atkType.selectionComplete)
            {
                Debug.Log("Selection complete.");
                if (atkType.chosen == 0)       // Regular attack
                {
                    atkType.selectionComplete = false;
                    playerMakeMove            = false;
                    Debug.Log("ATTACK");
                    playerTurn = false;
                    textBox2.ReloadScript(atkText);
                    textBox2.currentLine = startLine;
                    textBox2.endAtLine   = endLine;
                    textBox2.EnableTextBox();
                    // atk animation
                    if (player.atk >= enemy.def)
                    {
                        enemy.hp -= player.atk - enemy.def;
                    }
                    else
                    {
                        enemy.hp--;
                    }
                    enemyTurn = true;
                }
                else if (atkType.chosen == 1)
                {
                    atkType.selectionComplete = false;
                    playerMakeMove            = false;
                    playerTurn = false;
                    skillType.startSelection = true;
                    if (skillType.startSelection == false)
                    {
                        // do selection stuff here
                    }
                    enemyTurn = true;
                }
                else if (atkType.chosen == 2)
                {
                    atkType.selectionComplete = false;
                    playerMakeMove            = false;
                    playerTurn = false;
                    // send message and change scene
                    //Debug.Log("Here");
                    SceneManager.LoadScene(0);
                }
            }
        }
        if (enemy != null && enemy.hp <= 0)
        {
            // message that you defeated enemy.
            player.exp += (enemy.level * 8);
            SceneManager.LoadScene(0);
        }
        if (player != null && player.gold < 0)
        {
            // game over
            playerIsDead = true;
            textBox2.DisableTextBox();
            atkType.DisableTextBox();
            Debug.Log("Player died.");
        }

        if (enemyTurn && enemy.hp > 0)
        {
            Debug.Log("Enemy turn started");
            // Do attack animation
            textBox2.ReloadScript(enemyAtkText);
            textBox2.currentLine = startLine;
            textBox2.endAtLine   = endLine;
            textBox2.EnableTextBox();
            if (enemy.atk - player.def > 0)
            {
                player.gold -= (enemy.atk - player.def);
            }
            else
            {
                player.gold -= 1;
            }
            enemyTurn  = false;
            playerTurn = true;
        }
        if (enemy != null && enemy.hp <= 0)
        {
            // Die animation
            enemyIsDead = true;
            Debug.Log("Enemy died.");
        }
    }