コード例 #1
0
    public void BlockCollision()
    {
        //播放碰撞音效
        if (!AudioControler.getInstance().SE_Hit_Block.isPlaying)
        {
            AudioControler.getInstance().SE_Hit_Block.Play();
        }

        //碰撞动画控制(如果有动画的话:需要有isHit参数)
        if (GetComponent <Animator>())
        {
            GetComponent <Animator>().SetBool("isHit", true);
        }

        if (canDoEventTimes > 0 && currentTime - doEventTimeInterval > .2f)  //有剩余次数且防止连续触发
        {
            --canDoEventTimes;

            doEventTimeInterval = Time.time;

            DoEvent();  //执行事件分发
        }

        if (canDoEventTimes == 0 && type == 1)  //问号=>石头
        {
            --canDoEventTimes;

            Destroy(gameObject, 0.65f);

            var stone = Instantiate(Resources.Load("Prefab/BlockPrefab/Ground_4"), transform.position, new Quaternion(), TransformMapPack);

            ((GameObject)stone).GetComponent <MapBlock>().type = 5;
        }
    }
コード例 #2
0
ファイル: MissionView.cs プロジェクト: vszed/U3D_SuperUncle
    private IEnumerator updateMarioUIPos()
    {
        if (GameData.currentMissionNum >= 2)
        {
            var pos = list_stepMission[GameData.currentMissionNum - 2].transform.position;
            MarioUI.transform.position = new Vector3(pos.x, MarioUI.transform.position.y, pos.z);
        }

        //马里奥UI向新的关卡point移动
        var waitSeconds = PlayerPrefs.GetInt("currentMissionNum", 1) > 1 ? 3 : 12.5f;

        yield return(new WaitForSeconds(waitSeconds));

        var currentMissionPos = list_stepMission[GameData.currentMissionNum - 1].transform.position;

        MarioUI.transform.position = new Vector3(currentMissionPos.x, MarioUI.transform.position.y, currentMissionPos.z);

        AudioControler.getInstance().SE_MoveMap.Play();

        yield return(new WaitForSeconds(1));

        MarioUI.GetComponent <Image>().sprite = MarioUIHandsUp;

        //贴图问题修正pos
        var temp_pos = MarioUI.transform.position;

        MarioUI.transform.position = new Vector3(temp_pos.x - 3, temp_pos.y, temp_pos.z);

        StartCoroutine("jumpScene");
    }
コード例 #3
0
 private void BGM_Decline()
 {
     if (AudioControler.getInstance().BGM_Title != null && AudioControler.getInstance().BGM_Title.isPlaying)
     {
         AudioControler.getInstance().BGM_Title.volume -= 0.0085f;
     }
     else if (AudioControler.getInstance().BGM_Ground != null && AudioControler.getInstance().BGM_Ground.isPlaying)
     {
         AudioControler.getInstance().BGM_Ground.volume -= 0.0085f;
     }
     else if (AudioControler.getInstance().BGM_Ground_Hurry != null && AudioControler.getInstance().BGM_Ground_Hurry.isPlaying)
     {
         AudioControler.getInstance().BGM_Ground_Hurry.volume -= 0.0085f;
     }
     else if (AudioControler.getInstance().BGM_10MarioMap != null && AudioControler.getInstance().BGM_10MarioMap.isPlaying)
     {
         AudioControler.getInstance().BGM_10MarioMap.volume -= 0.0085f;
     }
     else if (AudioControler.getInstance().BGM_SickCow != null && AudioControler.getInstance().BGM_SickCow.isPlaying)
     {
         AudioControler.getInstance().BGM_SickCow.volume -= 0.0085f;
     }
     else if (AudioControler.getInstance().BGM_MarioKartStar != null && AudioControler.getInstance().BGM_MarioKartStar.isPlaying)
     {
         AudioControler.getInstance().BGM_MarioKartStar.volume -= 0.0085f;
     }
     else if (AudioControler.getInstance().BGM_Schnappi != null && AudioControler.getInstance().BGM_Schnappi.isPlaying)
     {
         AudioControler.getInstance().BGM_Schnappi.volume -= 0.0085f;
     }
 }
