Пример #1
0
 private void Update()
 {
     if (audioSource == null && GameObject.Find("Player Sounds") != null)
     {
         audioSource = GameObject.Find("Player Sounds").GetComponent <MasterAudioSystem>();
     }
 }
Пример #2
0
    void Update()
    {
        if (audioSource == null && GameObject.Find("Player Sounds") != null)
        {
            audioSource = GameObject.Find("Player Sounds").GetComponent <MasterAudioSystem>();
        }

        if (isMoving)
        {
            if (Vector3.Distance(blocks[currBlockIndex].obj.transform.position, endBlockPos) < 0.001f)
            {
                blocks[currBlockIndex].obj.GetComponent <WorldBlock>().isValidToStand = true;
                currBlockIndex++;
                if (currBlockIndex >= blocks.Length)
                {
                    isMoving = false;
                    return;
                }
                InitCurrMovingBlockVars();
            }
            else
            {
                distCovered       = (Time.time - startTime) * movingBlockSpeed;
                fractionOfJourney = distCovered / journeyLength;
                blocks[currBlockIndex].obj.transform.position = Vector3.Lerp(startBlockPos, endBlockPos, fractionOfJourney);
            }
        }
    }
Пример #3
0
    // Update is called once per frame
    void Update()
    {
        if (audioSource == null && GameObject.Find("Player Sounds") != null)
        {
            audioSource = GameObject.Find("Player Sounds").GetComponent <MasterAudioSystem>();
        }

        if (doorAnim.GetCurrentAnimatorStateInfo(0).IsName("Door Open"))
        {
            col.enabled = false;
        }
        else
        {
            col.enabled = true;
        }
    }
    void Update()
    {
        if (audioSource == null && GameObject.Find("Player Sounds") != null)
        {
            audioSource = GameObject.Find("Player Sounds").GetComponent <MasterAudioSystem>();
        }

        if (isPrepToDie)
        {
            KillTheBox();
            isPrepToDie = false;
        }

        if (isPrepForFalling && !isMoving)
        {
            fallingMechanic.ToggleFall(true);
            isPrepForFalling = false;
        }

        if (isPrepForSliding)
        {
            slidingMechanic.ToggleSlide(true, previousDirection);
            isPrepForSliding = false;
        }

        if (isMoving)
        {
            if (Vector3.Distance(transform.position, newPos) > 0.0001f)
            {
                float fracComplete = (Time.time - startTime) / journeyTime * speed;
                transform.position = Vector3.Lerp(transform.position, newPos, fracComplete * speed);
            }
            else
            {
                isMoving = false;
            }
        }
    }