Пример #1
0
 //Called by return button in various menus
 public void onMainMenuClick()
 {
     MainGameScript.ClearGameObjects();
     SceneManager.LoadScene(mainMenuLvl);
     MainGameScript.Player_2_Turn = false;
     MainGameScript.BG_Index      = 0;
 }
Пример #2
0
    // Use this for initialization
    void Awake()
    {
        mainGame = GameObject.Find("Camera").GetComponent <MainGameScript>();

        Txts      = new GameObject[numItem];
        txtStatus = new txtStatusEnum[numItem];

        Txts[0] = GameObject.Find("TxtS");
        Txts[1] = GameObject.Find("TxtT");
        Txts[2] = GameObject.Find("TxtO");
        Txts[3] = GameObject.Find("TxtP");

        for (int i = 0; i < numItem; i++)
        {
            txtStatus[i] = txtStatusEnum.INITED;
        }

        called = false;
        allSet = false;

        initYpos   = Txts[0].transform.position.y;
        goalYPos   = initYpos - 1200f;
        bounceYPos = goalYPos + 400f;

        moveUnit = 50.0f;

        //nextPointer = 0;
        //Debug.Log("StopInitPos (start): " + Txts[0].transform.position.ToString());
    }
Пример #3
0
        void Start()
        {
            mainGameScript   = FindObjectOfType <MainGameScript>();
            playerGameScript = FindObjectOfType <PlayerGameScript>();

            text = GetComponent <Text>();
        }
Пример #4
0
        void Start()
        {
            mainGameScript = FindObjectOfType <MainGameScript>();
            audioPlayer    = FindObjectOfType <AudioPlayer>();

            startClicked = false;
        }
Пример #5
0
    // Use this for initialization
    void Awake()
    {
        mainGame = GameObject.Find("Camera").GetComponent <MainGameScript>();
        hand     = this.gameObject;

        isUsed     = false;
        isPausing  = false;
        isTouching = false;

        rotUnit      = baseRotUnit;
        isIncreasing = true;
        minAngle     = 0.0f;
        maxAngle     = 60.0f;

        hide = false;
        holeHandsInUseCounter = 0;

        catEyeAnimator = GameObject.Find("cat").GetComponent <Animator>();
        catEyeAnimator.SetBool("isStarted", false);
        catEyeAnimator.SetBool("isCaught", false);

        switched       = false;
        caughtEyeCount = 0;

        doubleSpeed = false;
    }
Пример #6
0
    // Use this for initialization
    void Awake()
    {
        mainGame = GameObject.Find("Camera").GetComponent <MainGameScript>();

        missTxts    = GameObject.FindGameObjectsWithTag("missTxt");
        missTxtUsed = new bool[missTxts.Length];
        targetYPos  = new float[missTxts.Length];

        for (int i = 0; i < missTxts.Length; i++)
        {
            missTxtUsed[i] = false;
            targetYPos[i]  = 0f;
        }


        moveYUnit = 2.0f;

        atUsed      = false;
        addTimerTxt = GameObject.Find("addTimeTxt");
        atTargetPos = addTimerTxt.transform.position;

        addTimerTxt.SetActive(false);
        targetFrameNo = 30;
        frameNo       = 0;

        foreach (GameObject missT in missTxts)
        {
            missT.SetActive(false);
        }
    }
Пример #7
0
        void Start()
        {
            mainGameScript   = FindObjectOfType <MainGameScript>();
            playerGameScript = FindObjectOfType <PlayerGameScript>();
            audioPlayer      = FindObjectOfType <AudioPlayer>();

            nextDayClicked = false;
        }
Пример #8
0
 //Called by cancel button in game
 public void onCancelClick()
 {
     MainGameScript.ResetDots();
     foreach (GameObject go in GameObject.Find("mainGameHandler").GetComponent <MainGameScript>().confirmUI)
     {
         go.GetComponent <Image>().enabled = false;
     }
 }