コード例 #4
0
ファイル: Flag.cs プロジェクト: vszed/U3D_SuperUncle
    //取得旗子
    public IEnumerator getFlag(Collider2D collision)
    {
        GameControler.getInstance().GameOver = true;
        collision.GetComponent <Rigidbody2D>().bodyType = RigidbodyType2D.Static;
        collision.GetComponentInChildren <Animator>().SetBool("isGetFlag", true);

        yield return(new WaitForSeconds(0.15f));

        AudioControler.getInstance().stopAllBGM();

        collision.GetComponent <Rigidbody2D>().bodyType    = RigidbodyType2D.Dynamic;
        collision.GetComponent <Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezePositionX | RigidbodyConstraints2D.FreezeRotation;
        AudioControler.getInstance().SE_SYS_GOAL_FLAG.Play();

        yield return(new WaitForSeconds(1));

        AudioControler.getInstance().SE_course_clear.Play();
        playAnimSwitch = true;
        ob             = collision;

        yield return(new WaitForSeconds(1.5f));

        AudioControler.getInstance().SE_VOC_MA_CLEAR_NORMAL.Play();

        //取分、取耗时 => 排行榜
        GameControler.getInstance().countScoreTime();

        yield return(new WaitForSeconds(3));

        GameControler.getInstance().balanceScoreSwitch = true;
    }
コード例 #5
0
 //关掉所有BGM => 在新的BGM播放之前调用
 public void stopAllBGM()
 {
     if (AudioControler.getInstance().BGM_Ground != null && AudioControler.getInstance().BGM_Ground.isPlaying)
     {
         AudioControler.getInstance().BGM_Ground.Stop();
     }
     else if (AudioControler.getInstance().BGM_Ground_Hurry != null && AudioControler.getInstance().BGM_Ground_Hurry.isPlaying)
     {
         AudioControler.getInstance().BGM_Ground_Hurry.Stop();
     }
     else if (AudioControler.getInstance().BGM_SickCow != null && AudioControler.getInstance().BGM_SickCow.isPlaying)
     {
         AudioControler.getInstance().BGM_SickCow.Stop();
     }
     else if (AudioControler.getInstance().BGM_10MarioMap != null && AudioControler.getInstance().BGM_10MarioMap.isPlaying)
     {
         AudioControler.getInstance().BGM_10MarioMap.Stop();
     }
     else if (AudioControler.getInstance().BGM_MarioKartStar != null && AudioControler.getInstance().BGM_MarioKartStar.isPlaying)
     {
         AudioControler.getInstance().BGM_MarioKartStar.Stop();
     }
     else if (AudioControler.getInstance().BGM_Title != null && AudioControler.getInstance().BGM_Title.isPlaying)
     {
         AudioControler.getInstance().BGM_Title.Stop();
     }
     else if (AudioControler.getInstance().BGM_VersionUpdate != null && AudioControler.getInstance().BGM_VersionUpdate.isPlaying)
     {
         AudioControler.getInstance().BGM_VersionUpdate.Stop();
     }
     else if (AudioControler.getInstance().BGM_Schnappi != null && AudioControler.getInstance().BGM_Schnappi.isPlaying)
     {
         AudioControler.getInstance().BGM_Schnappi.Stop();
     }
 }
コード例 #6
0
ファイル: MissionView.cs プロジェクト: vszed/U3D_SuperUncle
    private IEnumerator jumpScene()
    {
        yield return(new WaitForSeconds(0.5f));

        AudioControler.getInstance().SE_Daikettefinal.Play();
        StartCoroutine(SceneTransition.getInstance().loadScene("LivesScene", 0, 2));
    }
コード例 #7
0
ファイル: GameControler.cs プロジェクト: vszed/U3D_SuperUncle
    //游戏结束
    public void gameOver()
    {
        if (GameOver == false)
        {
            GameOver = true;

            //BGM
            AudioControler.getInstance().stopAllBGM();

            Character.getInstance().characterDie();

            //游戏结束逻辑
            --GameData.MarioLives;

            if (GameData.MarioLives > 0)
            {
                StartCoroutine(SceneTransition.getInstance().loadScene("LivesScene", 2, 3));
            }
            else
            {
                //刷新游戏数据
                GameData.dataUpdate();
                StartCoroutine(SceneTransition.getInstance().loadScene("GameOverScene", 2, 3));
            }
        }
    }
