Пример #1
0
 public void ChangeLevel()
 {
     WinPanel.SetActive(false);
     startPanel.SetActive(true);
     level++;
     levelText.text = level.ToString();
     life++;
     SceneManager.LoadScene("Level");
 }
Пример #2
0
        public void PlayButton()
        {
            WinPanel.SetActive(false);

            mainMenuPanel.SetActive(false); // when clicked on play button, then main menu panel should be deactivated
            gameMenuPanel.SetActive(true);  // and game menu panel should set activated to true

            LevelManager.instance.GameStarted();
        }
Пример #3
0
    public void SwithUIPanels(GameObject panel)
    {
        StartGamePanel.SetActive(false);
        GamePanel.SetActive(false);
        WinPanel.SetActive(false);
        LosePanel.SetActive(false);

        panel.SetActive(true);
    }
Пример #4
0
 public void WinLose()
 {
     if (counter.count > counter.allCount / 2)
     {
         WinPanel.SetActive(true);
     }
     else
     {
         LosePanel.SetActive(true);
     }
 }
Пример #5
0
 void Update()
 {
     if (grid.extras.transform.childCount <= 0 && start)
     {
         start = false;
         WinPanel.SetActive(true);
         audioSource.clip = win;
         audioSource.Play();
         Invoke("ChangeLevel", 2);
     }
 }
 public void MainMenu()
 {
     WinPanel.SetActive(false);
     LoosePanel.SetActive(false);
     StartPanel.SetActive(true);
     FireScript.GameOver = false;
     //  GameObject.FindGameObjectWithTag("Cycle").SetActive(false);
     Destroy(GameObject.FindGameObjectWithTag("Cycle"));
     Destroy(GameObject.FindGameObjectWithTag("Swim"));
     Destroy(GameObject.FindGameObjectWithTag("Shoot"));
     Destroy(GameObject.FindGameObjectWithTag("Weight"));
 }
    private void Update()
    {
        GameObject[] Obs     = GameObject.FindGameObjectsWithTag("ObsO");
        GameObject[] Ocircle = GameObject.FindGameObjectsWithTag("Ocircle");

        if (Obs.Length == 0 && Ocircle.Length == 5)
        {
            Debug.Log("You WIn");
            WinPanel.SetActive(true);
        }
        if (FireScript.GameOver)
        {
            LoosePanel.SetActive(true);
        }
    }
Пример #8
0
    public void NewGame()
    {
        WinPanel.SetActive(false);
        foreach (Transform obj in DiscardPile)
        {
            Destroy(obj.gameObject);
        }
        Destroy(ShowCard.GetChild(0).gameObject);
        myDeck = tempDeck;
        Shuffle();
        discardDeck.Clear();

        round = 1;
        RoundStart();
    }
Пример #9
0
 public void Starbutton()
 {
     starHolder.SetActive(true);
     s1.color = Color.black;
     s2.color = Color.black;
     s3.color = Color.black;
     fakeBall.SetActive(false);
     inMenu = false;
     lose   = false;
     win    = false;
     WinPanel.SetActive(false);
     losePanel.SetActive(false);
     respawnManager.currentBall    = 5;
     respawnManager.scoreMultipler = 1;
     respawnManager.score          = 0;
     respawnManager.basketCount    = 0;
     respawnManager.respawn1       = true;
     startPanel.SetActive(false);
 }
Пример #10
0
    void attack_RPC(string lastTouchSensor, string touchTargetSensor)
    {
        GameObject lastTouch   = GameObject.Find(lastTouchSensor).GetComponent <SensorControl>().getCollisionObj();
        GameObject touchTarget = GameObject.Find(touchTargetSensor).GetComponent <SensorControl>().getCollisionObj();

        preSensor = lastTouchSensor;
        nowSensor = touchTargetSensor;
        lastTouch.transform.position = touchTarget.transform.position;
        lastMovedPosition            = setMovePosition(touchTarget);
        moveSound(lastTouch);
        Destroy(touchTarget);
        if (nowTurn.Equals("Han"))
        {
            nowTurn = "Cho";
        }
        else
        {
            nowTurn = "Han";
        }

        if (touchTarget.name.Equals("Han_King(Clone)") || touchTarget.name.Equals("Cho_King(Clone)"))
        {
            if (touchTarget.name.Substring(0, 3).Equals(myTag))   // 패배
            {
                aud.PlayOneShot(loseSound);
                LosePanel.SetActive(true);
                PlayingSound.SetActive(false);
                JangGoonSound.SetActive(false);
            }
            else   // 승리
            {
                aud.PlayOneShot(winSound);
                WinPanel.SetActive(true);
                PlayingSound.SetActive(false);
                JangGoonSound.SetActive(false);
            }
        }

        else
        {
            StartCoroutine("JangGoonCheck");
        }
    }