Пример #9
0
    // Use this for initialization
    void Awake()
    {
        mainGame    = GameObject.Find("Camera").GetComponent <MainGameScript>();
        titleCatImg = GameObject.Find("titleCatImg");

        //Debug.Log("Rot: " + titleCatImg.transform.eulerAngles);

        minAngle   = 0.0f;
        maxAngle   = 20.0f;
        increasing = true;
        moveUnit   = 0.4f;

        bgmOnBtn  = GameObject.Find("bgmOnBtn");
        bgmOffBtn = GameObject.Find("bgmOffBtn");
        seOnBtn   = GameObject.Find("seOnBtn");
        seOffBtn  = GameObject.Find("seOffBtn");


        if (isBgmOn)
        {
            bgmOnBtn.SetActive(true);
            bgmOffBtn.SetActive(false);
            bgm.Play();
        }
        else
        {
            bgmOnBtn.SetActive(false);
            bgmOffBtn.SetActive(true);
        }

        if (isSeOn)
        {
            seOnBtn.SetActive(true);
            seOffBtn.SetActive(false);
        }
        else
        {
            seOnBtn.SetActive(false);
            seOffBtn.SetActive(true);
        }

        settingPanel.SetActive(false);
        loadingPanel.SetActive(false);

        /*isBgmOn = true;
         * isSeOn = true;
         */

        if (!showStart)
        {
            //Debug.Log("Start from Game");
            //mainGame.readyGame();
            startCanvas.SetActive(false);
        }

        //showStart = false;
    }
Пример #10
0
        void Start()
        {
            mainGameScript = FindObjectOfType <MainGameScript>();
            gameScript     = GetComponent <EnemyGameScript>();

            hasResetOnFishing = false;

            ResetValues();
        }
Пример #11
0
        void Start()
        {
            needleImage = GetComponent <Image>();
            //meterImage = GetComponentInParent<Image>();

            mainGameScript   = FindObjectOfType <MainGameScript>();
            playerGameScript = FindObjectOfType <PlayerGameScript>();

            hidingCoroutine = StartCoroutine(Hide());
        }
Пример #12
0
 void Awake()
 {
     instance       = this;
     pointGenerator = gameObject.GetComponent <PointGenerator> ();
     if (pointGenerator == null)
     {
         Debug.LogWarning("Did not fount Point Generator");
     }
     gameTime = setGameTime;
 }
        void Start()
        {
            controls   = GetComponent <MouseControls>();
            gameScript = GetComponent <PlayerGameScript>();

            mainGameScript = FindObjectOfType <MainGameScript>();

            direction = Vector2.right;

            startingPosition = transform.position;

            newDay = false;
        }
Пример #14
0
 // Update is called once per frame
 void Update()
 {
     //Night doesn't last a determinate amount of time, so only move the texture during the day
     if (!MainGameScript.isNight)
     {
         //Lerp (linearly interpolate) between our two positions using a percentage of the day's progress as a weight, meaning this will automatically
         //adjust to changes in the day's length.
         transform.position = Vector3.Lerp(pos1, pos2, MainGameScript.DayProgress());
     }
     else
     {
         //the bottom of the texture is identical to the top so this may seem simple but it creates a smooth transition
         transform.position = pos2;
     }
 }