コード例 #8
0
    private IEnumerator contactFunc(Collider2D collision)
    {
        if (!isContact)
        {
            if (collision.GetComponent <Character>() && !collision.GetComponent <Character>().isUnmatched)
            {
                isContact = true;
                playAnim  = true;

                Destroy(GetComponent <CircleCollider2D>());
                Destroy(GetComponent <SpriteRenderer>());
                Destroy(GetComponent <Rigidbody2D>());

                StartCoroutine(GameControler.getInstance().ScoreUIControl(500, transform.position, 0));

                collision.GetComponent <Character>().isUnmatched = true;

                AudioControler.getInstance().stopAllBGM();
                AudioControler.getInstance().SE_PLY_CHANGE_BIG.Play();
                yield return(new WaitForSeconds(.2f));

                AudioControler.getInstance().SE_VOC_GET_STAR.Play();
                yield return(new WaitForSeconds(.2f));

                AudioControler.getInstance().BGM_MarioKartStar.Play();
                yield return(new WaitForSeconds(17.5f));

                if (!GameControler.getInstance().GameOver)
                {
                    AudioControler.getInstance().SE_STAR_FINISH.Play();
                }
                yield return(new WaitForSeconds(1));

                if (!GameControler.getInstance().GameOver)  //加判断
                {
                    AudioControler.getInstance().stopAllBGM();
                    AudioControler.getInstance().BGM_Ground.Play();
                }

                collision.GetComponent <Character>().isUnmatched = false;
                ob_light.GetComponent <Light>().color            = Color.white;

                Destroy(gameObject);
            }
            else if (collision.GetComponent <Character>() && collision.GetComponent <Character>().isUnmatched)  //无敌不会附加
            {
                isContact = true;

                Destroy(GetComponent <CircleCollider2D>());
                Destroy(GetComponent <SpriteRenderer>());
                Destroy(GetComponent <Rigidbody2D>());

                AudioControler.getInstance().SE_VOC_GET_STAR.Play();
                StartCoroutine(GameControler.getInstance().ScoreUIControl(1000, transform.position, 0));

                Destroy(gameObject, 3);
            }
        }
    }
コード例 #9
0
    public void createGoomba()
    {
        AudioControler.getInstance().SE_Appear.Play();
        var pos    = transform.position;
        var goomba = Instantiate(Resources.Load("Prefab/Enemy/Goomba"), new Vector2(pos.x, pos.y + 0.2f), new Quaternion(), TransformEnemyPack);

        ((GameObject)goomba).GetComponent <Rigidbody2D>().AddForce(new Vector2(0, 400));
    }
コード例 #10
0
ファイル: Character.cs プロジェクト: vszed/U3D_SuperUncle
 public void playFallDownSE()
 {
     if (m_isGrounded && canPlayFallDownSE && !AudioControler.getInstance().SE_FallDown.isPlaying)
     {
         AudioControler.getInstance().SE_FallDown.Play();
         canPlayFallDownSE = false;
     }
 }
コード例 #11
0
 public void BtnB_Jump()
 {
     if (Character.getInstance().getIsGrounded() && !GameControler.getInstance().GameOver)
     {
         character.GetComponent <Rigidbody2D>().AddForce(new Vector2(0, 730));
         AudioControler.getInstance().SE_Jump.Play();
     }
 }
コード例 #12
0
ファイル: Character.cs プロジェクト: vszed/U3D_SuperUncle
 public void jump()
 {
     if (m_isGrounded && Input.GetButtonDown("Jump"))
     {
         m_Rigidbody2D.AddForce(new Vector2(0, 730));
         AudioControler.getInstance().SE_Jump.Play();
     }
 }
コード例 #13
0
    public void createTortoiseFly()
    {
        AudioControler.getInstance().SE_Appear.Play();
        var pos      = transform.position;
        var tortoise = Instantiate(Resources.Load("Prefab/Enemy/TortoiseFly"), new Vector2(pos.x, pos.y + 1.1f), new Quaternion(), TransformEnemyPack);

        ((GameObject)tortoise).GetComponent <Tortoise>().TortoiseStatus = Tortoise.Status.isFly;
    }
コード例 #14
0
    public void createUnmatchStar()
    {
        AudioControler.getInstance().SE_Appear.Play();
        var pos  = transform.position;
        var star = Instantiate(Resources.Load("Prefab/Enemy/Star"), new Vector2(pos.x, pos.y + 1.1f), new Quaternion(), TransformEnemyPack);

        ((GameObject)star).GetComponent <Rigidbody2D>().AddForce(new Vector2(0, 400));
    }
コード例 #15
0
    public void quitToTitle()
    {
        btn_RestartMission.GetComponent <Button>().interactable = false;
        btn_QuitToTitle.GetComponent <Button>().interactable    = false;

        GameControler.getInstance().GameOver = true;
        AudioControler.getInstance().SE_Daikettefinal.Play();
        StartCoroutine(SceneTransition.getInstance().loadScene("TitleScene", 0.3f, 3));
    }
