private void Awake() { gameController = FindObjectOfType <GameController>(); mapCreator = FindObjectOfType <MapCreator>(); //if(gameController.gameplay_enetrance == 2) //{ // this.gameObject.SetActive(false); //} Analytics.CustomEvent("level_finish", new Dictionary <string, object> { { "level_index", gameController.cur_level }, { "session_id", AnalyticsSessionInfo.sessionId }, { "user_id", AnalyticsSessionInfo.userId }, { "steps", final_step }, { "time_elapsed", Time.realtimeSinceStartup - AnalyticsHelper.time_startPlayingLevel }, { "tries", AnalyticsHelper.GetTries(gameController.cur_level) } }); AnalyticsHelper.ResetTries(gameController.cur_level); if (gameController.gameplay_enetrance == 1) { next_button.gameObject.SetActive(false); } }
void Start() { map_creator = GameObject.Find("GameRoot").GetComponent <MapCreator>(); player = GameObject.Find("Player"); gameManager = GameObject.Find("GameManager").GetComponent <GameManager>(); forceControl = player.GetComponent <ForceControl>(); }
private MapTile FindNearestTarget(CharacterListVariable list) { TacticsMove closest = null; int distance = 1000; for (int i = 0; i < list.values.Count; i++) { if (list.values[i] == this || !list.values[i].IsAlive()) { continue; } int tempDist = MapCreator.DistanceTo(this, list.values[i]); if (tempDist < distance) { distance = tempDist; closest = list.values[i]; } } if (closest != null) { Debug.Log("Closest is at " + closest.posx + " , " + closest.posy); } return((closest != null) ? mapCreator.GetTile(closest.posx, closest.posy) : null); }
// ================================================================ // // '지금 있는 방' 설정. public void setCurrentRoom(RoomController room) { this.current_room = room; this.next_room = room; MapCreator.get().SetCurrentRoom(this.current_room); }
public override void initializeMap(GameRoot game_root) { MapCreator map_creator = MapCreator.get(); PartyControl party_control = PartyControl.get(); map_creator.setRoomNum(1, 1); map_creator.floor_root_go = new GameObject("Floor"); // 방 만들기. RoomController room = map_creator.createRoomFloor(new Map.RoomIndex(0, 0)); // 더미 방 만들기. map_creator.createVacancy(new Map.RoomIndex(0, -1)); // 방을 구분하는 벽을 만든다. map_creator.createRoomWall(); // 외벽을 만든다. map_creator.createOuterWalls(); GameRoot.get().createLocalPlayer(); GameRoot.get().createNetPlayers(); // 플레이어 위치 설정. chrBehaviorLocal local_player = PartyControl.get().getLocalPlayer(); Vector3 playerStartPosition = Vector3.zero; local_player.transform.position = playerStartPosition + PartyControl.get().getPositionOffset(local_player.control.global_index); for (int i = 0; i < PartyControl.get().getFriendCount(); i++) { chrBehaviorPlayer friend = PartyControl.get().getFriend(i); friend.control.cmdSetPositionAnon(playerStartPosition + PartyControl.get().getPositionOffset(friend.control.global_index)); } party_control.setCurrentRoom(room); // ボスの作成. chrControllerEnemyBase enemy; if (UsesHumanControlForBoss) { enemy = CharacterRoot.get().createEnemy("Boss1", "chrControllerEnemyBoss", "chrBehaviorEnemyBoss_Human") as chrControllerEnemyBase; } else { enemy = CharacterRoot.get().createEnemy("Boss1", "chrControllerEnemyBoss", "chrBehaviorEnemyBoss") as chrControllerEnemyBase; } enemy.cmdSetPosition(new Vector3(0.0f, 0.0f, 20.0f)); // 스테이터스 창. Navi.get().createStatusWindows(); }
public Pathfinder(GridNode start, GridNode target, PathfindMaster.PathfindingJobComplete callback) { startPosition = start; endPosition = target; completeCallback = callback; gridBase = MapCreator.GetInstance(); }
public void run (MapCreator mapCreator) { createGrid (mapCreator); createTiles (); }
public void MoveCreatureTest() { MapCreator creator = new MapCreator(); IMap map = creator.GenerateFlatMap(2, 2, new Dictionary <TileValues, int> { { TileValues.Forest, 1 } }); CreatureGenerator generator = new CreatureGenerator(); ICreature creature = generator.GenerateCreature(CreatureTypes.Human); ITile currentTile = map.Tiles[0]; ITile newTile = map.Tiles[1]; currentTile.CreatureList.Add(creature); MoveCreatureActionParameter parameter = new MoveCreatureActionParameter() { Creature = creature, CurrentCreatureTile = currentTile, NewCreatureTile = newTile, }; MoveCreatureAction action = new MoveCreatureAction(); IActionResult result = action.Execute(parameter); Assert.IsTrue(result.Success); Assert.AreEqual(0, currentTile.CreatureList.Count); Assert.AreEqual(1, newTile.CreatureList.Count); Assert.IsFalse(currentTile.CreatureList.Contains(creature)); Assert.IsTrue(newTile.CreatureList.Contains(creature)); }
public MainWindow() { InitializeComponent(); // Определяем вид разметки окна: область карты слева и меню справа Lay = LayoutsFactory.GetLayout(LayoutType.Vertical, this.Content); // Определяем параметры карты: количество клеток по горизонтали и вертикали, размер клетки, // ширина декоративной рамки вокруг карты MapInfo = new CellMapInfo(35, 20, 50, 0); // Создаем карту и размещаем его в окне программы Map = MapCreator.GetUniversalMap(this, MapInfo); Lay.Attach(Map, 0); //Map.DrawGrid(); // выводим сетку // Указываем путь к папке с картинками Map.Library.ImagesFolder = new PathInfo { Path = "..\\..\\..\\..\\i", Type = PathType.Relative }; // Создаем панель инвентаря и размещаем ее в меню addPictures(); Map.Keyboard.SetSingleKeyEventHandler(checkKey); Map.Library.AddContainer("player", "player", ContainerType.AutosizedSingleImage); Map.ContainerSetMaxSide("player", 100); Map.ContainerSetCoordinate("player", 960, 540); Platform.Map = Map; Platform platform = new Platform(); platform.SetCoordinate(960, 600); Platforms.Add(platform); timer.AddAction(gameCycle, 10); }
private static void Main() { const int MapWidth = 20; const int MapHeight = 20; Dictionary <TileValues, int> tileValuesAndOccuranceChance = new Dictionary <TileValues, int> { { TileValues.Fortress, 5 }, { TileValues.City, 20 }, { TileValues.Village, 100 }, { TileValues.Forest, 1000 }, { TileValues.Grassland, 2500 }, }; Dictionary <CreatureTypes, int> creatureTypeAndTotalAmountGenerated = new Dictionary <CreatureTypes, int>() { { CreatureTypes.Human, 100 }, { CreatureTypes.Goblin, 200 }, { CreatureTypes.Troll, 50 }, }; MapCreator creator = new MapCreator(); IMap map = creator.GenerateFlatMap(MapWidth, MapHeight, tileValuesAndOccuranceChance); MapDrawer.DrawMap(map); creator.GenerateMapElements(map); creator.AddCreaturesToMap(map, creatureTypeAndTotalAmountGenerated); MapDrawer.DrawMapTileShopsAndNpcs(map); Console.WriteLine("Hello World!"); }
public void FindAllHealTiles() { currentTile.current = true; for (int i = 0; i < ConstValues.MAP_SIZE_X; i++) { for (int j = 0; j < ConstValues.MAP_SIZE_Y; j++) { MapTile tempTile = mapCreator.GetTile(i, j); if (tempTile.currentCharacter == null) { continue; } int tempDist = MapCreator.DistanceTo(this, tempTile); if (!GetSupport().InRange(tempDist)) { continue; } bool usable = tempTile.currentCharacter.currentHealth != tempTile.currentCharacter.stats.hp; if (SameFaction(this, tempTile.currentCharacter) && (usable || GetSupport().supportType == SupportType.BUFF)) { tempTile.pathable = true; } } } }
public void JumpToNode(GameNode node) { if (!CheckNodeToJump(node) || isStop) { return; } SetCurrentNode(node); if (looseType == SelectedGameLooseType.Step) { MapCreator.Instance()._maxStep--; if (MapCreator.Instance()._maxStep <= 0) { Lose(); } } if (node.Type == GameNode.NodeType.Data) { Player.Instance().SetData(node.Data); print("Collect " + node.Data + " DATA "); UI.Instance().CreateTextFrame(node.Data.ToString(), Camera.main.WorldToScreenPoint(node.transform.position)); node.Data = 0; node.Type = GameNode.NodeType.Null; if (Player.Instance().GetData() >= Alldatacount) { Win(); } } }
private void SetSelectedTile(int x, int y) { MapCreator map = FindObjectOfType <MapCreator>(); map.selectedTile = new Vector2(x, y); map.selectedTileIndex = (y * 16) + x; }
protected override void OnInit() { this.action.Init(false); MapCreator mapCreatorCtrl = GameLogic.Release.MapCreatorCtrl; mapCreatorCtrl.Event_Button1101 = (Action)Delegate.Combine(mapCreatorCtrl.Event_Button1101, new Action(this.OnAttack)); }
private void OnSceneGUI() { if (m_IsPaintCell || m_IsAddingCheckpoints || m_IsRemovingCheckpoints) { switch (Event.current.type) { case EventType.MouseDown: { if (Event.current.button == 0) { Ray ray = HandleUtility.GUIPointToWorldRay(Event.current.mousePosition); RaycastHit hitInfo; if (Physics.Raycast(ray, out hitInfo)) { MapCellParam cellParam = hitInfo.collider.GetComponent <MapCellParam>(); if (cellParam != null) { if (m_IsPaintCell) { if (!cellParam.CellType.Equals(m_PaintCellType)) { MapCreator obj = (MapCreator)target; obj.UpdateMapCellValue(cellParam.X, cellParam.Y, (byte)m_PaintCellType, (byte)m_CellSurfaceType); m_IsEdited = true; } } if (m_IsAddingCheckpoints) { MapCreator obj = (MapCreator)target; if (!obj.HasCheckPointAt(cellParam.X, cellParam.Y)) { obj.AddCheckPoint(cellParam.X, cellParam.Y, (byte)m_CheckPointType); } } if (m_IsRemovingCheckpoints) { MapCreator obj = (MapCreator)target; obj.RemoveCheckPoint(cellParam.X, cellParam.Y); } } } } break; } case EventType.Layout: { int controlID = GUIUtility.GetControlID(GetHashCode(), FocusType.Passive); HandleUtility.AddDefaultControl(controlID); break; } } } }
void Start() { //加载场景的总数 allSceneCount = SceneManager.sceneCountInBuildSettings; //获得类型为 MapCreator 的已加载的激活对象 BoxMap = FindObjectOfType <MapCreator>(); }
void New() { try { CreateDbForm form = GetCreateDbForm(); if (form.ShowDialog() == DialogResult.OK) { if (form.IsDbProvider) { using (WaitCursor wr = new WaitCursor(this, Locale.Get("_createDb..."))) { ConnectionInfo gisConn = MapCreator.CreateGisDb(form.DbCreationProperties); app.CreateLib(gisConn); } } else { app.CreateLib(new ConnectionInfo(form.DbCreationProperties.dbName, form.FilePath)); } } } catch (Exception ex) { Log.Exception(ex); } }
public MainWindow() { InitializeComponent(); Lay = LayoutsFactory.GetLayout(LayoutType.Vertical, this.Content); MapInfo = new CellMapInfo(10, 10, 40, 5); map = MapCreator.GetUniversalMap(this, MapInfo); Lay.Attach(map, 0); Inventory = new InventoryPanel(map.Library, 50, 14); Lay.Attach(Inventory, 1); map.Library.ImagesFolder = new PathInfo { Path = "..\\..\\images", Type = PathType.Relative }; map.Library.AddPicture("wall", "wall.png"); map.Library.AddPicture("player", "evil.png"); map.Library.AddPicture("gem", "gem_green.png"); player.CreatePlayer(map); map.Library.AddContainer("gem", "gem"); map.ContainerSetSize("gem", 40); map.ContainerSetCoordinate("gem", 180, 200); timer.AddAction(KeyCheck, 50); }
public static void MapGizmoDrawer(MapCreator creator, GizmoType type) { if (!creator.Map) { return; } if (creator.Map.Data?.tiles == null) { return; } for (var x = 0; x < creator.Map.Data.tiles.Length; x++) { var dataTile = creator.Map.Data.tiles[x]; for (var y = 0; y < dataTile.Length; y++) { var tile = dataTile[y]; switch (tile) { case TileType.Wall: using (EditorDisposables.ColorChanger(Color.blue, EditorColourType.Gizmos)) Gizmos.DrawCube(new GridPosition(x, y), Vector3.one); break; case TileType.Floor: using (EditorDisposables.ColorChanger(Color.green, EditorColourType.Gizmos)) Gizmos.DrawCube(new GridPosition(x, y), Vector3.one); break; } } } }
public MainWindow() { #region Подготовка карты и панели меню InitializeComponent(); // Определяем вид разметки окна: область карты слева и меню справа Lay = LayoutsFactory.GetLayout(LayoutType.Vertical, this.Content); // Определяем параметры карты: количество клеток по горизонтали и вертикали, размер клетки, // ширина декоративной рамки вокруг карты MapInfo = new CellMapInfo(35, 20, 50, 0); // Создаем карту и размещаем его в окне программы Map = MapCreator.GetUniversalMap(this, MapInfo); Lay.Attach(Map, 0); //Map.DrawGrid(); // выводим сетку // Указываем путь к папке с картинками Map.Library.ImagesFolder = new PathInfo { Path = "..\\..\\..\\..\\i", Type = PathType.Relative }; // Создаем панель инвентаря и размещаем ее в меню hppanel = new InventoryPanel(Map.Library, 150); //hppanel2 = new InventoryPanel(Map.Library, 150); //Items1 = new InventoryPanel(Map.Library, 50); //Items2 = new InventoryPanel(Map.Library, 50); Lay.Attach(hppanel, 1); //Lay.Attach(Items1, 1); //Lay.Attach(hppanel2, 1); //Lay.Attach(Items2, 1); hppanel.SetBackground(Brushes.Wheat); // Создаем текстовую панель и размещаем ее в меню Info = new TextArea_Vertical(); Lay.Attach(Info, 1); Info.AddTextBlock("expEnemy"); Info.AddTextBlock("expMine"); // определяем функцию, которая будет вызвана при нажатии на клавишу //Map.Keyboard.SetSingleKeyEventHandler(CheckKey); #endregion player = new GameObject(); player.y = 50; player.speed = 3; player.reload = 100000; player.ammo = 40; player.hp = 10; player.InventoryPanel = hppanel; addPictures(); //player.Name = Map.SetMapBackground("map"); Name Start = new Name(); Start.player = player; Start.ShowDialog(); timer.AddAction(BCE, 10); timer.AddAction(mishen, 30000); timer.AddAction(spaunEnemy, 3000); timer.AddAction(sudba, 60000); hppanel.AddItem("hp", "hp10"); hppanel.AddItem("box", "box", player.ammo.ToString()); }
void Awake() { mapCreator = GameObject.Find("MapCreator").GetComponent<MapCreator>(); resourcesDataController = GameObject.Find("GameManager").GetComponent<ResourcesDataController>(); gameStates = GameObject.Find("GameManager").GetComponent<GameStates>(); LevelManagerRef = GameObject.Find("GameManager").GetComponent<LevelManager>(); }
public void MapHaveWrongSymbols() { var wrongMap = @" XXXX YYYY"; Assert.Throws <Exception>(() => MapCreator.CreateMap(wrongMap)); }
public void SetTile(float xpos, float ypos, MapCreator mapcreator, int terrainType, Material texture) { Xpos = xpos; Ypos = ypos; mapCreator = mapcreator; Terrain = (Market.TerrainTypes)terrainType; GetComponent <MeshRenderer>().material = texture; }
void GenerateMap() { MapCreator map = (MapCreator)target; map.GenerateMap(); EditorUtility.SetDirty(map); EditorSceneManager.MarkSceneDirty(map.gameObject.scene); }
private void GetParameters() { GameObject camera = GameObject.FindGameObjectWithTag("MainCamera"); MapCreator creator = camera.GetComponent <MapCreator>(); width = creator.width; length = creator.length; }
public void MapIsNotSquare() { var wrongMap = @" P T TWW"; Assert.Throws <Exception>(() => MapCreator.CreateMap(wrongMap)); }
private MapParams CreateMap( ) { MapCreator mapc = new MapCreator( ); map = mapc.CreateMap( ); return(mapc.mapParams); }
private void Awake() { mapCreator = FindObjectOfType <MapCreator>(); if (isInstance) { mapCreator.CreateMap(stageDate); } }
public void SetPosition(Vector2 pos) { _position = pos; var offset = 0.03f; this.transform.position = new Vector3(pos.x * (Tile.TILE_SIZE + offset), 0, -pos.y * (Tile.TILE_SIZE + offset)); this.transform.parent = MapCreator.GetRoot().transform; }
// ================================================================ // // 플로어(맵)가 만들어진 직후에 호출. public void onFloorCreated() { Map.RoomIndex room_count = MapCreator.get().getRoomNum(); foreach (var ri in Map.RoomIndex.getRange(room_count.x, room_count.z)) { this.rooms[ri.x, ri.z].places = MapCreator.get().allocateChipPlacesRoom(ri, Map.CHIP.ANY, 5); } }
public void BeforeTest() { prefabtHolder = GameObject.Instantiate((GameObject)Resources.Load("Prefabs/Holder/PrefabHolder"), Vector3.zero, Quaternion.identity).GetComponent <PrefabHolder> (); GameObject gameObject = new GameObject(); gameObject.AddComponent <MapCreator> (); mapCreator = gameObject.GetComponent <MapCreator> (); mapCreator.CreateMap(rawMap, prefabtHolder.Tile); }
// Creating the list of tilescripts. public void createGrid (MapCreator map) { numTilesX = map.ceilX - map.floorX + 1; numTilesY = map.ceilY - map.floorY + 1; for (int y = 0; y<numTilesY; y++) { int extraTile = 1; if (y % 2 != 0) { extraTile = 0; } for (int x = 0; x<numTilesX+extraTile; x++) { bool isUsed = false; foreach (TileScript mapTile in map.getPuzzle()) { if (mapTile.getCoordinates ().getX () == x && mapTile.getCoordinates ().getY () == y) { gameGrid.Add (mapTile); isUsed = true; } } foreach (Coordinate waterCoord in map.getWaterCoordinates()) { if (waterCoord.getX () == x && waterCoord.getY () == y) { TileScript waterTile = new TileScript (new Coordinate (x, y), "Water"); gameGrid.Add (waterTile); isUsed = true; } } if (!isUsed) { TileScript tile = new TileScript (new Coordinate (x, y), "Grass"); gameGrid.Add (tile); } } } }
public void TestPraerieMapCreation() { int waterSourcesCount = 6; int floraCount = 25; MapCreator mapCreator = new MapCreator(waterSourcesCount, floraCount); PraerieMapBuilder praerieMapBuilder = new PraerieMapBuilder(); mapCreator.Create(praerieMapBuilder); Map praerieMap = praerieMapBuilder.Map; string expectedGroundDescription = "grass"; string praerieMapGrounDescription = praerieMap.Ground.Description; Assert.AreEqual(expectedGroundDescription, praerieMapGrounDescription, "Praerie map ground description is not the expected="); int praerieMapWaterSourcesCount = praerieMap.WaterSources.Count; Assert.AreEqual(waterSourcesCount, praerieMapWaterSourcesCount, "Praerie map water sources count i not the expected"); int praerieMapFloraCount = praerieMap.FloraColection.Count; Assert.AreEqual(floraCount, praerieMapFloraCount, "Praerie map flora count is not the expected"); }
public void TestDesertMapCreation() { int waterSourcesCount = 5; int floraCount = 20; MapCreator mapCreator = new MapCreator(waterSourcesCount, floraCount); DesertMapBuilder desertMapBuilder = new DesertMapBuilder(); mapCreator.Create(desertMapBuilder); Map desertMap = desertMapBuilder.Map; string expectedGroundDescription = "sand"; string desertMapGrounDescription = desertMap.Ground.Description; Assert.AreEqual(expectedGroundDescription, desertMapGrounDescription, "Desert map ground description is not the expected="); int desertMapWaterSourcesCount = desertMap.WaterSources.Count; Assert.AreEqual(waterSourcesCount, desertMapWaterSourcesCount, "Desert map water sources count i not the expected"); int desertMapFloraCount = desertMap.FloraColection.Count; Assert.AreEqual(floraCount, desertMapFloraCount, "Desert map flora count is not the expected"); }
// Use this for initialization void Start () { difficulty = GameObject.Find ("Difficulty").GetComponent<DifficultyScript> ().getDifficulty (); GameObject.Find ("NormalButton").GetComponent<DifficultyButtonScript> ().setState (Enums.SelectorState.Blocked); GameObject.Find ("HardButton").GetComponent<DifficultyButtonScript> ().setState (Enums.SelectorState.Blocked); GameObject.Find ("ExpertButton").GetComponent<DifficultyButtonScript> ().setState (Enums.SelectorState.Blocked); GameObject.Find ("Back").GetComponent<BackScript> ().setState (Enums.SelectorState.Blocked); Vector3 scale = GameObject.Find ("Selector").GetComponent<Transform> ().localScale; scale.x = 0.5F; scale.y = 0.5F; GameObject.Find ("Selector").GetComponent<Transform> ().localScale = scale; switch (difficulty) { case 1: //ANDROID GameObject.Find ("Main Camera").GetComponent<Camera> ().orthographicSize = 4.7F; GameObject.Find ("Hand Camera").GetComponent<Camera> ().orthographicSize = 4.7F; GameObject.Find ("Selector").GetComponent<Transform> ().Translate (new Vector3 (0, 4f, 0), Space.World); GameObject.Find ("Quit").GetComponent<Transform> ().Translate (new Vector3 (0, 4f, 0), Space.World); GameObject.Find ("Back").GetComponent<Transform> ().Translate (new Vector3 (0, 4f, 0), Space.World); break; case 2: GameObject.Find ("Main Camera").GetComponent<Camera> ().orthographicSize = 5.4F; GameObject.Find ("Hand Camera").GetComponent<Camera> ().orthographicSize = 5.4F; GameObject.Find ("Selector").GetComponent<Transform> ().Translate (new Vector3 (0, 4f, 0), Space.World); GameObject.Find ("Quit").GetComponent<Transform> ().Translate (new Vector3 (0, 4f, 0), Space.World); GameObject.Find ("Back").GetComponent<Transform> ().Translate (new Vector3 (0, 4f, 0), Space.World); break; case 3: GameObject.Find ("Main Camera").GetComponent<Camera> ().orthographicSize = 5.4F; GameObject.Find ("Hand Camera").GetComponent<Camera> ().orthographicSize = 5.4F; GameObject.Find ("Selector").GetComponent<Transform> ().Translate (new Vector3 (0, 4.8F, 0), Space.World); GameObject.Find ("Quit").GetComponent<Transform> ().Translate (new Vector3 (0, 4.8f, 0), Space.World); GameObject.Find ("Back").GetComponent<Transform> ().Translate (new Vector3 (0, 4.8f, 0), Space.World); break; } // Generating the random map with a given difficulty. mapCreator = new MapCreator (difficulty); // Retrieving the BoardManager. boardManager = GetComponent<BoardManager> (); // Retrieving the hand. hand = GameObject.Find ("Hand").GetComponent<HandPrefabScript> (); // Drawing the tiles of the board on the screen. boardManager.run (mapCreator); // Drawing the tiles of the hand on the screen. hand.setHand (mapCreator.getHand (), difficulty); // Setting up the moves storing. moves = new System.Collections.Generic.List<TileScript> (); targetCoord = new System.Collections.Generic.List<Coordinate> (); targetEntr = new System.Collections.Generic.List<int> (); targetPos = new System.Collections.Generic.List<Vector3> (); // Starting the game. startGame (); }
void Init() { d_stage = new Delegate_stage(EnterStage1); d_stage += new Delegate_stage(EnterStage2); _instance = this; _data = new Data(); _mapcreator = new MapCreator(); _bclick = false; _istage_number = 0; Instantiate(_startGameObject); }
public MapCreator map_creator = null; // MapCreatorを保管するための変数. #endregion Fields #region Methods void Start() { // MapCreatorを取得して、メンバー変数map_creatorに保管. map_creator = GameObject.Find("GameRoot").GetComponent<MapCreator>(); }
public static MapCreator getInstance() { if(MapCreator.instance == null) { MapCreator.instance = GameObject.Find("GameRoot").GetComponent<MapCreator>(); } return(MapCreator.instance); }
// Use this for initialization void Start() { map_creator = GameObject.Find("GameRoot").GetComponent<MapCreator>(); }
// Use this for initialization public override void OnInspectorGUI() { if (Event.current != null && Event.current.isKey) { _shiftPressed = true;} _mapCreator = FindObjectOfType<MapCreator>(); EditorGUILayout.LabelField("Current map"); _editCurrentMap = EditorGUILayout.Toggle("Ceurrent Map", _editCurrentMap); // _createOrDestroyButtonText = _slotsCreator.CreateButtonText; EditorGUILayout.LabelField("RawsCount"); _mapCreator.RawCount = EditorGUILayout.IntField(_mapCreator.RawCount); EditorGUILayout.LabelField("ColumnsCount"); _mapCreator.ColumnCount = EditorGUILayout.IntField(_mapCreator.ColumnCount); EditorGUILayout.LabelField("Cell Width"); _mapCreator.CellXSize = EditorGUILayout.FloatField(_mapCreator.CellXSize); EditorGUILayout.LabelField("Cell Height"); _mapCreator.CellZSize = EditorGUILayout.FloatField(_mapCreator.CellZSize); EditorGUILayout.LabelField("CenterPos"); _mapCreator.CenterPos = EditorGUILayout.Vector3Field("Vector3", _mapCreator.CenterPos); if (GUILayout.Button("CreateMap")) { new Grid(_mapCreator.RawCount, _mapCreator.ColumnCount, _mapCreator.CellXSize, _mapCreator.CellZSize, _mapCreator.CenterPos); new Map(); _mapCreator.MapCreated = true; } if (_editCurrentMap)_mapCreator.MapCreated = true; if (_mapCreator.MapCreated) { EditorGUILayout.LabelField("Add lines"); if (GUILayout.Button("Select Build Zone")) { _currentPickMode = GridCell.EnumCellState.Buildable; _isPicking = true; } if (GUILayout.Button("Select Walkable Zone")) { _currentPickMode = GridCell.EnumCellState.Walkable; _isPicking = true; } if (GUILayout.Button("Select Blocked Zone")) { _currentPickMode = GridCell.EnumCellState.Blocked; _isPicking = true; } if (GUILayout.Button("Select Enemies Path")) { _currentPickMode = GridCell.EnumCellState.Path; _isPicking = true; } if (_isPicking) { if (GUILayout.Button("Stop select")) { _isPicking = false; } } // if (_slotsCreator.Lines != null && _slotsCreator.Lines.Any()) // { // foreach (var line in _slotsCreator.Lines) // { // if (line.Nodes.Count > 0) // EditorGUILayout.LabelField("Line" + // line.Nodes.Aggregate("", // (s, n) => s + "," + n.ToString().Replace(".0", ""))); // else EditorGUILayout.LabelField("Pick the line"); // line.LineColor = EditorGUILayout.ColorField("Color", line.LineColor); // if (!line.StartPicking) // { // if (line.Nodes.Count > 0) // { // if (GUILayout.Button("Destroy Line")) // { // line.DestroyGraphics(); // _lineForDestroy = line; // DestroyImmediate(_lineForDestroy.Start.transform.parent.gameObject); // } // } // if (GUILayout.Button("Pick")) // { // _isPicking = true; // _newline = true; // foreach (var slotsLine in _slotsCreator.Lines) // { // //if (_slotsCreator.CurrentLine.Nodes.Count > 0 && slotsLine.StartPicking == false) slotsLine.Nodes.Clear(); // slotsLine.StartPicking = false; // } // line.StartPicking = true; // if (line.Nodes.Count > 0) // { // line.Nodes.Clear(); // line.DestroyGraphics(); // var lineTr = line.Start.transform.parent; // line.Start.transform.SetParent(lineTr.parent.parent); // line.End.transform.SetParent(lineTr.parent.parent); // DestroyImmediate(lineTr.gameObject); // } // //if(_slotsCreator.CurrentLine.Nodes.Count>0) // //_slotsCreator.CurrentLine.Nodes.Clear(); // _slotsCreator.CurrentLine = line; // } // } // if (line.StartPicking) // { // if (GUILayout.Button("StopPick")) // { // _isPicking = false; // if (_slotsCreator.LineOtlined) _slotsCreator.Outline(line.GraphicsNodes); // line.Nodes = _slotsCreator.CurrentLine.Nodes; // var lineGO = // new GameObject("Line" + // line.Nodes.Aggregate("", // (s, m) => s + "," + m.ToString().Replace(".0", ""))); // lineGO.transform.SetParent(GameObject.Find("Lines").transform); // var outlineGO = new GameObject("Outline"); // var defaultLineGO = new GameObject("Line"); // defaultLineGO.transform.SetParent(lineGO.transform); // outlineGO.transform.SetParent(lineGO.transform); // defaultLineGO.transform.SetAsLastSibling(); // foreach (var image in line.LineGraphics) // { // if (image.name.Contains('.')) image.transform.SetParent(outlineGO.transform); // else image.transform.SetParent(defaultLineGO.transform); // } // line.Start.transform.SetParent(lineGO.transform); // line.End.transform.SetParent(lineGO.transform); // line.Start.GetComponent<Image>().color = line.LineColor; // line.End.GetComponent<Image>().color = line.LineColor; // _slotsCreator.SetStartAndEndPosition(line); // //_slotsCreator.CurrentLine.Nodes.Clear(); // foreach (var o in _slotsCreator.SymbolsList) // { // o.GetComponent<SlotsCell>().ResetColor(); // o.GetComponent<SlotsCell>().Selected = false; // o.GetComponent<SlotsCell>().Picked = false; // } // line.StartPicking = false; // line.LineID = _slotsCreator.Lines.Count; // //_slotsCreator.MainGameController.Lines = _slotsCreator.Lines; // var lineController = defaultLineGO.transform.parent.gameObject.AddComponent<LineController>(); // lineController.LineColor = line.LineColor; // lineController.Nodes = line.Nodes; // lineController.GraphicsNodes = line.GraphicsNodes; // lineController.StartPicking = line.StartPicking; // lineController.LineGraphics = line.LineGraphics; // lineController.Start = line.Start; // lineController.End = line.End; // lineController.LineID = line.LineID; // MyWindow.ShowWindow(); // } // } // } // _slotsCreator.Lines.Remove(_lineForDestroy); // _slotsCreator.BlinkColor = EditorGUILayout.ColorField("Blink color", _slotsCreator.BlinkColor); // EditorGUILayout.LabelField("Blinking speed"); // _slotsCreator.BlinkingSpeed = EditorGUILayout.FloatField(_slotsCreator.BlinkingSpeed); // //Debug.Log(Event.current.mousePosition); // } } }
// Use this for initialization void Start () { MyMap = GetManager.GetMapCreator (); }