Пример #15
0
    // Update is called once per frame
    void Update()
    {
        //遊戲進行中不斷Update目前數字
        currentDisplay.text = string.Format("{0}", ScoreScript.CurrentPoint);
        scoreDisplay.text   = string.Format("{0}", ScoreScript.Score);
        scoreDisplay.Commit();

        if (targetPoint == ScoreScript.CurrentPoint)            //目標點數=現在點數,得分!

        //得分
        {
            ScoreScript.Score       += 10;
            ScoreScript.CurrentPoint = 0;
            resetTarget(BanSwitch);
            MainGameScript.GameTimeChange(gameTimeBonus);
            if (!SettingsScript.IsSFXMute)
            {
                AudioSource.PlayClipAtPoint(getScore, new Vector3(), 1f);
            }
        }
        //驗證是否超過目標數
        if (ScoreScript.CurrentPoint != 0 && (targetPoint < ScoreScript.CurrentPoint))                  //不為0 且 爆掉了
        {
            resetTarget(BanSwitch);
            fade();             //爆掉提示
            MainGameScript.GameTimeChange(gameTimeDeduct);
        }
        //驗證是否採到禁止數
        if (BanSwitch)                                          //禁數模式開啟
        {
            if (isBanned(ScoreScript.CurrentPoint, bannedMode)) //踩到禁數
            {
                resetTarget(BanSwitch);
                fade();                 //爆掉提示
                MainGameScript.GameTimeChange(gameTimeDeduct);
            }
        }

        //依各關不同控制
        //取得hitPoint然後依各關規則修改currentPoint
        //以本關為例,currentPoint要加hitPoint
        if (ScoreScript.HitPoint != 0)
        {
            ScoreScript.CurrentPoint += ScoreScript.HitPoint;
            ScoreScript.HitPoint      = 0;
        }
    }
    // Update is called once per frame
    void Update()
    {
        //遊戲進行中不斷Update目前數字
        currentDisplay.text = string.Format("{0}", ScoreScript.CurrentPoint);
        scoreDisplay.text   = string.Format("{0}", ScoreScript.Score);
        scoreDisplay.Commit();

        //得分
        if (ScoreScript.CurrentPoint == targetPoint)            //現在點數=目標1,得分!

        //得分
        {
            ScoreScript.Score += 10;
            //重設目標
            ScoreScript.CurrentPoint = resetTarget();
            //增加遊戲時間
            MainGameScript.GameTimeChange(gameTimeBonus);
        }

        //依各關不同控制
        //取得hitPoint然後依各關規則修改currentPoint
        if (ScoreScript.HitPoint != 0)
        {
            if ((ScoreScript.CurrentPoint % ScoreScript.HitPoint) == 0)                 //legal
            {
                ScoreScript.CurrentPoint /= ScoreScript.HitPoint;
            }
            else
            {
                //illegal 重設目標
                ScoreScript.CurrentPoint = resetTarget();
                fade();
                //減少遊戲時間
                MainGameScript.GameTimeChange(gameTimeDeduct);
            }

            ScoreScript.HitPoint = 0;
        }

        if (ScoreScript.CurrentPoint <= 0)          //出現不合理的數
        {
            ScoreScript.CurrentPoint = resetTarget();
            fade();
            MainGameScript.GameTimeChange(gameTimeDeduct);
        }
    }
Пример #17
0
    // Use this for initialization
    void Start()
    {
        mainGame = gameObject.GetComponent <MainGameScript> ();
        if (mainGame == null)
        {
            Debug.LogError("Unable to load MainGameScript");
        }

        pauseMenu.SetActive(false);
        pauseButton.SetActive(false);
        gameOverScreen.gameObject.SetActive(false);
        StartInstruction.SetActive(true);

        // Show Start Instruction and pause game on default.
        Time.timeScale = 0f;
        isPaused       = true;
    }
    // Update is called once per frame
    void Update()
    {
        //遊戲進行中不斷Update目前數字
        currentDisplay.text = string.Format("{0}", ScoreScript.CurrentPoint);
        scoreDisplay.text   = string.Format("{0}", ScoreScript.Score);
        scoreDisplay.Commit();

        //驗證得分
        if (targetPoint == ScoreScript.CurrentPoint)            //目標點數=現在點數,得分!

        //得分
        {
            ScoreScript.Score       += 10;
            ScoreScript.CurrentPoint = 0;
            resetTarget(BanSwitch);
            MainGameScript.GameTimeChange(gameTimeBonus);
        }
        //驗證是否超過目標數
        if (targetPoint > ScoreScript.CurrentPoint)             //不為0 且 爆掉了
        {
            resetTarget(BanSwitch);
            fade();
            MainGameScript.GameTimeChange(gameTimeDeduct);
        }
        //驗證是否採到禁止數
        if (BanSwitch)                                          //禁數模式開啟
        {
            if (isBanned(ScoreScript.CurrentPoint, bannedMode)) //踩到禁數
            {
                resetTarget(BanSwitch);
                fade();
                //扣遊戲時間
                MainGameScript.GameTimeChange(gameTimeDeduct);
            }
        }

        //依各關不同控制
        //取得hitPoint然後依各關規則修改currentPoint
        //以本關為例,currentPoint要減hitPoint
        if (ScoreScript.HitPoint != 0)
        {
            ScoreScript.CurrentPoint -= ScoreScript.HitPoint;
            ScoreScript.HitPoint      = 0;
        }
    }
