Exemplo n.º 1
0
 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.gameObject.tag == "Balance")
     {
         timeOutSideZone       = 0;
         timeOutSideZoneSecond = 0;
         cam.orthographicSize  = 4;
         tempColor.a           = 0;
         outSideZone.color     = tempColor;
         sound.StopSound();
         source.volume = 0.2f;
         isInZone      = true;
     }
 }
Exemplo n.º 2
0
    public void Update()
    {
        if (Time.timeScale == 0)
        {
            manageButton.goLeft  = false;
            manageButton.goRight = false;
        }
        if (!Hidden)
        {
            if (manageButton.goRight && !manageButton.goLeft)
            {
                /* if (rb.velocity.x < speed)
                 * {
                 *   rb.AddForce(new Vector3(speed * Time.timeScale, 0, 0), ForceMode.Force);
                 * }
                 * else
                 * {
                 *   rb.velocity = new Vector3(speed, rb.velocity.y, rb.velocity.z);
                 * }*/
                transform.Translate(1 * Time.deltaTime * speed, 0, 0);
                sp.flipX = false;
            }
            else if (manageButton.goLeft && !manageButton.goRight)
            {
                /* if (rb.velocity.x > -speed)
                 * {
                 *   rb.AddForce(new Vector3(-speed * Time.timeScale, 0, 0), ForceMode.Force);
                 * }
                 * else
                 * {
                 *   rb.velocity = new Vector3(-speed, rb.velocity.y, rb.velocity.z);
                 * }*/


                transform.Translate(-1 * Time.deltaTime * speed, 0, 0);

                sp.flipX = true;
            }
        }
        if (manageButton.goLeft || manageButton.goRight)
        {
            GameManager.instance.IsMoving = true;
            animator.SetBool("Is_Walking", true);
            if (!source.isPlaying)
            {
                Audio.PlaySound();
            }
            if (Hidden && !GameManager.instance.mister.GetComponent <Mister>().isBalanceQTEActif&& !GameManager.instance.mister.GetComponent <Mister>().isRythmQTEActif)
            {
                HideMe(LastCach);
            }
        }
        else
        {
            GameManager.instance.IsMoving = false;
            animator.SetBool("Is_Walking", false);
            Audio.StopSound();
        }


        if (transform.position.x >= distanceInOrderToSpawnMan && !shadowManIsRelease)
        {
            SpawnMan();
        }
    }