Пример #1
0
    IEnumerator GameMissCor()
    {
        currentGameState = GameState.FAIL;

        for (int i = 0; i < lightSet.childCount; i++)
        {
            lightSet.GetChild(i).GetComponent <LightManager>().CoroutineStop();
        }
        yield return(new WaitForSeconds(0.8f));

        SoundManager.instance_.SFXPlay(SoundManager.instance_.sfxClips[0], 0.5f);
        yield return(new WaitForSeconds(0.9f));

        player.transform.position = stageSystem.playerInitPos;
        player.GetComponent <PlayerMove>().currentDirect = Direct.HOLD;
        currentGameState = GameState.READY;
        uiSystem.DownSideCanvasOn();
        gameObject.GetComponent <CameraSystem>().camera_.transform.position = new Vector3(0, 0, -10);
        gameObject.GetComponent <CameraSystem>().currentCameraView          = CameraView.CENTER;

        uiSystem.MessageManager(stageSystem.stage[stageSystem.currentStage - 1].messageInfo.preMent, 0);
        for (int i = 0; i < obstacleBlocks.Length; i++)
        {
            obstacleBlocks[i].GetComponent <SpriteRenderer>().color = new Color(obstacleBlocks[i].GetComponent <SpriteRenderer>().color.r, obstacleBlocks[i].GetComponent <SpriteRenderer>().color.g, obstacleBlocks[i].GetComponent <SpriteRenderer>().color.b, 1);
            obstacleBlocks[i].GetComponent <BoxCollider>().enabled  = true;
        }

        for (int i = 0; i < diamond.Length; i++)
        {
            diamond[i].SetActive(true);
        }

        //Init
        for (int i = 0; i < switchContainObjectPos.Length; i++)
        {
            switchContainObject[i].transform.localEulerAngles = switchContainObjectEulerAngle[i];
            switchContainObject[i].transform.localPosition    = switchContainObjectPos[i];

            if (switchContainObject[i].GetComponent <Move>() != null)
            {
                switchContainObject[i].GetComponent <Move>().switchObj.GetComponent <Switch>().switchOn = false;
                switchContainObject[i].GetComponent <Move>().switchObj.GetComponent <Switch>().StopCor();
            }

            else if (switchContainObject[i].GetComponent <Spin>() != null)
            {
                switchContainObject[i].GetComponent <Spin>().switchObj.GetComponent <Switch>().switchOn = false;
                switchContainObject[i].GetComponent <Spin>().switchObj.GetComponent <Switch>().StopCor();
            }

            else if (switchContainObject[i].GetComponent <Blink>() != null)
            {
                switchContainObject[i].GetComponent <Blink>().switchObj.GetComponent <Switch>().switchOn = false;
                switchContainObject[i].GetComponent <Blink>().switchObj.GetComponent <Switch>().StopCor();
            }
        }

        if (UISystem.isSaveBlockOn)
        {
            for (int i = 0; i < blocks.Length; i++)
            {
                blocks[i].GetComponent <SpriteRenderer>().color = new Color(blocks[i].GetComponent <SpriteRenderer>().color.r, blocks[i].GetComponent <SpriteRenderer>().color.g, blocks[i].GetComponent <SpriteRenderer>().color.b, 1);
                blocks[i].GetComponent <BoxCollider>().enabled  = true;
            }
        }
    }