示例#1
0
    private void Update()
    {
        if (!checker.IsLevelOver())
        {
            if ((Input.GetKey(KeyCode.DownArrow) ||
                 Input.GetKey(KeyCode.Mouse0) ||
                 Input.GetKey(KeyCode.Space)) &&
                (Time.timeSinceLevelLoad > 0.25f))
            {
                if (GetComponentInChildren <Block>() != null)
                {
                    source.clip = drop_clip;
                    source.Play();

                    GetComponentInChildren <Block>().Fall();
                    GetComponentInChildren <Block>().gameObject.transform.parent = null;
                    drop_time = Time.timeSinceLevelLoad;
                }
            }

            if (GetComponentInChildren <Block>() == null)
            {
                if (drop_time + auto_spawn_time < Time.timeSinceLevelLoad)
                {
                    SpawnNewBlock();
                }
            }
        }
    }
示例#2
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Ground")
        {
            if (!for_show)
            {
                if (sounds_i_made < max_sounds)
                {
                    sounds_i_made++;
                    source.clip = current_ground_sound;
                    source.Play();
                }

                checker.BlockHitGround(+1);

                if (!checker.IsLevelOver())
                {
                    cam_shake.ShakeCamera(0.15f);
                }
            }
        }
        else if (other.tag == "Block")
        {
            if (!for_show)
            {
                if (sounds_i_made < max_sounds)
                {
                    sounds_i_made++;
                    source.clip = block_sound;
                    source.Play();
                }
            }
        }
    }
示例#3
0
 void Update()
 {
     if (!checker.IsLevelOver())
     {
         if (shakeDuration > 0)
         {
             gameObject.transform.localPosition = originalPos + Random.insideUnitSphere * shakeAmount;
             shakeDuration -= Time.deltaTime * decreaseFactor;
             shakeAmount   -= Time.deltaTime * decreaseFactor;
             //if (shakeAmount <= 0) shakeAmount = 0;
         }
         else
         {
             shakeDuration = 0f;
             gameObject.transform.localPosition = originalPos;
         }
     }
 }