Ejemplo n.º 1
0
    private void OnMission(Collider collision)
    {
        switch (index)
        {
        //回忆1
        case 0:
            if (MissionIndex == -1)
            {
                facade.OnRecall(1, "J");
                facade.SetRotation(Position.Left);
                MissionIndex = 0;
                facade.cc.HaveLearnedSquat = true;
            }
            break;

        //马路
        case 2:
            //TODO
            //string str = collision.name;
            //string[] strs = str.Split('_');
            //int triggerIndex = int.Parse(strs[1]);
            //if (triggerIndex == 0)
            //{

            //}
            //else if (triggerIndex == 1)
            //{

            //}
            break;

        //有木板的小路
        //木板只有一块
        case 3:
            if (MissionIndex <= 0)
            {
                facade.ShowMessage("F");
                canTake_bg03 = true;
            }
            break;

        //开裂的小路
        //捡到木板之后搭上去
        case 4:
            if (MissionIndex == 1)
            {
                GameObject go = facade.GetPresentGO();

                var bound = go.GetComponent <FillGapController>();
                bound.Boom();

                SpriteRenderer plank = go.transform.Find("Plank").GetComponent <SpriteRenderer>();
                plank.sprite = Resources.Load <Sprite>("Elements/木板");
                facade.Throw();
                MissionIndex = 2;
            }
            else if (MissionIndex < 1)
            {
                //TODO 播放拒绝动画
            }
            break;

        //木匠小屋
        //在木匠身边有小对话气泡 按对话键开始对话 第一次开始对话开启任务(内容如大纲
        //没去断桥之前和木匠对话 主角不会询问木板和钉子 但是完成任务之后木匠还是会给木板和钉子 这个时候木板和钉子就放在一边
        //主角处于触发器范围内依旧可以拿起
        //去了断桥之后主角会询问木板和钉子 完成任务之后直接把木板和钉子顶在头上
        case 6:
            if (MissionIndex == 4)
            {
                facade.Throw();
                facade.PickUpPlank();
                MissionIndex = 5;
            }
            else if (MissionIndex < 4)
            {
                canTalk = true;
                facade.ShowMessage("F");
            }
            break;

        //断桥
        case 8:
            if (MissionIndex == 5)
            {
                facade.GetPresentGO().transform.Find("Anim").gameObject.SetActive(true);
                facade.PlayBgSound(AudioManager.Sound_Recall);

                GameObject go = facade.GetPresentGO();

                var bound = go.GetComponent <RepairBridgeController>();
                bound.Repaired();

                var cc = GameFacade.Instance.cc;
                //GameObject.Find("CM vcam1").GetComponent<Cinemachine.CinemachineVirtualCamera>().;
                cc.SetFocusOffset(9);
                cc.ChangeMovable(false);
                cc.Vanish();

                // //将玩家从屏幕中消失
                // cc.transform.Find("Eyes").GetComponent<SpriteRenderer>().sprite = null;
                // cc.transform.Find("Eyes").GetComponent<Animator>().enabled = false;
                // //TODO Shadow的sprite设置
                // GetComponent<SpriteRenderer>().sprite = null;
                // GetComponent<Animator>().enabled = false;
                // facade.ChangeMovable(false);
                facade.Throw();

                DOTween.To(() => timeCount, a => timeCount = a, 1, 3).OnComplete(delegate()
                {
                    var cc1 = GameFacade.Instance.cc;
                    //GameObject.Find("CM vcam1").GetComponent<Cinemachine.CinemachineVirtualCamera>().;
                    cc1.SetFocusOffset(32);
                });

                //DOTween.To(() => timeCount, a => timeCount = a, 1, 6).OnComplete(delegate ()
                //{
                //    var cc1 = GameFacade.Instance.cc;
                //    //GameObject.Find("CM vcam1").GetComponent<Cinemachine.CinemachineVirtualCamera>().;
                //    cc1.SetFocusOffset(16);
                //});

                DOTween.To(() => timeCount, a => timeCount = a, 1, 5).OnComplete(delegate()
                {
                    var cc1 = GameFacade.Instance.cc;
                    //GameObject.Find("CM vcam1").GetComponent<Cinemachine.CinemachineVirtualCamera>().;
                    cc1.SetFocusOffset(32.5f);
                });

                //
                DOTween.To(() => timeCount, b => timeCount = b, 1, 14).OnComplete(delegate()
                {
                    facade.StopBgSoundSmoothlySync();
                    facade.ShowEnd();
                });

                // Quit Game at 16s
                DOTween.To(() => timeCount, c => timeCount = c, 1, 17).OnComplete(delegate()
                {
                    Application.Quit();
                });
            }
            break;

        //回忆2
        case 10:
            if (MissionIndex <= 2)
            {
                facade.OnRecall(2, "K→□ L→O");
                facade.SetRotation(Position.Right);
                MissionIndex = 3;
                facade.cc.HaveLearnedChangeShape = true;
            }
            break;

        //给木匠苹果的任务
        //如果在开启木匠任务之前使用方块砸地把苹果砸下来 苹果掉在地上 玩家按拾取键 苹果消失 播放吃苹果的音效
        //开启木匠任务之后 玩家按拾取键 直接把苹果顶在头上
        //完成任务之后同开启任务之前
        case 11:
            appleCanFall = true;
            facade.ShowMessage("□→J");
            break;
        }
    }