コード例 #1
0
    private void Update()
    {
        if (SceneManager.GetActiveScene().name.Equals("MainMenu"))
        {
            PlayAudio?.Invoke("ThemeSong", 0f);
            StopAudio?.Invoke("ExpositionSong");
            StopAudio?.Invoke("GameSong");
        }
        if (SceneManager.GetActiveScene().name.Equals("Exposition"))
        {
            PlayAudio?.Invoke("ExpositionSong", 0f);
            StopAudio?.Invoke("ThemeSong");
            StopAudio?.Invoke("GameSong");
        }
        if (SceneManager.GetActiveScene().name.Equals("GGJ"))
        {
            PlayAudio?.Invoke("GameSong", 0f);
            StopAudio?.Invoke("ExpositionSong");
            StopAudio?.Invoke("ThemeSong");
        }

        if (input == null)
        {
            input = FindObjectOfType <InputController>();
            SubscribeToInput(input);
        }

        if (MissedDeliveries >= LoseState)
        {
            GameOver(Score);
        }
    }
コード例 #2
0
    private void Update()
    {
        if (Dropping)
        {
            DropBoi();
        }
        if (joint != null)
        {
            if (joint.connectedBody != null)
            {
                isGrabbed = true;
            }
            else
            {
                isGrabbed = false;
            }
        }

        if (motor != null && Time.timeScale != 0)
        {
            if (motor.velocity.magnitude >= .1f)
            {
                if (isGrabbed)
                {
                    StopAudio?.Invoke("Pushed");
                    PlayAudio?.Invoke("Drag", 0f);
                }
                else
                {
                    StopAudio?.Invoke("Drag");
                    PlayAudio?.Invoke("Pushed", 0f);
                }
            }
            else
            {
                motor.velocity = Vector2.zero;
            }
        }
    }