コード例 #16
0
    public void createTortoiseLand()
    {
        AudioControler.getInstance().SE_Appear.Play();
        var pos      = transform.position;
        var tortoise = Instantiate(Resources.Load("Prefab/Enemy/TortoiseLand"), new Vector2(pos.x, pos.y + 0.5f), new Quaternion(), TransformEnemyPack);

        ((GameObject)tortoise).GetComponent <Tortoise>().TortoiseStatus    = Tortoise.Status.isOnFoot;
        ((GameObject)tortoise).GetComponent <Tortoise>().TortoiseDirection = Tortoise.direction.left | Tortoise.direction.right;
        ((GameObject)tortoise).GetComponent <Rigidbody2D>().AddForce(new Vector2(0, 400));
    }
コード例 #17
0
    //重新开始当前关卡
    public void restartCurrentMission()
    {
        //加限制
        if (GameData.MarioLives > 1)
        {
            btn_QuitToTitle.GetComponent <Button>().interactable    = false;
            btn_RestartMission.GetComponent <Button>().interactable = false;

            AudioControler.getInstance().SE_PlayExit.Play();

            GameControler.getInstance().gameOver();
        }
    }
コード例 #18
0
ファイル: Character.cs プロジェクト: vszed/U3D_SuperUncle
    public void characterDie()
    {
        //SE
        AudioControler.getInstance().SE_Die.Play();
        AudioControler.getInstance().SE_OhNo.PlayDelayed(0.5f);

        //死亡时屏幕抖动  弃用
        //GameObject.FindWithTag("MainCamera").GetComponent<ShakeCamera>().isshakeCamera = true;

        m_animator.SetBool("isDie", true);
        Destroy(GetComponent <CapsuleCollider2D>());
        Destroy(GetComponent <BoxCollider2D>());
        Destroy(GetComponent <Rigidbody2D>());
        GameObject.Find("small_sprite_stand").transform.rotation = Quaternion.Euler(0, 180, 0);
    }
コード例 #19
0
    //打开菜单
    public void onOpenMenu()
    {
        //实现手机晃动震动效果
#if UNITY_ANDROID || UNITY_IOS
        Handheld.Vibrate();
#endif

        AudioControler.getInstance().SE_SYS_PAUSE.Play();
        if (menuUI.activeSelf)
        {
            menuUI.SetActive(false);
        }
        else
        {
            menuUI.SetActive(true);
        }
    }
コード例 #20
0
    //具体事件的执行内容
    #region ParticularEventFunc

    public void gainCoin()
    {
        AudioControler.getInstance().SE_Gain_Coin.Play();

        //加金币
        GameControler.getInstance().coinControl(1);

        //金币动画显示
        var pos            = transform.position;
        var coinAnimPrefab = Instantiate(Resources.Load("Prefab/UI/GainCoinPrefab"), new Vector2(pos.x, pos.y + 0.8f), new Quaternion());

        ((GameObject)coinAnimPrefab).GetComponent <Rigidbody2D>().AddForce(new Vector2(0, 400));
        GameObject.Destroy(coinAnimPrefab, 0.53f);

        //加分延时执行
        StartCoroutine(GameControler.getInstance().ScoreUIControl(100, transform.localPosition, 0.55f));
    }
コード例 #21
0
ファイル: GameControler.cs プロジェクト: vszed/U3D_SuperUncle
    //呼出、关闭菜单(重开游戏、退出游戏等)
    public void popUpMenu()
    {
        if (Input.GetKeyDown(KeyCode.E))
        {
            //Debug.Log("popUpMenu");
            AudioControler.getInstance().SE_SYS_PAUSE.Play();

            if (menuUI.activeSelf)
            {
                menuUI.SetActive(false);
            }
            else
            {
                menuUI.SetActive(true);
            }
        }
    }
コード例 #22
0
    public void onBtnPlayNext()
    {
        AudioControler.getInstance().SE_PlayNext.Play();

        ++GameData.currentMissionNum;
        PlayerPrefs.SetInt("currentMissionNum", GameData.currentMissionNum);  //存档

        if (GameData.currentMissionNum <= GameData.missionTotalNum)
        {
            StartCoroutine(SceneTransition.getInstance().loadScene("MissionViewScene", 0, 2));
        }
        else
        {
            //见公主场景
            PlayerPrefs.DeleteAll();  //TODO:清除存档 不要清除奖杯
        }
    }
