Exemplo n.º 1
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Return))
     {
         bool sameColor = _player.currentVariant == _player.sittingBlock.GetComponent <GroundBlockController>().variant;
         if (sameColor)
         {
             if ((Time.time - _lastTeleport) > TELEPORT_LIMIT_SECS)
             {
                 Debug.Log("Teleporting...");
                 _soundPlayer.Play(SoundType.TELEPORT);
                 GameObject target = _ground.GetRandomBlockByVariant(_player.currentVariant);
                 _player.transform.position = new Vector3(
                     target.transform.position.x,
                     _player.transform.position.y,
                     target.transform.position.z
                     );
                 _lastTeleport = Time.time;
             }
             else
             {
                 _soundPlayer.Play(SoundType.TELEPORT_REJECTED);
             }
         }
         else
         {
             _soundPlayer.Play(SoundType.TELEPORT_REJECTED);
         }
     }
 }