Example #1
0
        public IActionResult Edit(BlockCategory model)
        {
            if (model == null)
            {
                return(NotFound());
            }
            var dataModel = _pagesContext.BlockCategories.FirstOrDefault(x => x.Id.Equals(model.Id));

            if (dataModel == null)
            {
                return(NotFound());
            }

            dataModel.Name        = model.Name;
            dataModel.Description = model.Description;
            dataModel.Author      = model.Author;
            dataModel.Changed     = DateTime.Now;
            try
            {
                _pagesContext.BlockCategories.Update(dataModel);
                _pagesContext.SaveChanges();
                return(RedirectToAction("Index"));
            }
            catch (Exception e)
            {
                ModelState.AddModelError(string.Empty, e.Message);
            }

            return(View(model));
        }
	public void SelectCategory(int i) {
		if (!isVisible) {
			ShowMenu();
			return;
		}

		switch (i) {
			case 0:
				category = BlockCategory.Block;
				break;
			case 1:
				category = BlockCategory.Floor;
				break;
			case 2:
				category = BlockCategory.Prop;
				break;
			case 3:
				category = BlockCategory.Hazard;
				break;
			case 4:
				category = BlockCategory.Collectable;
				break;
			case 5:
				category = BlockCategory.Flag;
				break;
		}

		BlockManager.UpdateCategory(category);
		HideMenu();
	}
Example #3
0
 public BlockModel(int blockId, BlockCategory blockCategory, Direction direction, Node origin, int progress)
 {
     this.blockId       = blockId;
     this.blockCategory = blockCategory;
     this.direction     = direction;
     this.origin        = origin;
     this.progress      = progress;
 }
Example #4
0
 public LoliCodeBlockDescriptor()
 {
     Id          = "loliCode";
     Name        = "LoliCode";
     Description = "This block can hold a LoliCode script";
     Category    = new BlockCategory
     {
         Description     = "Category for the LoliCode script block",
         BackgroundColor = "#303030",
         ForegroundColor = "#fff",
         Name            = "LoliCode"
     };
 }
 public ScriptBlockDescriptor()
 {
     Id          = "Script";
     Name        = "Script";
     Description = "This block can invoke a script in a different language, pass some variables and return some results.";
     Category    = new BlockCategory
     {
         Name            = "Interop",
         BackgroundColor = "#ddadaf",
         ForegroundColor = "#000",
         Path            = "RuriLib.Blocks.Interop",
         Namespace       = "RuriLib.Blocks.Interop.Methods",
         Description     = "Blocks for interoperability with other programs"
     };
 }
Example #6
0
        public IActionResult Create([Required] BlockCategory model)
        {
            try
            {
                _pagesContext.BlockCategories.Add(model);
                _pagesContext.SaveChanges();

                return(RedirectToAction("Index"));
            }
            catch (Exception e)
            {
                ModelState.AddModelError(string.Empty, e.Message);
            }

            return(View(model));
        }
        public ParseBlockDescriptor()
        {
            Id          = "Parse";
            Name        = Id;
            Description = "Parses text from a string";
            Category    = new BlockCategory
            {
                Name            = "Parsing",
                BackgroundColor = "#ffd700",
                ForegroundColor = "#000",
                Path            = "RuriLib.Blocks.Parsing",
                Namespace       = "RuriLib.Blocks.Parsing.Methods",
                Description     = "Blocks for extracting data from strings"
            };

            Parameters = new Dictionary <string, BlockParameter>
            {
                { "input", new StringParameter("input", "data.SOURCE", SettingInputMode.Variable) },
                { "prefix", new StringParameter("prefix") },
                { "suffix", new StringParameter("suffix") },
                { "urlEncodeOutput", new BoolParameter("urlEncodeOutput", false) },

                // LR
                { "leftDelim", new StringParameter("leftDelim") },
                { "rightDelim", new StringParameter("rightDelim") },
                { "caseSensitive", new BoolParameter("caseSensitive", true) },

                // CSS
                { "cssSelector", new StringParameter("cssSelector") },
                { "attributeName", new StringParameter("attributeName", "innerText") },

                // XPATH
                { "xPath", new StringParameter("xPath") },

                // JSON
                { "jToken", new StringParameter("jToken") },

                // REGEX
                { "pattern", new StringParameter("pattern") },
                { "outputFormat", new StringParameter("outputFormat") },
                { "multiLine", new BoolParameter("multiLine", false) }
            };
        }