Пример #11
0
 // Update is called once per frame
 void FixedUpdate()
 {
     if (lose)
     {
         starHolder.SetActive(false);
         losePanel.SetActive(true);
         if (respawnManager.basketCount == 1 || respawnManager.basketCount == 0)
         {
             starpanel1.SetActive(true);
             starpanel2.SetActive(false);
         }
         if (respawnManager.basketCount == 2)
         {
             starpanel1.SetActive(false);
             starpanel2.SetActive(true);
         }
         loScore.text = "Score = " + respawnManager.score.ToString();
     }
     if (win)
     {
         starHolder.SetActive(false);
         WinPanel.SetActive(true);
         wiScore.text = "Score = " + respawnManager.score.ToString();
     }
     if (respawnManager.basketCount == 1)
     {
         s1.color = Color.white;
     }
     if (respawnManager.basketCount == 2)
     {
         s2.color = Color.white;
     }
     if (respawnManager.basketCount == 3)
     {
         s3.color = Color.white;
     }
 }
Пример #12
0
 public void Win() //win panel
 {
     gameMenuPanel.SetActive(false);
     WinPanel.SetActive(true);
     GameManager.singleton.gameStatus = GameStatus.FAILED;
 }
Пример #13
0
    void FixedUpdate()
    {
        if (Input.GetMouseButtonDown(0) && nowTurn.Equals(myTag))
        {
            touchTarget = GetClickedObject();

            if (!touchTarget.tag.Equals("Field"))
            {
                removeAllEnemyObjs();
                if (lastMeObj != null)
                {
                    removeObj(lastMeObj);
                }
                if (lastMovedPosition != null)
                {
                    removeObj(lastMovedPosition);
                }
            }

            if (touchTarget.tag.Equals("Han") || touchTarget.tag.Equals("Cho"))   // 말 선택시

            {
                if (isChoosing && !touchTarget.tag.Equals(myTag))   // 말 선택 중 다른 팀 선택 했을때
                {
                    if (touchTarget.GetComponent <MalScript>().getSensorObj().GetComponent <Renderer>().enabled)
                    {
                        view.RPC("attack_RPC", PhotonTargets.All, lastTouch.GetComponent <MalScript>().getSensorObj().name, touchTarget.GetComponent <MalScript>().getSensorObj().name);
                        offAllSensors();
                        isChoosing = false;
                    }
                }

                else if (touchTarget.tag.Equals(myTag))   // 자기 팀을 선택 하면
                {
                    offAllSensors();
                    lastMeObj = setMeObj(touchTarget);
                    lastTouch = touchTarget;
                    if (publicVariable.getIsModeling())
                    {
                        touchVoice(touchTarget.name);
                    }
                    searchPath.searchPath(touchTarget.GetComponent <MalScript>().getSensorObj().name, touchTarget.name);
                    isChoosing = true;
                }
            }

            else if (touchTarget.tag.Equals("Sensor"))                           // 센서 선택시
            {
                if (isChoosing && touchTarget.GetComponent <Renderer>().enabled) // 말 선택 중 이동가능한 센서 선택시
                {
                    preSensor = lastTouch.GetComponent <MalScript>().getSensorObj().name;
                    view.RPC("move_RPC", PhotonTargets.All, preSensor, touchTarget.name);
                    isChoosing = false;
                    offAllSensors();
                }
            }
        }

        if (!publicVariable.getIsPlayer())   // 상대나가면 승리
        {
            aud.PlayOneShot(winSound);
            WinPanel.SetActive(true);
            PlayingSound.SetActive(false);
            JangGoonSound.SetActive(false);
        }
    }