コード例 #23
0
ファイル: Goomba.cs プロジェクト: vszed/U3D_SuperUncle
    public void die(GameObject ob)
    {
        isDied = true;

        //得分
        StartCoroutine(GameControler.getInstance().ScoreUIControl(100, transform.localPosition, 0.1f));

        //在地上死
        if (isGrounded && ob.tag != "Tortoise" && !ob.GetComponent <Character>().isUnmatched)
        {
            AudioControler.getInstance().SE_Emy_Fumu.Play();

            //受力
            ob.GetComponent <Rigidbody2D>().velocity = new Vector2(ob.GetComponent <Rigidbody2D>().velocity.x, 0);
            ob.GetComponent <Rigidbody2D>().velocity = new Vector2(ob.GetComponent <Rigidbody2D>().velocity.x, ob.GetComponent <Rigidbody2D>().velocity.y + 8);

            Destroy(GetComponent <Rigidbody2D>());
            GetComponent <Animator>().SetBool("isDieGround", true);
            Destroy(m_rigidbody);
            Destroy(GetComponent <CircleCollider2D>());
            Destroy(gameObject, 1.5f);
        }
        else
        {
            AudioControler.getInstance().SE_Emy_Down.Play();

            Destroy(GetComponent <CircleCollider2D>());

            var charPos = ob.transform.position;

            if (charPos.x > transform.position.x)
            {
                rotateAngle = 10;
                m_rigidbody.AddForce(new Vector2(-400, 400), ForceMode2D.Force);
            }
            else
            {
                rotateAngle = -10;
                m_rigidbody.AddForce(new Vector2(400, 400), ForceMode2D.Force);
            }

            ownRotateSwitch = true;

            Destroy(gameObject, 5);
        }
    }
コード例 #24
0
ファイル: Character.cs プロジェクト: vszed/U3D_SuperUncle
    public void playFootPrintSE(float horizontal)
    {
        if (m_isGrounded && horizontal != 0 &&
            !AudioControler.getInstance().SE_FootNote.isPlaying &&
            !AudioControler.getInstance().SE_FootNote_L.isPlaying)
        {
            AudioControler.getInstance().SE_FootNote.Play();

            if (Input.GetButton("Sprint") || (CrossPlatform.getInstance() && CrossPlatform.getInstance().btn_A_isPressed))
            {
                AudioControler.getInstance().SE_FootNote_L.PlayDelayed(0.1f);
            }
            else
            {
                AudioControler.getInstance().SE_FootNote_L.PlayDelayed(0.165f);
            }
        }
    }
コード例 #25
0
    public void onBtnUpLoad()
    {
        if (NameInputText.text != "")
        {
            AudioControler.getInstance().SE_FlyClapLong.Play();

            Destroy(UpLoadModule);
            RankListModule.SetActive(true);

            StartCoroutine(load(url));
        }
        else
        {
            TipsInputText.text = "你的名字不能为空......";
            if (!AudioControler.getInstance().SE_Invalid.isPlaying)
            {
                AudioControler.getInstance().SE_Invalid.Play();
            }
        }
    }
コード例 #26
0
    //只有3种情况会死:任何状态下 => 1.被炮弹击中 2.被别的龟壳击中 3.被无敌角色触碰
    public void die(GameObject ob)
    {
        isDied = true;

        StartCoroutine(GameControler.getInstance().ScoreUIControl(200, transform.localPosition, 0.1f));

        AudioControler.getInstance().SE_Emy_Down.Play();

        GetComponent <Rigidbody2D>().gravityScale = 3;
        GetComponent <Rigidbody2D>().mass         = 1;

        if (GetComponent <CircleCollider2D>())
        {
            Destroy(GetComponent <CircleCollider2D>());
        }
        if (GetComponent <BoxCollider2D>())
        {
            Destroy(GetComponent <BoxCollider2D>());
        }
        if (GetComponent <CapsuleCollider2D>())
        {
            Destroy(GetComponent <CapsuleCollider2D>());
        }

        var obPos = ob.transform.position;

        if (obPos.x > transform.position.x)
        {
            rotateAngle = 10;
            m_rigidbody.AddForce(new Vector2(-400, 400), ForceMode2D.Force);
        }
        else
        {
            rotateAngle = -10;
            m_rigidbody.AddForce(new Vector2(400, 400), ForceMode2D.Force);
        }

        ownRotateSwitch = true;

        Destroy(gameObject, 5);
    }