Пример #19
0
    // Use this for initialization
    void Start()
    {
        self      = this.gameObject;
        mainGame  = GameObject.Find("Camera").GetComponent <MainGameScript>();
        myScore   = amIpiranha ? -10 : 10;
        missScore = amIpiranha ? 0 : -5;
        maxHeight = 0.5f;
        minHeight = -0.40f;

        moveUnit = Random.Range(0.01f, 0.03f);

        // Initial position
        self.transform.localPosition    = new Vector3(0, minHeight, 0);
        self.transform.localEulerAngles = new Vector3(-90, 90, 0);

        isMovingDown = false;
        atMax        = false;
    }
Пример #20
0
    private void Awake()
    {
        // if the singleton hasn't been initialized yet
        if (Instance != null && Instance != this)
        {
            Destroy(this.gameObject);
        }

        Instance       = this;
        starContainer  = GameObject.Find("StarIndicator");
        scoreText      = GameObject.Find("ScoreText").GetComponent <Text>();
        scoreText.text = score + "/" + goalScore;

        Transform canvas = GameObject.Find("LevelUICanvas").transform;

        loseScreen    = canvas.Find("LoseGame").gameObject;
        restartButton = canvas.Find("GameUI").Find("Restart").gameObject;
        startButton   = canvas.Find("GameUI").Find("Play").gameObject;
    }
Пример #21
0
    private ClientStateUpdateType MatchUpdateType(string updateType)
    {
        ClientStateUpdateType res = ClientStateUpdateType.Null;

        switch (MainGameScript.Str2CST(updateType))
        {
        case (MainGameScript.ClientStateTypes.CST_COUNT):
            res = ClientStateUpdateType.Cardcount;
            break;

        case (MainGameScript.ClientStateTypes.CST_MULLIGAN):
            res = ClientStateUpdateType.Mulligan;
            break;

        default:
            Debug.LogError("Error matching ClientStateType to a corresponding ClientStateUpdateType");
            break;
        }
        return(res);
    }
Пример #22
0
    // Use this for initialization
    void Start()
    {
        // DO NOT REMOVE THE CODE BELOW
        Screen.orientation = ScreenOrientation.Portrait;
        //

        mainGame = gameObject.GetComponent <MainGameScript> ();
        if (mainGame == null)
        {
            Debug.LogError("Unable to load MainGameScript");
        }

        pauseMenu.SetActive(false);
        pauseButton.SetActive(false);
        gameOverScreen.gameObject.SetActive(false);
        StartInstruction.SetActive(true);

        // Show Start Instruction and pause game on default.
        Time.timeScale = 0f;
        isPaused       = true;
    }
Пример #23
0
    void Awake()
    {
        instance       = this;
        pointGenerator = gameObject.GetComponent <PointGenerator> ();
        if (pointGenerator == null)
        {
            Debug.LogWarning("Did not fount Point Generator");
        }

        if (chooseMode.setDifficulty == 3)
        {
            gameTime = EasyModeTime;
        }
        if (chooseMode.setDifficulty == 2)
        {
            gameTime = MediumModeTime;
        }
        if (chooseMode.setDifficulty == 1)
        {
            gameTime = HardModeTime;
        }
    }
Пример #24
0
    // Use this for initialization
    void Awake()
    {
        mainGame      = GameObject.Find("Camera").GetComponent <MainGameScript>();
        effectTxtCtrl = GameObject.Find("EffectTxtPanel").GetComponent <EffectTextScript>();
        inGame        = mainGame.isGameStarted;
        isPausing     = mainGame.isPausing;
        amIInited     = false;
        amIActive     = false;

        timerMax = 10.0f;
        timerMin = 4.0f;

        generateClockFish = false;
        generateDSFish    = false;
        //nextGenTimer = Random.Range(0.0f, timerMax);

        fishPrefab       = Resources.Load("Prefabs/fs_g_fish") as GameObject;
        attackFishPrefab = Resources.Load("Prefabs/fs_b_fish") as GameObject;
        clockFishPrefab  = Resources.Load("Prefabs/fs_clock_fish") as GameObject;
        dsFishPrefab     = Resources.Load("Prefabs/fs_double_fish") as GameObject;
        fishCaughtPrefab = Resources.Load("Prefabs/fish_caught_hand") as GameObject;
        bFishBytePrefab  = Resources.Load("Prefabs/fish_bite_hand") as GameObject;

        frameNo         = 20;
        fadeOutFrame    = 0;
        fadingOut       = false;
        alphaChangeUnit = 1f / (float)frameNo;
        ExitState       = false;

        /* Sound Effect */
        effectSound = this.gameObject.GetComponent <AudioSource>();

        catchSound = Resources.Load("sounds/cat_meow_2") as AudioClip;
        missSound  = Resources.Load("sounds/beep1") as AudioClip;
        biteSound  = Resources.Load("sounds/bite_sound") as AudioClip;
    }
