// Update is called once per frame
    void Update()
    {
        //ゾンビの増殖
        zombies = GameObject.FindGameObjectsWithTag("zombie");
        if (zombies.Length < 4)
        {
            Instantiate(zombie,
                        new Vector3(Random.Range(-stageWidth / 2, stageWidth / 2), 0, Random.Range(-stageHeight / 2, stageHeight / 2)), Quaternion.identity);
        }

        //HPが0になった時
        if (PlayerHP <= 0)
        {
            print("YouDied");

            //プレイヤーのHPがゼロの時に表示
            panel.SetActive(true);
            messeage.SetActive(true);
            ResetMessage.SetActive(true);
            YourScore.SetActive(true);
            YourScore1.text = "Your Score:" + score;


            ////GameControllerクラスにあるクラスメソッド・FixedCameraを呼び出す。
            GyroScript.FixedCamera();

            //タイトルへ戻るメソッドの呼び出し
            Invoke("ReturnTitle", 5.0f);
        }
    }
    // Use this for initialization
    void Start()
    {
        stageWidth  = stage.GetComponent <Renderer> ().bounds.size.x;
        stageHeight = stage.GetComponent <Renderer> ().bounds.size.z;

        YourScore1 = YourScore.GetComponent <Text> ();
    }
Exemplo n.º 3
0
 private void Desk_Load(object sender, EventArgs e)
 {
     YourScore.Hide();
     OpponentsScore.Hide();
     MainButton.Width = 140;
     MainButton.Text  = "Connect to server";
 }
Exemplo n.º 4
0
        private void GenerateCards()
        {
            YourScore.Show();
            YourScore.Text = "Your Score: 0";
            OpponentsScore.Show();
            OpponentsScore.Text = "Opponent's Score: 0";
            _opponentPic        = new PictureBox
            {
                Name     = "Opponent's Card",
                Image    = Resources.card_back_blue,
                Location = new Point(Width - 125, 10),
                Size     = new Size(100, 114),
                SizeMode = PictureBoxSizeMode.StretchImage
            };
            Controls.Add(_opponentPic);
            Point nextLocation = new Point(10, 134);

            for (int i = 0; i < 10; i++)
            {
                PictureBox currentPic = new PictureBox
                {
                    Name     = "picDynamic" + i,
                    Image    = Resources.card_back_red,
                    Location = nextLocation,
                    Size     = new Size(100, 114),
                    SizeMode = PictureBoxSizeMode.StretchImage
                };
                currentPic.Click += (sender, e) => {
                    if (!string.IsNullOrEmpty(_drawnCard))
                    {
                        return;
                    }
                    // Generate a random card
                    _drawnCard       = RandomCard();
                    currentPic.Name  = _drawnCard;
                    currentPic.Image = (Image)Resources.ResourceManager.GetObject(FileNameByCard(currentPic.Name));
                    _amountOfOpenedCards++;
                    // Send the Generated card
                    BeginSend("1" + currentPic.Name);
                    // Receive an answer
                    BeginRead();
                    // Remove click event handler
                    FieldInfo currentPicFieldInfo = typeof(Control).GetField("EventClick",
                                                                             BindingFlags.Static | BindingFlags.NonPublic);
                    object       obj = currentPicFieldInfo?.GetValue(currentPic);
                    PropertyInfo currentPicPropertyInfo = currentPic.GetType().GetProperty("Events",
                                                                                           BindingFlags.NonPublic | BindingFlags.Instance);
                    EventHandlerList list = (EventHandlerList)currentPicPropertyInfo?.GetValue(currentPic, null);
                    list?.RemoveHandler(obj, list[obj]);
                };
                Controls.Add(currentPic);
                nextLocation.X += currentPic.Size.Width + 10;
                MainButton.Text = "Forfiet";
            }
        }
Exemplo n.º 5
0
        private void ScoreWindow_Load(object sender, EventArgs e)
        {
            YourScore.AppendText(" " + score.ToString());

            using (StreamReader sr = File.OpenText(path))
            {
                int    count = 0;
                string s     = "";
                while ((s = sr.ReadLine()) != null && count < 8)
                {
                    TextBoxNumbers.AppendText(s);
                    TextBoxNumbers.AppendText(Environment.NewLine);
                    count++;
                }
            }
        }
Exemplo n.º 6
0
        public static void Draw(SpriteBatch a_SpriteBatch)
        {
            if (YourScore != null)
            {
                a_SpriteBatch.DrawString(LargeFont, YourScore.DisplayScore(), YOUR_SCORE_LOCATION, Color.Purple);
                if (YourScore.SnakePlayer.IsDead)
                {
                    a_SpriteBatch.DrawString(LargeFont, YourScore.DisplayDead(), YOUR_SCORE_LOCATION + new Vector2(0, spacing * 2.0f), Color.Purple);
                }
            }

            for (int loop = 0; loop < PlayerScores.Count; loop++)
            {
                a_SpriteBatch.DrawString(SmallFont, PlayerScores[loop].DisplayScore(), SCOREBOARD_LOCATION + new Vector2(0, loop * spacing), Color.Purple);
            }
        }