Пример #14
0
 private void CheckSolution(string myChoice)
 {
     if (round == 1)
     {
         PullCard();
         Card thisCard = ShowCard.GetChild(0).GetComponent <Card>();
         if (myChoice == thisCard.color.ToLower())
         {
             round++;
         }
         else
         {
             Lose = true;
         }
     }
     else if (round == 2)
     {
         PullCard();
         Card   thisCard = ShowCard.GetChild(0).GetComponent <Card>();
         Card   prevCard = DiscardPile.GetChild(DiscardPile.childCount - 1).GetComponent <Card>();
         string answer   = (thisCard.number > prevCard.number) ? "high" : "low";
         if (myChoice == answer)
         {
             round++;
         }
         else
         {
             Lose = true;
         }
     }
     else if (round == 3)
     {
         PullCard();
         Card   thisCard = ShowCard.GetChild(0).GetComponent <Card>();
         Card   HighCard = (DiscardPile.GetChild(DiscardPile.childCount - 1).GetComponent <Card>().number > DiscardPile.GetChild(DiscardPile.childCount - 2).GetComponent <Card>().number) ? DiscardPile.GetChild(DiscardPile.childCount - 1).GetComponent <Card>() : DiscardPile.GetChild(DiscardPile.childCount - 2).GetComponent <Card>();
         Card   LowCard  = (DiscardPile.GetChild(DiscardPile.childCount - 1).GetComponent <Card>() == HighCard) ? DiscardPile.GetChild(DiscardPile.childCount - 2).GetComponent <Card>() : DiscardPile.GetChild(DiscardPile.childCount - 1).GetComponent <Card>();
         string answer   = (thisCard.number <= HighCard.number && thisCard.number >= LowCard.number) ? "inbetween" : "outside";
         if (myChoice == answer)
         {
             round++;
         }
         else
         {
             Lose = true;
         }
     }
     else if (round == 4)
     {
         PullCard();
         Card thisCard = ShowCard.GetChild(0).GetComponent <Card>();
         if (myChoice == thisCard.Suit.ToLower())
         {
             WinPanel.SetActive(true);
         }
         else
         {
             Lose = true;
         }
     }
     Wait(5f);
     if (round <= 4)
     {
         RoundStart();
     }
 }
Пример #15
0
 public void win()
 {
     Time.timeScale = 0;
     WinPanel.SetActive(true);
 }
Пример #16
0
    /// <summary>
    /// 0.2秒执行一回合
    /// </summary>
    /// <returns></returns>
    IEnumerator Turn()
    {
        var AnotherGameObj = GameObject.Find("Player1").GetComponent <TileHero>();
        var TargetGameObj  = GameObject.Find("Player0").GetComponent <TileHero>();

        AnotherGameObj.ChangeCode("require 'script'");

        while (turnnum < MaxTurn)
        {
            TextTurn.text = turnnum.ToString();

            turnnum++;
            TargetGameObj.OnTurn();
            TextBlue.text = GetScore(TileCtrl.EPlayer.Player0).ToString();
            yield return(new WaitForSeconds(0.2f));

            AnotherGameObj.OnTurn();
            TextRed.text = GetScore(TileCtrl.EPlayer.Player1).ToString();
            yield return(new WaitForSeconds(0.2f));

            foreach (var tl in Map)
            {
                if (tl.Value.Player != TileCtrl.EPlayer.No)
                {
                    continue;
                }
                int countA = 0;
                int countB = 0;
                for (int i = 0; i < 4; i++)
                {
                    TileCtrl t;
                    if (Map.TryGetValue(tl.Value.pos + dir[i], out t))
                    {
                        if (t.Player == TileCtrl.EPlayer.Player0)
                        {
                            countA++;
                        }
                        if (t.Player == TileCtrl.EPlayer.Player1)
                        {
                            countB++;
                        }
                    }
                }

                if (countA == 4)
                {
                    tl.Value.Player        = TileCtrl.EPlayer.Player0;
                    tl.Value.BuildingLevel = 3;
                    tl.Value.Type          = TileCtrl.EType.Building;
                }
                else if (countB == 4)
                {
                    tl.Value.Player        = TileCtrl.EPlayer.Player1;
                    tl.Value.BuildingLevel = 3;
                    tl.Value.Type          = TileCtrl.EType.Building;
                }
            }
        }

        if (GetScore(TargetGameObj.Player) > GetScore(AnotherGameObj.Player))
        {
            WinPanel.SetActive(true);
        }
        else
        {
            FailedPanel.SetActive(true);
        }
    }