Ejemplo n.º 1
0
 public void ClearBackground()
 {
     RectangleBiscuitBackground.SetActive(false);
     Rec2SquareBackground.SetActive(false);
     SimilarityBackground.SetActive(false);
     return;
 }
Ejemplo n.º 2
0
    private void Awake()
    {
        Application.runInBackground = true;
        // 초기화
        currentMode = PlayerPrefs.GetInt("Mode");
        Debug.Log("current Game Mode is : " + currentMode);
        gc             = GC.GetComponent <GameController>();
        ss             = EC.GetComponent <StoryScript>();
        bp             = EC.GetComponent <ButtonController_Play>();
        sr             = plate.GetComponent <SpriteRenderer>();
        RM             = gameObject.GetComponent <RankManager>();
        hints          = 3;
        score          = 0;
        combo          = 0;
        movementStatus = 0;
        solveTime      = 45; // 임의 변수초기화 값

        // 배경화면 초기화
        ClearBackground();

        if (currentMode == 0 && currentMode == 1)
        {
            RectangleBiscuitBackground.SetActive(true);
        }
        else if (currentMode == 2)
        {
            Rec2SquareBackground.SetActive(true);
        }
        else
        {
            SimilarityBackground.SetActive(true);
        }

        // TODO : 어느 게임인지 모드 및 난이도를 확인하고 생성까지 여기서 한다. private 변수 활용
        if (currentMode == 0)
        {
            // challenge mode
            lifes  = 3;
            isPlay = 2;
            MakeNewGame();
            ResetTimeManager();
            StartCoroutine("Timer");
        }
        else
        {
            // TODO : story mode
            lifes = 1;
            LifeOn[0].SetActive(false);
            LifeOn[1].SetActive(false);
            LifeOn[2].SetActive(false);
            LifeOff[0].SetActive(false);
            LifeOff[1].SetActive(false);
            LifeOff[2].SetActive(false);
            ScoreBackground.SetActive(false);
            isPlay = 0;
        }

        //Debug.Log("EventController Awake");
    }
Ejemplo n.º 3
0
    /*
     *
     * 순위모드 새로운 게임 분포확률 결정하는 메소드
     *
     *
     */

    private void MakeNewGame()
    {
        Debug.Log("makenewgame");
        plate.transform.localScale = new Vector3(1f, 1f, 0);
        gamePause            = 0;
        isHelp               = 0;
        similarityOnceSolved = false;
        sentPutRequest       = false;
        bp.setisFormulaButtonSelectable(0);
        if (currentMode == 0)
        {
            // 문제랜덤생성
            List <int> pool       = new List <int>();
            int[]      difficulty = new int[gc.getSimilarityProblems()];
            difficulty[0]  = 10; // 예각
            difficulty[1]  = 10; // 예각2
            difficulty[2]  = 9;  // 직각
            difficulty[3]  = 13; // 둔각
            difficulty[4]  = 14; // 사다리꼴
            difficulty[5]  = 20; // 임의사각형
            difficulty[6]  = 30; // 오각형
            difficulty[7]  = 30; // 육각형
            difficulty[8]  = 40; // 칠각형
            difficulty[9]  = 37; // 팔각형
            difficulty[10] = 25; // 직투정1 - (주) 공식선택 연습 및 점수주기 문제를 포함시키기 위함
            difficulty[11] = 25; // 직투정2
            difficulty[12] = 14; // 합동1
            difficulty[13] = 14; // 합동2

            int coeff = 10;
            for (int i = 0; i < difficulty.Length; i++)
            {
                int howMany = 3; // coeff * (int) (1f / (1f + Mathf.Exp((score - 200) * difficulty[i] - 10)));
                for (int j = 0; j < howMany; j++)
                {
                    pool.Add(i);
                }
            }
            pool        = ShuffleArray(pool);
            currentGame = pool[(int)UnityEngine.Random.Range(0, pool.Count)];
            PlayerPrefs.SetInt("Game", currentGame);
        }
        else
        {
            currentGame = PlayerPrefs.GetInt("Game");
        }

        if (testGameMode != -1)
        {
            currentGame = testGameMode;                    // TEST 값
        }
        ClearBackground();
        if (currentGame >= 0 && currentGame <= gc.getBiscuitProblems())
        {
            // 투렉트
            RectangleBiscuitBackground.SetActive(true);
            ReassembleButton.SetActive(true);
        }
        else if (currentGame >= gc.getBiscuitProblems() + 1 && currentGame <= gc.getRec2SquareProblems())
        {
            // 직투정
            Rec2SquareBackground.SetActive(true);
            ReassembleButton.SetActive(true);
        }
        else
        {
            // 합동삼각형
            SimilarityBackground.SetActive(true);
            ReassembleButton.SetActive(false);
        }
        gc.makeNew(currentGame);
        return;
    }