Example #8
0
 public KeycheckBlockDescriptor()
 {
     Id          = "Keycheck";
     Name        = Id;
     Description = "Modifies the bot's status by checking conditions";
     Category    = new BlockCategory
     {
         Name            = "Conditions",
         BackgroundColor = "#1e90ff",
         ForegroundColor = "#000",
         Path            = "RuriLib.Blocks.Conditions",
         Namespace       = "RuriLib.Blocks.Conditions.Methods",
         Description     = "Blocks that have to do with checking conditions"
     };
     Parameters = new Dictionary <string, BlockParameter>
     {
         { "banIfNoMatch", new BoolParameter("banIfNoMatch", true) }
     };
 }
Example #9
0
        public bool IsBlockTypeOf(MyFunctionalBlock block, BlockCategory category)
        {
            switch (category)
            {
            case BlockCategory.Power:
                return(block.BlockDefinition.Id.TypeId == typeof(MyObjectBuilder_Reactor) ||
                       block.BlockDefinition.Id.TypeId == typeof(MyObjectBuilder_BatteryBlock) ||
                       block.BlockDefinition.Id.TypeId == typeof(MyObjectBuilder_SolarPanel));

            case BlockCategory.Production:
                return(block.BlockDefinition.Id.TypeId == typeof(MyObjectBuilder_Assembler) ||
                       block.BlockDefinition.Id.TypeId == typeof(MyObjectBuilder_Refinery) ||
                       block.BlockDefinition.Id.TypeId == typeof(MyObjectBuilder_OxygenGenerator));

            case BlockCategory.Weapons:
                return(block.BlockDefinition.Id.TypeId == typeof(MyObjectBuilder_InteriorTurret) ||
                       block.BlockDefinition.Id.TypeId == typeof(MyObjectBuilder_LargeGatlingTurret) ||
                       block.BlockDefinition.Id.TypeId == typeof(MyObjectBuilder_LargeMissileTurret));

            default:
                throw new InvalidBranchException();
            }
        }
	public static void UpdateCategory(BlockCategory category) {
		for (int i = 0; i < blockButtons.Count; i++) {
			if (blockCategories[i] == category) {
				blockButtons[i].SetActive(true);
			} else {
				blockButtons[i].SetActive(false);
			}
		}
	}
	void AddBlock(Block block, BlockCategory category) {
		blocks.Add(block);
		AddBlockButton(block, category);
		AddVRBlockButton(block, category);
	}
	void AddVRBlockButton(Block block, BlockCategory category) {
		//Ignore air
		if (block.GetName() != "Air") {
			//Instatiate object
			GameObject button = Instantiate(vrBlockButton) as GameObject;
			button.transform.SetParent(vrBlockLibrary);
			button.transform.localScale = Vector3.one;//new Vector3(1f / 100f, 1f / 100f, 1f / 100f);
			button.name = block.GetDisplayName() + " Button";

			//Set button onClick
			VRBlockButton b = button.GetComponent<VRBlockButton>();
			b.block = block;

			//Set icon
			Image icon = button.transform.GetChild(0).GetComponent<Image>();
			Texture2D texture = Resources.Load("Block Icons/" + block.GetName()) as Texture2D;
			if (texture == null) {
				texture = Resources.Load("Block Icons/Error") as Texture2D;
			}
			icon.overrideSprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f));

			//Add to list
			blockCategories.Add(category);
			blockButtons.Add(button);
		}
	}
Example #13
0
 public BlockType(BlockCategory category, string extModule, string name)
 {
     this.category  = category;
     this.extModule = extModule;
     this.name      = name;
 }
Example #14
0
 public BlockType(BlockCategory category, string name)
 {
     this.category = category;
     this.name     = name;
 }
Example #15
0
 public IEnumerable <Block> QueryByCategory(BlockCategory category)
 {
     return(blocks.Where(block => block.GetMemberCategory().Is(category)));
 }