コード例 #27
0
ファイル: GameControler.cs プロジェクト: vszed/U3D_SuperUncle
    //分数结算
    public void balanceScore()
    {
        if (balanceScoreSwitch)
        {
            if (!AudioControler.getInstance().SE_SCORE_COUNT.isPlaying)
            {
                AudioControler.getInstance().SE_SCORE_COUNT.Play();
            }

            int currentScore = 0;
            int.TryParse(GameObject.Find("ScoreNum").GetComponent <Text>().text, out currentScore);

            currentScore = currentScore - 10 > 0 ? currentScore - 10 : 0;

            var str_currentScore = currentScore.ToString();
            while (str_currentScore.Length < 9)
            {
                str_currentScore = "0" + str_currentScore;
            }

            GameObject.Find("ScoreNum").GetComponent <Text>().text = str_currentScore;

            //分数兑换命数
            ScoreToLives += 10;
            if (ScoreToLives >= 4000)
            {
                ScoreToLives = 0;
                oneUp();
            }

            if (currentScore == 0)
            {
                balanceScoreSwitch = false;
                AudioControler.getInstance().SE_SCORE_COUNT.Stop();
                AudioControler.getInstance().SE_SCORE_COUNT_FINISH.Play();

                //排行榜界面
                goToRankListScene();
            }
        }
    }
コード例 #28
0
ファイル: Title.cs プロジェクト: vszed/U3D_SuperUncle
    public IEnumerator doEvent(string btnName)
    {
        btn_move_switch = true;
        btn_Story.GetComponent <Button>().interactable = false;
        btn_Quit.GetComponent <Button>().interactable  = false;

        AudioControler.getInstance().SE_Confirm.Play();

        if (btnName == "Story")
        {
            StartCoroutine(SceneTransition.getInstance().loadScene("MissionViewScene", 0, 2));
            GameData.dataUpdate();
        }
        else
        {
            SceneTransition.getInstance().IncreaseSwitch = true;
            yield return(new WaitForSeconds(2));

            Application.Quit();
        }
    }
コード例 #29
0
ファイル: GameControler.cs プロジェクト: vszed/U3D_SuperUncle
    //游戏倒计时
    public void countDown()
    {
        //Debug.Log(LabelTimeLeft.GetComponent<Text>().text);
        var str_timeLeft = LabelTimeLeft.GetComponent <Text>().text;
        int result       = 0;

        int.TryParse(str_timeLeft, out result);
        result       = result <= 0 ? 0 : --result;
        str_timeLeft = result.ToString();

        switch (str_timeLeft.Length)
        {
        case 1:
            str_timeLeft = "00" + str_timeLeft;
            break;

        case 2:
            str_timeLeft = "0" + str_timeLeft;
            break;

        default:
            break;
        }

        LabelTimeLeft.GetComponent <Text>().text = str_timeLeft;

        if (result <= 100 && !AudioControler.getInstance().BGM_Ground_Hurry.isPlaying)
        {
            //BGM
            AudioControler.getInstance().stopAllBGM();
            AudioControler.getInstance().BGM_Ground_Hurry.PlayDelayed(2.5f);

            //SE
            AudioControler.getInstance().SE_HurryUp.Play();
        }
        else if (result == 0)
        {
            gameOver();
        }
    }
コード例 #30
0
    //无敌角色触碰导致食人花死亡
    public void die(GameObject ob)
    {
        isDied = true;

        StartCoroutine(GameControler.getInstance().ScoreUIControl(200, transform.position, 0.1f));

        AudioControler.getInstance().SE_Emy_Down.Play();

        //更改绘制层级 0 => 4
        GetComponent <SpriteRenderer>().sortingOrder = 4;

        gameObject.AddComponent <Rigidbody2D>();
        GetComponent <Rigidbody2D>().bodyType     = RigidbodyType2D.Dynamic;
        GetComponent <Rigidbody2D>().gravityScale = 3;
        GetComponent <Rigidbody2D>().mass         = 1;

        if (GetComponent <BoxCollider2D>())
        {
            Destroy(GetComponent <BoxCollider2D>());
        }

        var obPos = ob.transform.position;

        if (obPos.x > transform.position.x)
        {
            rotateAngle = 10;
            GetComponent <Rigidbody2D>().AddForce(new Vector2(-400, 400), ForceMode2D.Force);
        }
        else
        {
            rotateAngle = -10;
            GetComponent <Rigidbody2D>().AddForce(new Vector2(400, 400), ForceMode2D.Force);
        }

        ownRotateSwitch = true;

        Destroy(gameObject.GetComponentInParent <Image>().gameObject, 5);  //image没实际意义,只供删除父物体
    }