Пример #25
0
 // Use this for initialization
 void Start()
 {
     _mainGameScript = Camera.main.GetComponent<MainGameScript>();
 }
Пример #26
0
 void Start()
 {
     mainGameScript = FindObjectOfType <MainGameScript>();
 }
 void Awake()
 {
     instance = this;
     Application.targetFrameRate = 60;
 }
Пример #28
0
    // Called when the user has pressed the mouse button while over the collider
    void OnMouseDown()
    {
        //if this is first dot to be clicked on by user
        if (MainGameScript.First_Dot)
        {
            //play audio
            AudioScript.PlayAudio("dot");

            //save first dot in main script
            MainGameScript.Dot_One = this.gameObject;

            //color first dot the current player's color, so user knows it was clicked
            this.gameObject.GetComponent <MeshRenderer>().material.color =
                MainGameScript._Players[Convert.ToInt32(MainGameScript.Player_2_Turn)];

            //sets FirstDot bool to false, so next dot will execute the contents of the else statement
            MainGameScript.First_Dot = false;

            //loops through all dots to enlarge selectable ones
            foreach (GameObject currentDot in MainGameScript.Grid_Dots)
            {
                //save the names of the first dot and the current dot in the array
                string thisDotName   = MainGameScript.Dot_One.name;
                string secondDotName = currentDot.name;

                //save integers of firstDotNames for line coordinates
                int[] firstDot = new int[] { (int)Char.GetNumericValue(thisDotName[1]),
                                             (int)Char.GetNumericValue(thisDotName[2]),
                                             (int)Char.GetNumericValue(thisDotName[3]) };

                //save integers of secondDotNames for line coordinates
                int[] secondDot = new int[] { (int)Char.GetNumericValue(secondDotName[1]),
                                              (int)Char.GetNumericValue(secondDotName[2]),
                                              (int)Char.GetNumericValue(secondDotName[3]) };

                //checks if the two dots are the same dot
                if (firstDot[0] == secondDot[0] && firstDot[1] == secondDot[1] && firstDot[2] == secondDot[2])
                {
                    //leave selectable for cancelling purposes
                }

                //checks if the dots have the same Y and Z values, which means they are on the same X plane
                else if (firstDot[1] == secondDot[1] && firstDot[2] == secondDot[2])
                {
                    //Determines if they are close enough to be valid
                    int difference = firstDot[0] - secondDot[0];
                    if (Math.Abs(difference) == 1)
                    {
                        currentDot.transform.localScale = new Vector3((MainGameScript.DOT_BASE_SCALE * bigScale), (MainGameScript.DOT_BASE_SCALE * bigScale), (MainGameScript.DOT_BASE_SCALE * bigScale));
                        currentDot.gameObject.GetComponent <MeshRenderer>().material.color = selectableCol;
                    }
                    else
                    {
                        currentDot.gameObject.GetComponent <SphereCollider>().enabled = false;
                    }
                }
                //checks if the dots have the same X and Z values, which means they are on the same Y plane
                else if (firstDot[0] == secondDot[0] && firstDot[2] == secondDot[2])
                {
                    //Determines if they are close enough to be valid
                    int difference = firstDot[1] - secondDot[1];
                    if (Math.Abs(difference) == 1)
                    {
                        currentDot.transform.localScale = new Vector3((MainGameScript.DOT_BASE_SCALE * bigScale), (MainGameScript.DOT_BASE_SCALE * bigScale), (MainGameScript.DOT_BASE_SCALE * bigScale));
                        currentDot.gameObject.GetComponent <MeshRenderer>().material.color = selectableCol;
                    }
                    else
                    {
                        currentDot.gameObject.GetComponent <SphereCollider>().enabled = false;
                    }
                }
                //checks if the dots have the same X and Y values, which means they are on the same Z plane
                else if (firstDot[0] == secondDot[0] && firstDot[1] == secondDot[1])
                {
                    //Determines if they are close enough to be valid
                    int difference = firstDot[2] - secondDot[2];
                    if (Math.Abs(difference) == 1)
                    {
                        currentDot.transform.localScale = new Vector3((MainGameScript.DOT_BASE_SCALE * bigScale), (MainGameScript.DOT_BASE_SCALE * bigScale), (MainGameScript.DOT_BASE_SCALE * bigScale));
                        currentDot.gameObject.GetComponent <MeshRenderer>().material.color = selectableCol;
                    }
                    else
                    {
                        currentDot.gameObject.GetComponent <SphereCollider>().enabled = false;
                    }
                }
                //catches the rest of the dots
                else
                {
                    currentDot.gameObject.GetComponent <SphereCollider>().enabled = false;
                }
            }
        }

        //if this is the second dot to be clicked on by user
        else
        {
            //play audio
            AudioScript.PlayAudio("dot");

            //loop through and deactivate each dot
            foreach (GameObject currentDot in MainGameScript.Grid_Dots)
            {
                currentDot.gameObject.GetComponent <SphereCollider>().enabled = false;
            }

            //save second dot in main script
            MainGameScript.Dot_Two = this.gameObject;

            //color second dot the current player's color, so user knows it was clicked
            this.gameObject.GetComponent <MeshRenderer>().material.color =
                MainGameScript._Players[Convert.ToInt32(MainGameScript.Player_2_Turn)];

            //save the names of two last dots from main script
            string firstDotName  = MainGameScript.Dot_One.name;
            string secondDotName = MainGameScript.Dot_Two.name;

            //save integers of firstDotNames for line coordinates
            int[] firstDot = new int[] { (int)Char.GetNumericValue(firstDotName[1]),
                                         (int)Char.GetNumericValue(firstDotName[2]),
                                         (int)Char.GetNumericValue(firstDotName[3]) };

            //save integers of secondDotNames for line coordinates
            int[] secondDot = new int[] { (int)Char.GetNumericValue(secondDotName[1]),
                                          (int)Char.GetNumericValue(secondDotName[2]),
                                          (int)Char.GetNumericValue(secondDotName[3]) };

            //checks if the dots are the same dot, deselects the original dot
            if (firstDot[0] == secondDot[0] && firstDot[1] == secondDot[1] && firstDot[2] == secondDot[2])
            {
                MainGameScript.ResetDots();
            }

            //checks if the dots have the same Y and Z values, which means they will draw a X line
            else if (firstDot[1] == secondDot[1] && firstDot[2] == secondDot[2])
            {
                //Determines which X line is drawn based on dot's X position relative to one another
                int difference = firstDot[0] - secondDot[0];
                if (difference == -1)
                {
                    MainGameScript._currLine = ("X" + firstDotName[1] + firstDotName[2] + firstDotName[3]);
                    MainGameScript.DisplayConfirmUI();
                }
                else if (difference == 1)
                {
                    MainGameScript._currLine = ("X" + secondDotName[1] + secondDotName[2] + secondDotName[3]);
                    MainGameScript.DisplayConfirmUI();
                }
            }
            //checks if the dots have the same X and Z values, which means they will draw a Y line
            else if (firstDot[0] == secondDot[0] && firstDot[2] == secondDot[2])
            {
                //Determines which Y line is drawn based on dot's Y position relative to one another
                int difference = firstDot[1] - secondDot[1];
                if (difference == -1)
                {
                    MainGameScript._currLine = ("Y" + firstDotName[1] + firstDotName[2] + firstDotName[3]);
                    MainGameScript.DisplayConfirmUI();
                }
                else if (difference == 1)
                {
                    MainGameScript._currLine = ("Y" + secondDotName[1] + secondDotName[2] + secondDotName[3]);
                    MainGameScript.DisplayConfirmUI();
                }
            }
            //checks if the dots have the same X and Y values, which means they will draw a Z line
            else if (firstDot[0] == secondDot[0] && firstDot[1] == secondDot[1])
            {
                //Determines which Z line is drawn based on dot's Z position relative to one another
                int difference = firstDot[2] - secondDot[2];
                if (difference == -1)
                {
                    MainGameScript._currLine = ("Z" + firstDotName[1] + firstDotName[2] + firstDotName[3]);
                    MainGameScript.DisplayConfirmUI();
                }
                else if (difference == 1)
                {
                    MainGameScript._currLine = ("Z" + secondDotName[1] + secondDotName[2] + secondDotName[3]);
                    MainGameScript.DisplayConfirmUI();
                }
            }
        }
    }
