MainWindow
Inheritance: System.Windows.Window, System.Windows.Markup.IComponentConnector
Ejemplo n.º 1
0
        public Bomb(MainWindow window, float waitTime, int power, float positionX, float positionY, int owner, int[] position , float worldTime)
        {
            //炸彈存在
            _Is_alive = true;
            player_on = new bool[] { false, false };

            _window = window;
            _waitTime = waitTime;
            _power = power;
            _positionX = positionX;
            _positionY = positionY;
            _position = position;
            _player = owner;
            _worldTime = worldTime;

            //產生炸彈圖片
            myImage = new Image();
            myImage.Stretch = Stretch.Fill;
            myImage.Source = Game_data.instance.bomber;
            myImage.Width = 60;
            myImage.Height = 60;
            //設定位置
            myImage.Margin = new Thickness(_positionX, _positionY, 0, 0);
            _window.mainGrid.Children.Add(myImage);

            //在放置時判斷有哪些玩家踩在上面
            foreach (Player target in Game_data.instance.Player_list)
            {
                if (Tools.instance.AABBtest(target._PositionX + 10, target._PositionY + 10, target._PositionX + 50, target._PositionY + 50, _position[0] * 60 + 10, _position[1] * 60 + 10, _position[0] * 60 + 50, _position[1] * 60 + 50))
                {
                    player_on[target.number] = true;
                }
            }
        }
Ejemplo n.º 2
0
 public Game(MainWindow window,int PlayerAmount)
 {
     _window = window;
     _PlayerAmount = PlayerAmount;
 }
Ejemplo n.º 3
0
 ////圖片路徑
 //public string TopImage = "Images/top.png";
 //public string DownImage = "Images/down.png";
 //public string LeftImage = "Images/left.png";
 //public string RightImage = "Images/right.png";
 //public string DieImage = "Images/die.png";
 //使用圖片法 imageLogo.Source = new BitmapImage(new Uri("logo.jpg", UriKind.Relative));
 public Player(MainWindow window, int player_num)
 {
     _window = window;
     number = player_num;
 }