예제 #1
0
파일: Map.cs 프로젝트: rio900/voins
        public void CreatePlayer(Player player)
        {
            Players.Add(player);
            Canvas.SetZIndex(player.GameObject.View, 1000);
            ///Если один игрок
            ///Левый верхний угол спаума
            if (Players.Count == 1)
            {
                CreateObject(player, 0, 0);
            }
            else if (Players.Count == 2)
            {
                player.PositionX = Calls.Last().IndexLeft;
                player.PositionY = Calls.Last().IndexTop;
                CreateObject(player, Calls.Last().IndexLeft, Calls.Last().IndexTop);
                //player.PositionX = Calls[2].IndexLeft;
                //player.PositionY = Calls[2].IndexTop;
                //CreateObject(player, Calls[2].IndexLeft, Calls[2].IndexTop);
            }
            else if (Players.Count == 3)
            {
                Map_Cell call = Calls[208];
                player.PositionX = call.IndexLeft;
                player.PositionY = call.IndexTop;
                CreateObject(player, call.IndexLeft, call.IndexTop);
            }
            else if (Players.Count == 4)
            {
                Map_Cell call = Calls[12];
                player.PositionX = call.IndexLeft;
                player.PositionY = call.IndexTop;
                CreateObject(player, call.IndexLeft, call.IndexTop);
            }

            #region Добавление игрока
            ///И его же добавим в масив всех объектов
            GameObjectInCall.Add(player.GameObject);
            ///Отображение
            MapCanvas.Children.Add(player.GameObject.View);
            #endregion
        }