Example #16
0
 public static void AddCategories()
 {
     // Set default categories.
     Default = new BlockCategory("Default");
 }
	/// <summary>
	/// Adds the block buttons to the block library
	/// </summary>
	void AddBlockButton(Block block, BlockCategory category) {
		//Ignore air
		if (block.GetName() != "Air") {
			//Instatiate object
			GameObject button = Instantiate(blockButton) as GameObject;
			button.transform.SetParent(blockLibrary);
			button.name = block.GetDisplayName() + " Button";

			//Set button onClick
			Button b = button.GetComponent<Button>();
			string n = block.GetName();
			b.onClick.AddListener(() => DesignManager.instance.SetToolBlock(n));

			//Set icon
			Image icon = button.transform.GetChild(0).GetComponent<Image>();
			Texture2D texture = Resources.Load("Block Icons/" + block.GetName()) as Texture2D;
			if (texture == null) {
				texture = Resources.Load("Block Icons/Error") as Texture2D;
			}
			icon.overrideSprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f));

			//Add to list
			blockCategories.Add(category);
			blockButtons.Add(button);
		}
	}
 public HttpRequestBlockDescriptor()
 {
     Id          = "HttpRequest";
     Name        = "Http Request";
     Description = "Performs an Http request and reads the response";
     Category    = new BlockCategory
     {
         Name            = "Http",
         BackgroundColor = "#32cd32",
         ForegroundColor = "#000",
         Path            = "RuriLib.Blocks.Requests.Http",
         Namespace       = "RuriLib.Blocks.Requests.Http.Methods",
         Description     = "Blocks for performing Http requests"
     };
     Parameters = new Dictionary <string, BlockParameter>
     {
         { "url", new StringParameter("url", "https://google.com") },
         { "method", new EnumParameter("method", typeof(HttpMethod), HttpMethod.GET.ToString()) },
         { "autoRedirect", new BoolParameter("autoRedirect", true) },
         { "maxNumberOfRedirects", new IntParameter("maxNumberOfRedirects", 8) },
         { "urlEncodeContent", new BoolParameter("urlEncodeContent", false) },
         { "absoluteUriInFirstLine", new BoolParameter("absoluteUriInFirstLine", false) },
         { "securityProtocol", new EnumParameter("securityProtocol", typeof(SecurityProtocol), SecurityProtocol.SystemDefault.ToString()) },
         { "useCustomCipherSuites", new BoolParameter("useCustomCipherSuites", false) },
         { "alwaysSendContent", new BoolParameter("alwaysSendContent", false) },
         { "codePagesEncoding", new StringParameter("codePagesEncoding", string.Empty) },
         { "customCipherSuites", new ListOfStringsParameter("customCipherSuites",
                                                            new List <string>
             {
                 "TLS_AES_128_GCM_SHA256",
                 "TLS_CHACHA20_POLY1305_SHA256",
                 "TLS_AES_256_GCM_SHA384",
                 "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
                 "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
                 "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256",
                 "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256",
                 "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
                 "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
                 "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA",
                 "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA",
                 "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA",
                 "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA",
                 "TLS_RSA_WITH_AES_128_GCM_SHA256",
                 "TLS_RSA_WITH_AES_256_GCM_SHA384",
                 "TLS_RSA_WITH_AES_128_CBC_SHA",
                 "TLS_RSA_WITH_AES_256_CBC_SHA",
                 "TLS_RSA_WITH_3DES_EDE_CBC_SHA"
             },
                                                            SettingInputMode.Fixed) },
         { "customCookies", new DictionaryOfStringsParameter("customCookies", null, SettingInputMode.Interpolated) },
         { "customHeaders", new DictionaryOfStringsParameter("customHeaders",
                                                             new Dictionary <string, string>
             {
                 { "User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36" },
                 { "Pragma", "no-cache" },
                 { "Accept", "*/*" },
                 { "Accept-Language", "en-US,en;q=0.8" }
             },
                                                             SettingInputMode.Interpolated) },
         { "timeoutMilliseconds", new IntParameter("timeoutMilliseconds", 15000) },
         { "httpVersion", new StringParameter("httpVersion", "1.1") }
     };
 }
