void PlaceMapObject(MapIndex t_mapIndex) { if (m_mapEditor.CheckCanPlaceMapObject(t_mapIndex, m_selectedObject)) { m_mapEditor.InstantiateMapObject(t_mapIndex, m_selectedObject); } }
public IEnumerator PlacePrefab() { string name = "TestObject"; MapIndex indexPos = new MapIndex(2, 1); Assert.True(m_mapEditor.CheckCanPlaceMapObject(indexPos, m_mapEditor.m_mapObjects[name]) == true); m_mapEditor.InstantiateMapObject(indexPos, m_mapEditor.m_mapObjects[name]); Assert.True(m_map.GetTile(indexPos).GetEntityList().Count == 1); Assert.True(m_map.GetTile(new MapIndex(3, 1)).GetEntityList().Count == 1); yield return(new WaitForSeconds(0.1f)); Assert.True(m_mapEditor.CheckCanPlaceMapObject(new MapIndex(-1, 0), m_mapEditor.m_mapObjects[name]) == false); yield return(new WaitForSeconds(0.1f)); Assert.True(m_mapEditor.CheckCanPlaceMapObject(indexPos, m_mapEditor.m_mapObjects[name]) == false); }