Пример #29
0
 //Called to have CPU draw a line; mainly for testing
 public void onCPUDrawClick()
 {
     MainGameScript.CPUDraw(1);
 }
Пример #30
0
    public static void Draw(char objType, int i, int j, int k)
    {
        //play audio
        AudioScript.PlayAudio("line");

        GameObject drawnLine = null;

        if (objType == 'X')
        {
            drawnLine = MainGameScript.Grid_LinesX[i, j, k];
        }
        else if (objType == 'Y')
        {
            drawnLine = MainGameScript.Grid_LinesY[i, j, k];
        }
        else if (objType == 'Z')
        {
            drawnLine = MainGameScript.Grid_LinesZ[i, j, k];
        }

        drawnLine.GetComponentsInChildren <MeshRenderer>()[0].enabled = true;

        if (objType == 'X')
        {
            if (j == 0)
            {
                if (k == 0)
                {
                    if (!MainGameScript.UpdateBox(i, j, k))
                    {
                        MainGameScript.SwitchPlayer();
                    }
                }
                else if (k == MainGameScript.GRID_SIZE)
                {
                    if (!MainGameScript.UpdateBox(i, j, k - 1))
                    {
                        MainGameScript.SwitchPlayer();
                    }
                }
                else
                {
                    if (!MainGameScript.UpdateBox(i, j, k - 1) &
                        !MainGameScript.UpdateBox(i, j, k))
                    {
                        MainGameScript.SwitchPlayer();
                    }
                }
            }

            else if (j == MainGameScript.GRID_SIZE)
            {
                if (k == 0)
                {
                    if (!MainGameScript.UpdateBox(i, j - 1, k))
                    {
                        MainGameScript.SwitchPlayer();
                    }
                }
                else if (k == MainGameScript.GRID_SIZE)
                {
                    if (!MainGameScript.UpdateBox(i, j - 1, k - 1))
                    {
                        MainGameScript.SwitchPlayer();
                    }
                }
                else
                {
                    if (!MainGameScript.UpdateBox(i, j - 1, k - 1) &
                        !MainGameScript.UpdateBox(i, j - 1, k))
                    {
                        MainGameScript.SwitchPlayer();
                    }
                }
            }
            else
            {
                if (k == 0)
                {
                    if (!MainGameScript.UpdateBox(i, j - 1, k) &
                        !MainGameScript.UpdateBox(i, j, k))
                    {
                        MainGameScript.SwitchPlayer();
                    }
                }
                else if (k == MainGameScript.GRID_SIZE)
                {
                    if (!MainGameScript.UpdateBox(i, j - 1, k - 1) &
                        !MainGameScript.UpdateBox(i, j, k - 1))
                    {
                        MainGameScript.SwitchPlayer();
                    }
                }
                else
                {
                    if (!MainGameScript.UpdateBox(i, j - 1, k - 1) &
                        !MainGameScript.UpdateBox(i, j - 1, k) &
                        !MainGameScript.UpdateBox(i, j, k - 1) &
                        !MainGameScript.UpdateBox(i, j, k))
                    {
                        MainGameScript.SwitchPlayer();
                    }
                }
            }
        }

        else if (objType == 'Y')
        {
            if (i == 0)
            {
                if (k == 0)
                {
                    if (!MainGameScript.UpdateBox(i, j, k))
                    {
                        MainGameScript.SwitchPlayer();
                    }
                }
                else if (k == MainGameScript.GRID_SIZE)
                {
                    if (!MainGameScript.UpdateBox(i, j, k - 1))
                    {
                        MainGameScript.SwitchPlayer();
                    }
                }
                else
                {
                    if (!MainGameScript.UpdateBox(i, j, k - 1) &
                        !MainGameScript.UpdateBox(i, j, k))
                    {
                        MainGameScript.SwitchPlayer();
                    }
                }
            }

            else if (i == MainGameScript.GRID_SIZE)
            {
                if (k == 0)
                {
                    if (!MainGameScript.UpdateBox(i - 1, j, k))
                    {
                        MainGameScript.SwitchPlayer();
                    }
                }
                else if (k == MainGameScript.GRID_SIZE)
                {
                    if (!MainGameScript.UpdateBox(i - 1, j, k - 1))
                    {
                        MainGameScript.SwitchPlayer();
                    }
                }
                else
                {
                    if (!MainGameScript.UpdateBox(i - 1, j, k - 1) &
                        !MainGameScript.UpdateBox(i - 1, j, k))
                    {
                        MainGameScript.SwitchPlayer();
                    }
                }
            }
            else
            {
                if (k == 0)
                {
                    if (!MainGameScript.UpdateBox(i - 1, j, k) &
                        !MainGameScript.UpdateBox(i, j, k))
                    {
                        MainGameScript.SwitchPlayer();
                    }
                }
                else if (k == MainGameScript.GRID_SIZE)
                {
                    if (!MainGameScript.UpdateBox(i - 1, j, k - 1) &
                        !MainGameScript.UpdateBox(i, j, k - 1))
                    {
                        MainGameScript.SwitchPlayer();
                    }
                }
                else
                {
                    if (!MainGameScript.UpdateBox(i - 1, j, k - 1) &
                        !MainGameScript.UpdateBox(i - 1, j, k) &
                        !MainGameScript.UpdateBox(i, j, k - 1) &
                        !MainGameScript.UpdateBox(i, j, k))
                    {
                        MainGameScript.SwitchPlayer();
                    }
                }
            }
        }

        else if (objType == 'Z')
        {
            if (i == 0)
            {
                if (j == 0)
                {
                    if (!MainGameScript.UpdateBox(i, j, k))
                    {
                        MainGameScript.SwitchPlayer();
                    }
                }
                else if (j == MainGameScript.GRID_SIZE)
                {
                    if (!MainGameScript.UpdateBox(i, j - 1, k))
                    {
                        MainGameScript.SwitchPlayer();
                    }
                }
                else
                {
                    if (!MainGameScript.UpdateBox(i, j - 1, k) &
                        !MainGameScript.UpdateBox(i, j, k))
                    {
                        MainGameScript.SwitchPlayer();
                    }
                }
            }

            else if (i == MainGameScript.GRID_SIZE)
            {
                if (j == 0)
                {
                    if (!MainGameScript.UpdateBox(i - 1, j, k))
                    {
                        MainGameScript.SwitchPlayer();
                    }
                }
                else if (j == MainGameScript.GRID_SIZE)
                {
                    if (!MainGameScript.UpdateBox(i - 1, j - 1, k))
                    {
                        MainGameScript.SwitchPlayer();
                    }
                }
                else
                {
                    if (!MainGameScript.UpdateBox(i - 1, j - 1, k) &
                        !MainGameScript.UpdateBox(i - 1, j, k))
                    {
                        MainGameScript.SwitchPlayer();
                    }
                }
            }
            else
            {
                if (j == 0)
                {
                    if (!MainGameScript.UpdateBox(i - 1, j, k) &
                        !MainGameScript.UpdateBox(i, j, k))
                    {
                        MainGameScript.SwitchPlayer();
                    }
                }
                else if (j == MainGameScript.GRID_SIZE)
                {
                    if (!MainGameScript.UpdateBox(i - 1, j - 1, k) &
                        !MainGameScript.UpdateBox(i, j - 1, k))
                    {
                        MainGameScript.SwitchPlayer();
                    }
                }
                else
                {
                    if (!MainGameScript.UpdateBox(i - 1, j - 1, k) &
                        !MainGameScript.UpdateBox(i - 1, j, k) &
                        !MainGameScript.UpdateBox(i, j - 1, k) &
                        !MainGameScript.UpdateBox(i, j, k))
                    {
                        MainGameScript.SwitchPlayer();
                    }
                }
            }
        }
    }
Пример #31
0
 void Awake()
 {
     instance = this;
 }
Пример #32
0
 void Awake()
 {
     instance = this;
 }