Example #1
0
    /// <summary>
    /// 胜利演出
    /// </summary>
    public void WinEnd()
    {
        //显示所有屏幕
        panel_Manager.ChangePanelState(PanelState.Show, PanelType.Left);
        panel_Manager.ChangePanelState(PanelState.Show, PanelType.Right);

        director.playableAsset = timeline_Win;
        director.Play();
        audio_Source.clip = audio_WinClip;
        audio_Source.Play();
        isPlayTimeline           = true;
        panel_Manager.IsOverGame = true;
    }
Example #2
0
    void Update()
    {
        if (RemainStep <= 0)
        {
            gameObject.GetComponentInChildren <Light2D>().intensity = 0.5f;
        }
        if (!SwitchManager.gameStop)
        {
            if (p1Playing.player1play == true)
            {
                panelManager.ChangePanelState(PanelState.Show, PanelType.Left);
                //gameObject.GetComponentInChildren<Light2D>().enabled = true;
                if (RemainStep > 0)
                {
                    if (Input.GetKey(KeyCode.A) && !LockMove)
                    {
                        PlayerPosition = gameObject.GetComponent <Transform>().position;
                        hit2           = Physics2D.Raycast(transform.position + Vector3.left / 2, Vector2.left, 0.7f);
                        if (hit2.collider == null || hit2.collider.gameObject.layer == 8 || hit2.collider.gameObject.layer == 10)
                        {
                            if (hit2.collider != null && hit2.collider.gameObject.layer == 10)
                            {
                                if (remainHammer > 0)
                                {
                                    Destroy(hit2.collider.gameObject);
                                    remainHammer--;
                                    audio.PlayOneShot(clip2);
                                }
                            }
                            else
                            {
                                MoveControlLogic(MoveDir.A);
                                cameraManager.PlayerOneMoveSound();
                            }
                        }
                    }
                    if (Input.GetKey(KeyCode.D) && !LockMove)
                    {
                        PlayerPosition = gameObject.GetComponent <Transform>().position;
                        hit2           = Physics2D.Raycast(transform.position + Vector3.right / 2, Vector2.right, 0.7f);
                        if (hit2.collider == null || hit2.collider.gameObject.layer == 8 || hit2.collider.gameObject.layer == 10)
                        {
                            if (hit2.collider != null && hit2.collider.gameObject.layer == 10)
                            {
                                if (remainHammer > 0)
                                {
                                    Destroy(hit2.collider.gameObject);
                                    remainHammer--;
                                    audio.PlayOneShot(clip2);
                                }
                            }
                            else
                            {
                                MoveControlLogic(MoveDir.D);
                                cameraManager.PlayerOneMoveSound();
                            }
                        }
                    }
                    if (Input.GetKey(KeyCode.W) && !LockMove)
                    {
                        PlayerPosition = gameObject.GetComponent <Transform>().position;
                        hit2           = Physics2D.Raycast(transform.position + Vector3.up / 2, Vector2.up, 0.7f);
                        if (hit2.collider == null || hit2.collider.gameObject.layer == 8 || hit2.collider.gameObject.layer == 10)
                        {
                            if (hit2.collider != null && hit2.collider.gameObject.layer == 10)
                            {
                                if (remainHammer > 0)
                                {
                                    Destroy(hit2.collider.gameObject);
                                    remainHammer--;
                                    audio.PlayOneShot(clip2);
                                }
                            }
                            else
                            {
                                MoveControlLogic(MoveDir.W);
                                cameraManager.PlayerOneMoveSound();
                            }
                        }
                    }
                    if (Input.GetKey(KeyCode.S) && !LockMove)
                    {
                        PlayerPosition = gameObject.GetComponent <Transform>().position;
                        hit2           = Physics2D.Raycast(transform.position + Vector3.down / 2, Vector2.down, 0.7f);
                        if (hit2.collider == null || hit2.collider.gameObject.layer == 8 || hit2.collider.gameObject.layer == 10)
                        {
                            if (hit2.collider != null && hit2.collider.gameObject.layer == 10)
                            {
                                if (remainHammer > 0)
                                {
                                    Destroy(hit2.collider.gameObject);
                                    remainHammer--;
                                    audio.PlayOneShot(clip2);
                                }
                            }
                            else
                            {
                                MoveControlLogic(MoveDir.S);
                                cameraManager.PlayerOneMoveSound();
                            }
                        }
                    }
                }
                if (LockMove)
                {
                    switch (moveDirEnum)
                    {
                    case MoveDir.W:
                        MoveW();
                        break;

                    case MoveDir.A:
                        MoveA();
                        break;

                    case MoveDir.S:
                        MoveS();
                        break;

                    case MoveDir.D:
                        MoveD();
                        break;
                    }
                }

                if (Input.GetKeyDown(KeyCode.E) && !isMoving)
                {
                    p1Playing.SwitchPlayer();
                    //gameObject.GetComponentInChildren<Light2D>().enabled = false;
                    panelManager.ChangePanelState(PanelState.Fade, PanelType.Left);
                }
            }
        }
        panelManager.UpdateHammerUI(remainHammer);
    }