Beispiel #1
0
    void Start()
    {
        Panel_Start        = transform.Find("Panel_Start").gameObject;
        Panel_Game         = transform.Find("Panel_Game").gameObject;
        userImage          = transform.Find("UserImage").GetComponent <RawImage>();
        canvasGroup        = userImage.GetComponent <CanvasGroup>();
        Cursor             = transform.Find("Cursor").GetComponent <Image>();
        mButton_NewGame    = transform.Find("Panel_Start/Button_NewGame/NewGameCircle");
        mButton_Dojo       = transform.Find("Panel_Start/Button_Dojo/DojoCircle");
        mButton_Quit       = transform.Find("Panel_Start/Button_Quit/QuitCircle");
        mButton_Apple      = transform.Find("Panel_Start/Button_Dojo/Apple");
        mButton_Strawberry = transform.Find("Panel_Start/Button_NewGame/Strawberry");
        mbutton_Boom       = transform.Find("Panel_Start/Button_Quit/Boom");
        titleTF            = transform.Find("Panel_Start/Title");
        scoreCountUI       = transform.Find("Panel_Game/Score/ScoreCount").GetComponent <Text>();
        bestCountUI        = transform.Find("Panel_Game/BestScore").GetComponent <Text>();
        //gamoverCG = transform.Find("Panel_Game/GameOver").GetComponent<CanvasGroup>();
        gameOver = transform.Find("Panel_Game/GameOver").gameObject;

        GetLifeToggles();
        UpdateBestScoreUI();
        //print("Hieght" + KinectManager.Instance.GetDepthImageHeight() + "width" + KinectManager.Instance.GetDepthImageWidth());
        UIAnimation(mButton_Dojo);
        UIAnimation(mButton_NewGame);
        UIAnimation(mButton_Quit);
        Panel_Game.SetActive(false);
        gameOver.SetActive(false);
        ShowTitle();
    }
Beispiel #2
0
 public bool AddCash(int num)
 {
     if (save.player.cash + num < 0)
     {
         notice = "You have not enough cash";
         panelManager.ShowPanel(PanelType.Notice);
         return(false);
     }
     else
     {
         save.player.cash += num;
         if (gamePanel is null)
         {
             gamePanel = panelManager.GetPanel(PanelType.Game).GetComponent <Panel_Game>();
         }
         gamePanel.RefreshCash();
         if (num > 0)
         {
             coinCollectIsGold = false;
             coinCollect.SetActive(true);
             ShowGetRewardEffect();
         }
         return(true);
     }
 }
Beispiel #3
0
 private void Button_Solve_Click(object sender, EventArgs e)
 {
     try
     {
         Maze.Solve();
         Panel_Game.Invalidate();
     }
     catch
     {
         MessageBox.Show("迷宫无解!!!");
     }
 }
Beispiel #4
0
 public void SwitchPanel(bool toGame)
 {
     if (toGame)
     {
         Panel_Start.SetActive(false);
         Panel_Game.SetActive(true);
     }
     else
     {
         Panel_Start.SetActive(true);
         Panel_Game.SetActive(false);
     }
 }
Beispiel #5
0
 public int AddEnergy(int value = 1)
 {
     save.player.energy += value;
     if (save.player.energy > SaveManager.PLAYER_MAXENERGY)
     {
         save.player.energy = SaveManager.PLAYER_MAXENERGY;
     }
     if (gamePanel is null)
     {
         gamePanel = panelManager.GetPanel(PanelType.Game).GetComponent <Panel_Game>();
     }
     gamePanel.RefreshEnergy();
     return(save.player.energy);
 }
Beispiel #6
0
 public bool ReduceEnergy(int value = 1)
 {
     if (save.player.energy - value < 0)
     {
         return(false);
     }
     else
     {
         save.player.energy -= value;
         if (gamePanel is null)
         {
             gamePanel = panelManager.GetPanel(PanelType.Game).GetComponent <Panel_Game>();
         }
         gamePanel.RefreshEnergy();
         save.player.totalWasteEnergy += value;
         return(true);
     }
 }
Beispiel #7
0
        private void Button_SolveUsingFromTo_Click(object sender, EventArgs e)
        {
            try
            {
                int fromX = ToInt32(TextBox_FromX.Text);
                int fromY = ToInt32(TextBox_FromY.Text);

                int toX = ToInt32(TextBox_ToX.Text);
                int toY = ToInt32(TextBox_ToY.Text);

                Maze.Solve(fromX, fromY, toX, toY);
            }
            catch
            {
                MessageBox.Show("文本框输入信息无解!");
            }
            Panel_Game.Invalidate();
        }
Beispiel #8
0
 private void Button_Generate_Click(object sender, EventArgs e)
 {
     Maze.Reset();
     Panel_Game.Invalidate();
 }