Example #19
0
        public void InitSectionComponent(SectionModel sectionData, SectionModel nextSectionData, SectionComponent lastSectionComponent, bool isLastSection = false)
        {
            // Debug.Log("SectionComponent.InitSectionComponent(" + sectionData.sectionId.ToString() + ")");
            isCollapsing = false;
            blockComponents.Clear();
            this.sectionData = sectionData;
            SetSectionPosition(this.sectionData.origin);

            // Debug.Log("pm.pathManager.sectionList.Count: " + pm.pathManager.sectionList.Count.ToString());
            // if (lastSectionComponent != null) { Debug.Log("lastSectionComponent: " + lastSectionComponent); }
            // else { Debug.Log("lastSectionComponent is null"); }

            int baseProgress = lastSectionComponent != null ? lastSectionComponent.maxProgress : 0;

            minProgress = baseProgress;
            int _maxProgress = -1;

            // Debug.Log("sectionData.height: " + sectionData.height.ToString());
            // Debug.Log("sectionData.width: " + sectionData.width.ToString());
            for (int i = 0; i < this.sectionData.height; i++)
            {
                for (int j = 0; j < this.sectionData.width; j++)
                {
                    TerrainGid terrainGid = TerrainGid.empty;
                    if (sectionData.terrains != null)
                    {
                        terrainGid = (TerrainGid)sectionData.terrains[i, j];
                    }
                    else
                    {
                        //terrain정보가 들어오지 않는 경우는 코너섹션일 때
                        terrainGid = TerrainGid.basic_dirt;
                    }
                    if (terrainGid == TerrainGid.empty)
                    {
                        continue;
                    }

                    GameObject blockPrefab     = PrefabManager.Instance.GetBlockPrefab(terrainGid);
                    GameObject blockGameObject = Instantiate(blockPrefab) as GameObject;
                    // GameObject blockGameObject = ObjectPool.Spawn(blockPrefab);

                    blockGameObject.name = "block#" + pm.pathManager.lastBlockComponentId.ToString();
                    blockGameObject.transform.SetParent(blockContainer);
                    BlockComponent blockComponent = blockGameObject.GetComponent <BlockComponent>();
                    BlockCategory  blockCategory  = this.sectionData.sectionType == SectionType.corner ? BlockCategory.corner : BlockCategory.straight;
                    if (this.sectionData.sectionType == SectionType.corner)
                    {
                        SectionComponent _beforeSectionComponent = pm.pathManager.GetSectionComponent(this.sectionData.sectionId - 1);
                        // SectionComponent _beforeBeforeSectionComponent = pm.pathManager.GetSectionComponent(this.sectionData.sectionId - 2);
                        if (_beforeSectionComponent == null) //first corner section
                        {
                            blockCategory = BlockCategory.corner;
                        }
                        else if (this.sectionData.direction == Direction.up || (this.sectionData.direction == Direction.right && (_beforeSectionComponent.sectionData.direction == Direction.up)))
                        {
                            if (i + j >= 2 && !(i == 2 && j == 2))
                            {
                                blockCategory = BlockCategory.turn;
                            }
                            else
                            {
                                blockCategory = BlockCategory.corner;
                            }
                        }
                        else if (this.sectionData.direction == Direction.down || (this.sectionData.direction == Direction.right && (_beforeSectionComponent.sectionData.direction == Direction.down)))
                        {
                            if (j >= i && !(i == 0 && j == 2))
                            {
                                blockCategory = BlockCategory.turn;
                            }
                            else
                            {
                                blockCategory = BlockCategory.corner;
                            }
                        }

                        if (isLastSection)
                        {
                            blockCategory = BlockCategory.straight;
                        }
                    }
                    else if (this.sectionData.sectionType == SectionType.straight)
                    {
                        if (this.sectionData.direction == Direction.up)
                        {
                            if (j == this.sectionData.width - 1 && i == this.sectionData.height - 1)
                            {
                                blockCategory = BlockCategory.shortcut_start;
                            }
                            else if (j == 0 && i == 0)
                            {
                                blockCategory = BlockCategory.shortcut_end;
                            }
                            else
                            {
                                blockCategory = BlockCategory.straight;
                            }
                        }
                        else if (this.sectionData.direction == Direction.down)
                        {
                            if (j == this.sectionData.width - 1 && i == 0)
                            {
                                blockCategory = BlockCategory.shortcut_start;
                            }
                            else if (j == 0 && i == this.sectionData.height - 1)
                            {
                                blockCategory = BlockCategory.shortcut_end;
                            }
                            else
                            {
                                blockCategory = BlockCategory.straight;
                            }
                        }
                        else if (this.sectionData.direction == Direction.right)
                        {
                            SectionComponent _beforeSectionComponent       = pm.pathManager.GetSectionComponent(this.sectionData.sectionId - 1);
                            SectionComponent _beforeBeforeSectionComponent = pm.pathManager.GetSectionComponent(this.sectionData.sectionId - 2);
                            if ((nextSectionData.direction == Direction.up) && (j == this.sectionData.width - 1 && i == this.sectionData.height - 1))
                            {
                                blockCategory = BlockCategory.shortcut_start;
                            }
                            else if ((nextSectionData.direction == Direction.down) && (j == this.sectionData.width - 1 && i == 0))
                            {
                                blockCategory = BlockCategory.shortcut_start;
                            }
                            else if (_beforeBeforeSectionComponent != null)
                            {
                                if (_beforeBeforeSectionComponent.sectionData.direction == Direction.up && (j == 0 && i == 0))
                                {
                                    blockCategory = BlockCategory.shortcut_end;
                                }
                                else if (_beforeBeforeSectionComponent.sectionData.direction == Direction.down && (j == 0 && i == this.sectionData.height - 1))
                                {
                                    blockCategory = BlockCategory.shortcut_end;
                                }
                                else
                                {
                                    blockCategory = BlockCategory.straight;
                                }
                            }
                            else
                            {
                                blockCategory = BlockCategory.straight;
                            }
                        }
                        //다음 코너에서 방향이 어떨게 되냐에따라 현재 스트레이트 섹션의 숏컷이 결정된다

                        /*
                         *
                         * if ((this.sectionData.direction == Direction.right && nextSectionData.direction == Direction.up) ||
                         * (this.sectionData.direction == Direction.up && nextSectionData.direction == Direction.right))
                         * {
                         *  if (j == this.sectionData.width - 1 && i == this.sectionData.height - 1)
                         *  {
                         *      blockCategory = BlockCategory.shortcut_start;
                         *  }
                         *  else if (this.sectionData.direction == Direction.right && j == this.sectionData.width - 1)
                         *  {
                         *      blockCategory = BlockCategory.straight_edge;
                         *  }
                         *  else if (this.sectionData.direction == Direction.up && i == this.sectionData.height - 1)
                         *  {
                         *      blockCategory = BlockCategory.straight_edge;
                         *  }
                         *  else if (j == 0 && i == 0)
                         *  {
                         *      Debug.Log("???");
                         *      blockCategory = BlockCategory.shortcut_end;
                         *  }
                         *  else
                         *  {
                         *      blockCategory = BlockCategory.straight;
                         *  }
                         * }
                         * else
                         * {
                         *  if (j == this.sectionData.width - 1 && i == 0)
                         *  {
                         *      blockCategory = BlockCategory.shortcut_start;
                         *  }
                         *  else if (this.sectionData.direction == Direction.right && j == this.sectionData.width - 1)
                         *  {
                         *      blockCategory = BlockCategory.straight_edge;
                         *  }
                         *  else if (this.sectionData.direction == Direction.down && i == 0)
                         *  {
                         *      blockCategory = BlockCategory.straight_edge;
                         *  }
                         *  else if (j == 0 && i == this.sectionData.height - 1)
                         *  {
                         *      Debug.Log("!!!");
                         *      blockCategory = BlockCategory.shortcut_end;
                         *  }
                         *  else
                         *  {
                         *      blockCategory = BlockCategory.straight;
                         *  }
                         * }
                         */
                    }
                    int progress = 0;

                    if (sectionData.sectionType == SectionType.straight)
                    {
                        if (sectionData.direction == Direction.right)
                        {
                            progress = baseProgress + j + 1;
                        }
                        else if (sectionData.direction == Direction.up)
                        {
                            progress = baseProgress + i + 1;
                        }
                        else if (sectionData.direction == Direction.down)
                        {
                            progress = baseProgress + (this.sectionData.height - i);
                        }
                    }
                    else if (sectionData.sectionType == SectionType.corner)
                    {
                        progress = baseProgress + 1;
                    }

                    if (progress > _maxProgress)
                    {
                        _maxProgress = progress;
                    }

                    BlockModel blockData = new BlockModel(
                        pm.pathManager.lastBlockComponentId++,
                        blockCategory,
                        this.sectionData.direction,
                        this.sectionData.origin + new Node(j, i),
                        progress);

                    blockComponent.InitBlockComponent(this, blockData);
                    blockComponents.Add(blockComponent);
                    pm.pathManager.PutBlockComponent(blockComponent);
                }
            }

            if (sectionData.objects != null)
            {
                // Debug.Log("---------");
                // Debug.Log(sectionData.objects.Count);
                // Debug.Log("sectionData.direction: " + sectionData.direction);
                // Debug.Log("sectionData.width: " + sectionData.width.ToString());
                // Debug.Log("sectionData.height: " + sectionData.height.ToString());
                foreach (KeyValuePair <Node, TiledObject> kv in sectionData.objects)
                {
                    Node node = kv.Key;
                    // Debug.Log("node: " + node.ToString());
                    TiledObject tiledObject = kv.Value;
                    int         objectGid   = tiledObject.gid;

                    BlockComponent blockComponent = pm.pathManager.GetBlockComponentByOrigin(this.sectionData.origin + node);
                    if (blockComponent == null)
                    {
                        Debug.Log("blockComponent is null");
                        continue;
                    }

                    if (17 <= objectGid && objectGid < 33) //item
                    {
                        Node       itemOrigin = this.sectionData.origin + node;
                        GameObject itemPrefab = PrefabManager.Instance.GetItemPrefab((ItemGid)objectGid);
                        // GameObject itemInstance = Instantiate(itemPrefab) as GameObject;
                        GameObject itemInstance = ObjectPool.Spawn(itemPrefab);
                        itemInstance.transform.SetParent(blockComponent.objectContainer);
                        ItemComponent itemComponent = itemInstance.GetComponent <ItemComponent>();
                        itemComponent.InitItemComponent(this, itemOrigin, blockComponent.blockData.direction);
                        itemComponents.Add(itemComponent);
                        pm.pathManager.PutItemComponent(itemComponent);
                        if (itemComponent.itemType == ItemType.food)
                        {
                            FoodItemComponent foodItemComponent = itemComponent.GetComponent <FoodItemComponent>();
                            foodItemComponent.InitFoodRender();
                        }
                    }
                    else if (33 <= objectGid && objectGid < 49) //trap
                    {
                        Node       trapOrigin = this.sectionData.origin + node;
                        GameObject trapPrefab = PrefabManager.Instance.GetTrapPrefab((TrapGid)objectGid);
                        // GameObject trapInstance = Instantiate(trapPrefab) as GameObject;
                        GameObject trapInstance = ObjectPool.Spawn(trapPrefab);
                        trapInstance.transform.SetParent(blockComponent.objectContainer);
                        TrapComponent trapComponent = trapInstance.GetComponent <TrapComponent>();
                        trapComponent.name = trapComponent.GetInstanceID().ToString();
                        Direction trapDirection = blockComponent.blockData.direction;
                        if (tiledObject.properties != null)
                        {
                            //TODO TileProperty의 direction을 그대로 사용하는것이 아니라
                            //섹션의 방향에 따라 수정된 direction을 사용해야 한다
                            if (sectionData.direction == Direction.right)
                            {
                                trapDirection = tiledObject.properties.direction;
                            }
                            else if (sectionData.direction == Direction.up)
                            {
                                if (tiledObject.properties.direction == Direction.up)
                                {
                                    trapDirection = Direction.left;
                                }
                                else if (tiledObject.properties.direction == Direction.right)
                                {
                                    trapDirection = Direction.up;
                                }
                                else if (tiledObject.properties.direction == Direction.down)
                                {
                                    trapDirection = Direction.right;
                                }
                                else if (tiledObject.properties.direction == Direction.left)
                                {
                                    trapDirection = Direction.down;
                                }
                            }
                            else if (sectionData.direction == Direction.down)
                            {
                                if (tiledObject.properties.direction == Direction.up)
                                {
                                    trapDirection = Direction.right;
                                }
                                else if (tiledObject.properties.direction == Direction.right)
                                {
                                    trapDirection = Direction.down;
                                }
                                else if (tiledObject.properties.direction == Direction.down)
                                {
                                    trapDirection = Direction.left;
                                }
                                else if (tiledObject.properties.direction == Direction.left)
                                {
                                    trapDirection = Direction.up;
                                }
                            }
                        }
                        trapComponent.InitTrapComponent(this, trapOrigin, trapDirection, tiledObject);
                        trapComponents.Add(trapComponent);
                        pm.pathManager.PutTrapComponent(trapComponent);
                    }
                    else if (49 <= objectGid && objectGid < 65) //enemy
                    {
                        Node       itemOrigin  = this.sectionData.origin + node;
                        GameObject enemyPrefab = PrefabManager.Instance.GetEnemyPrefab((EnemyGid)objectGid);
                        // GameObject enemyInstance = Instantiate(enemyPrefab) as GameObject;
                        GameObject enemyInstance = ObjectPool.Spawn(enemyPrefab);
                        enemyInstance.transform.SetParent(blockComponent.objectContainer);
                        EnemyComponent enemyComponent = enemyInstance.GetComponent <EnemyComponent>();
                        enemyComponent.InitEnemyComponent(itemOrigin, blockComponent.blockData.direction);
                        enemyComponents.Add(enemyComponent);
                        pm.pathManager.PutEnemyComponent(enemyComponent);
                    }
                }
            }

            this.maxProgress = _maxProgress;
        }