Ejemplo n.º 1
0
    public static string GetMapName(Vector3 pos)
    {
        MapIndex mapIndex = Pos2MapIndex(pos);

        return(GetMapNameByMapIndex(mapIndex));
        //return ChunkRootNamePrefix + string.Format("{0}_{1}", GetMapX(pos.x), GetMapZ(pos.z));
    }
Ejemplo n.º 2
0
    public IEnumerator SaveAndLoad()
    {
        Assert.True(m_mapEditor.SaveLevel("TestLevel") == true);

        yield return(new WaitForSeconds(10.0f));

        int width = 20;
        int hight = 21;

        m_mapEditor.CreateMap(width, hight);

        Assert.AreEqual(width, m_map.GetWidth());
        Assert.AreEqual(hight, m_map.GetHight());
        Assert.AreEqual(width * hight, m_map.GetTileCount());

        yield return(new WaitForSeconds(3.0f));

        Assert.True(m_mapEditor.LoadLevel("TestLevel", false) == true);

        Assert.AreEqual(17, m_map.GetWidth());
        Assert.AreEqual(11, m_map.GetHight());
        Assert.AreEqual(11 * 17, m_map.GetTileCount());

        MapIndex indexPos = new MapIndex(2, 1);

        Assert.True(m_map.GetTile(indexPos).GetEntityList().Count == 1);
        Assert.True(m_map.GetTile(new MapIndex(3, 1)).GetEntityList().Count == 1);

        string path = "MapGridComponent/Sprites/Wall";

        Assert.True(m_map.GetTile(indexPos).GetSprite() == m_mapEditor.m_tileSprites[path]);

        yield return(new WaitForSeconds(0.1f));
    }
Ejemplo n.º 3
0
 void PlaceMapObject(MapIndex t_mapIndex)
 {
     if (m_mapEditor.CheckCanPlaceMapObject(t_mapIndex, m_selectedObject))
     {
         m_mapEditor.InstantiateMapObject(t_mapIndex, m_selectedObject);
     }
 }
Ejemplo n.º 4
0
    void Update()
    {
        CheckSizeLimit(m_widthField);
        CheckSizeLimit(m_heightField);

        if (Input.GetMouseButtonDown(0))
        {
            if (m_mapEditor.m_map.m_isCreated)
            {
                Vector3 mousePos = Input.mousePosition;
                mousePos.z = 1;
                Vector2 worldPosition = Camera.main.ScreenToWorldPoint(mousePos);

                MapIndex mapIndex = m_mapEditor.m_map.WorldPositionToMapIndex(worldPosition);

                if (m_selectedSprite != null)
                {
                    m_mapEditor.ChangeTileSprite(mapIndex, m_selectedSprite);
                }

                else if (m_selectedObject != null)
                {
                    PlaceMapObject(mapIndex);
                }

                else if (m_removeObjectFromMap)
                {
                    m_mapEditor.RemoveMapObject(mapIndex);
                }
            }
        }
    }
Ejemplo n.º 5
0
    /// <summary>
    /// Removes the passed in gameobject from the tile at the passed in map indes postion
    /// if the gameobject is found in the list of gamobjects within that tile. If the gameobject
    /// was the last remaining gameobject in the list of type object the tile becomes traversable.
    /// </summary>
    /// <param name="t_tileIndex">The map index position of the tile from which the gameobject will be removed from</param>
    /// <param name="t_entity">The gameobject that will be removed from the tile</param>
    /// <returns></returns>
    public bool RemoveEntity(MapIndex t_tileIndex, GameObject t_entity)
    {
        bool success = false;

        success = m_grid[t_tileIndex.m_x][t_tileIndex.m_y].DeleteEntity(t_entity);

        if (success)
        {
            RemoveEntityFromList(t_entity);

            bool containsObject = false;

            List <GameObject> entityList = m_grid[t_tileIndex.m_x][t_tileIndex.m_y].GetEntityList();

            foreach (GameObject entity in entityList)
            {
                if (m_objectsTag.Contains(t_entity.tag))
                {
                    containsObject = true;
                }
            }

            //The tile no longer contains an entity of type object meaning a character can enter this tile.
            if (!containsObject)
            {
                m_grid[t_tileIndex.m_x][t_tileIndex.m_y].SetIsTraversable(true);
            }
        }

        return(success);
    }
Ejemplo n.º 6
0
    /// <summary>
    /// Adds the passed in gameobject to the tile in the passed in map
    /// index posittion. This can not be done if the tile contains a gameobject that
    /// maeks the tilenot traversable. If the gameobject is added succesful to the tile
    /// and it has a tag of object it makes the tile not traversable.
    /// </summary>
    /// <param name="t_tileIndex">The map index position of the tile to which the gameobject will be added</param>
    /// <param name="t_entity">The gameobject that will be added to the tile</param>
    /// <returns>A bool for if the gameobject has been added to the tile</returns>
    public bool AddEntity(MapIndex t_tileIndex, GameObject t_entity)
    {
        bool success = false;

        List <GameObject> entityList = m_grid[t_tileIndex.m_x][t_tileIndex.m_y].GetEntityList();

        foreach (GameObject entity in entityList)
        {
            if (m_objectsTag.Contains(entity.tag))
            {
                return(success);
            }
        }

        success = m_grid[t_tileIndex.m_x][t_tileIndex.m_y].AddEntity(t_entity);

        if (success)
        {
            AddEntityToList(t_entity);

            if (m_objectsTag.Contains(t_entity.tag))
            {
                //The tile now contains an entity of type object meaning a character can no longer enter this tile.
                m_grid[t_tileIndex.m_x][t_tileIndex.m_y].SetIsTraversable(false);
            }
        }

        return(success);
    }
Ejemplo n.º 7
0
        public void First_index_corruption_should_not_error_it_immediately()
        {
            UseNewLocalServer();

            using (var db = CreateDocumentDatabase())
            {
                using (var index = MapIndex.CreateNew(new IndexDefinition()
                {
                    Name = "Users_ByName",
                    Maps =
                    {
                        "from user in docs.Users select new { user.Name }"
                    },
                    Type = IndexType.Map
                }, db))
                {
                    PutUser(db);

                    index._indexStorage.SimulateCorruption = true;

                    index.Start();

                    // should unload db but not error the index
                    Assert.True(SpinWait.SpinUntil(() => db.ServerStore.DatabasesLandlord.DatabasesCache.Any() == false, TimeSpan.FromMinutes(1)));
                    Assert.Equal(IndexState.Normal, index.State);
                }
            }
        }
Ejemplo n.º 8
0
    public void Init(GameObject player)
    {
        _playerPosition = player.transform;
        PlayerController pc = player.GetComponent <PlayerController>();

        Index = new MapIndex(pc.Index.x, pc.Index.y);
    }
Ejemplo n.º 9
0
        public void Three_consecutive_write_errors_should_error_index()
        {
            UseNewLocalServer();

            using (var db = CreateDocumentDatabase())
            {
                using (var index = MapIndex.CreateNew(new IndexDefinition()
                {
                    Name = "Users_ByName",
                    Maps =
                    {
                        "from user in docs.Users select new { user.Name }"
                    },
                    Type = IndexType.Map
                }, db))
                {
                    PutUser(db);

                    index._indexStorage.SimulateIndexWriteException = new FormatException();

                    index.Start();

                    Assert.True(SpinWait.SpinUntil(() => index.State == IndexState.Error, TimeSpan.FromMinutes(1)));
                }
            }
        }
Ejemplo n.º 10
0
 public static bool CompareMapIndex(MapIndex mi1, MapIndex mi2)
 {
     if (mi1.x == mi2.x && mi1.z == mi2.z)
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 11
0
    private void DisablePastRoomQuestion(PathType pathType)
    {
        // 전 방 인덱스
        MapIndex pastRoomIndex = new MapIndex(PlayerIndex.x, PlayerIndex.y);

        switch (pathType)
        {
        case PathType.LEFT: pastRoomIndex.y++; break;

        case PathType.TOP: pastRoomIndex.x++; break;

        case PathType.RIGHT: pastRoomIndex.y--; break;

        case PathType.BOTTOM: pastRoomIndex.x--; break;

        default:
            break;
        }
        // 상하좌우 방 : 상->B 하->T 좌->R 우->L 지우기
        int x; int y;

        // 상
        x = pastRoomIndex.x - 1; y = pastRoomIndex.y;
        if (x >= 0)
        {
            Transform path = DungeonMap[x, y].Find("Path/B");
            path.GetChild(0).gameObject.SetActive(false); // 물음표
            path.GetComponent <MeshRenderer>().material.color = Color.red;
            path.GetComponent <DoorPath>().IsOpen             = true;
        }
        // 하
        x = pastRoomIndex.x + 1; y = pastRoomIndex.y;
        if (x < DungeonMap.GetLength(0))
        {
            Transform path = DungeonMap[x, y].Find("Path/T");
            path.GetChild(0).gameObject.SetActive(false);
            path.GetComponent <MeshRenderer>().material.color = Color.red;
            path.GetComponent <DoorPath>().IsOpen             = true;
        }
        // 좌
        x = pastRoomIndex.x; y = pastRoomIndex.y - 1;
        if (y >= 0)
        {
            Transform path = DungeonMap[x, y].Find("Path/R");
            path.GetChild(0).gameObject.SetActive(false);
            path.GetComponent <MeshRenderer>().material.color = Color.red;
            path.GetComponent <DoorPath>().IsOpen             = true;
        }
        // 우
        x = pastRoomIndex.x; y = pastRoomIndex.y + 1;
        if (y < DungeonMap.GetLength(1))
        {
            Transform path = DungeonMap[x, y].Find("Path/L");
            path.GetChild(0).gameObject.SetActive(false);
            path.GetComponent <MeshRenderer>().material.color = Color.red;
            path.GetComponent <DoorPath>().IsOpen             = true;
        }
    }
Ejemplo n.º 12
0
    /// <summary>
    /// Changes the sprite of the Tile at the passed in map index posiiton.
    /// </summary>
    /// <param name="t_mapIndex">The map index position of the Tile to change</param>
    /// <param name="t_sprite">The new sprite to which the Tile will be set to</param>
    public void ChangeTileSprite(MapIndex t_mapIndex, Sprite t_sprite)
    {
        Tile tile = m_map.GetTile(t_mapIndex);

        if (tile != null)
        {
            tile.SetSprite(t_sprite);
        }
    }
Ejemplo n.º 13
0
    /// <summary>
    /// Get positioning data
    /// </summary>
    /// <param name="index"></param>
    /// <returns></returns>
    public MapPositioningData GetPositioningData(MapIndex index)
    {
        if (posList.ContainsKey(index))
        {
            return(posList[index]);
        }

        return(null);
    }
Ejemplo n.º 14
0
    public Vector2 MapIndexToWorldPos(MapIndex t_mapIndex)
    {
        if (!GetIsOutOfBounds(t_mapIndex))
        {
            return(new Vector2(t_mapIndex.m_x * m_tileSize + m_tileSize / 2, t_mapIndex.m_y * m_tileSize + m_tileSize / 2));
        }

        return(new Vector2(-500, -500));
    }
Ejemplo n.º 15
0
 public TeleportDestination(MapLocation destination, MapIndex index, Coordinate coordinates, IEnumerable <TeleportIndex> teleports = null, ExitTeleportIndex exits = ExitTeleportIndex.None)
 {
     Destination = destination;
     Index       = index;
     CoordinateX = coordinates.X;
     CoordinateY = coordinates.Y;
     Teleports   = teleports?.ToList() ?? new List <TeleportIndex>();
     Exit        = exits;
 }
Ejemplo n.º 16
0
    public Tile GetTile(MapIndex t_mapIndex)
    {
        if (!GetIsOutOfBounds(t_mapIndex))
        {
            return(m_grid[t_mapIndex.m_x][t_mapIndex.m_y]);
        }

        return(null);
    }
Ejemplo n.º 17
0
    private void InitMap()
    {
        MapIndex index = _player.GetComponent <PlayerController>().Index;

        _mapManager.DungeonMap  = _dungeonCreator.DungeonMap;
        _mapManager.PlayerIndex = index;
        _mapManager.ClearMonster();

        UIManager.AddIndex(new Point(index.x, index.y));
    }
Ejemplo n.º 18
0
    private Transform GetMapData()
    {
        MapIndex myIndex = _hero.GetComponentInChildren <Character>().Index;

        _mapData = OperationData.MapData[myIndex.x, myIndex.y];
        Transform monstersTr = _mapData.Find("Monsters");

        _navigation = _mapData.GetComponentInChildren <Navigation4Tilemap>();
        return(monstersTr);
    }
Ejemplo n.º 19
0
    public IEnumerator TileIndex()
    {
        MapIndex indexPos = new MapIndex(1, 5);

        tile.SetIndexPos(indexPos);

        Assert.AreEqual(indexPos, tile.GetIndexPos());

        yield return(new WaitForSeconds(0.1f));
    }
Ejemplo n.º 20
0
    public bool GetIsTileEmpty(MapIndex t_mapIndex)
    {
        Tile tile = m_grid[t_mapIndex.m_x][t_mapIndex.m_y];

        if (tile.GetEntityList().Count == 0)
        {
            return(true);
        }

        return(false);
    }
Ejemplo n.º 21
0
    /// <summary>
    /// Converts the map index into world position
    /// which is at the centre of the tile at the passed in map index.
    /// </summary>
    /// <param name="t_mapIndex">The index position within the map</param>
    /// <returns>The world position of the map index at the centre of the tile</returns>
    public Vector2 MapIndexToPosition(MapIndex t_mapIndex)
    {
        Vector3 position = new Vector3(m_tileWidth / 2 + t_mapIndex.m_x * m_tileWidth, m_tileHeight / 4 + t_mapIndex.m_y * (m_tileHeight * 0.75f), 1);

        if (t_mapIndex.m_y % 2 != 0)
        {
            position.x += m_tileWidth / 2;
        }

        return(position);
    }
Ejemplo n.º 22
0
 protected override void Initialize()
 {
     Index = new MapIndex();
     //스탯 설정
     SetMonsterStats();
     //애니메이션 컴포넌트
     SetAnimationComponent();
     //AI 컴포넌트
     SetAiComponent();
     //몬스터 기본세팅
     MonsterInitalize();
 }
Ejemplo n.º 23
0
    public bool GetIsOutOfBounds(MapIndex t_mapIndex)
    {
        if (t_mapIndex.m_x >= 0 && t_mapIndex.m_x < m_width)
        {
            if (t_mapIndex.m_y >= 0 && t_mapIndex.m_y < m_height)
            {
                return(false);
            }
        }

        return(true);
    }
Ejemplo n.º 24
0
        ////最后定位鹰眼矩形
        private void MapIndex_OnMouseUp(object sender, IMapControlEvents2_OnMouseUpEvent e)
        {
            if (RectEye == null || EyeMove == null || PtStart == null)
            {
                return;
            }

            RectEye.PutCoords(EyeMove.XMin, EyeMove.YMin, EyeMove.XMax, EyeMove.YMax);
            m_FrmActive.mapMain.Extent = EyeMove;
            MapIndex.Refresh();
            PtStart = null;
            EyeMove = null;
        }
Ejemplo n.º 25
0
    public void AddObjectToLayer(MapIndex mapIndex)
    {
        MapObject mo = mapController.MapObjectDataCollection.GetMapObjectById(MapUtility.CoordinateToId(mapIndex.x, mapIndex.z, mapController.MapSizeX));

        if (mo != null)
        {
            int objCount = mo.ObjectDataList.Count;
            if (objCount > 0)
            {
                mapLayers.AddObjectToLayer(selectLayers, mo.ObjectDataList[objCount - 1]);
            }
        }
    }
Ejemplo n.º 26
0
 /// <summary>
 /// Add an object on the map
 /// </summary>
 /// <param name="index"></param>
 /// <param name="rotation"></param>
 /// <returns>"add new data -> true, elsewise false"</returns>
 public bool AddPosition(int order, MapIndex index, Quaternion rotation)
 {
     if (!posList.ContainsKey(index))
     {
         posList.Add(index, new MapPositioningData(order, index, rotation));
         return(true);
     }
     else
     {
         posList[index].Rotation = rotation;
         posList[index].Order    = order;
         return(false);
     }
 }
Ejemplo n.º 27
0
    // Work each time, provide goods from one map, Random
    public void WorkForRandomMap()
    {
        // print("CurrentMapIndex = " + CurrentMapIndex);
        // print("List_MapIndex count = " + List_MapIndex.Count);

        MapIndex Index = List_MapIndex[CurrentMapIndex++];

        CurrentMapIndex = Mathf.Clamp(CurrentMapIndex, 0, List_MapIndex.Count - 1);
        List <TextAsset> List_MapFile = List_RandomMap.Find(it => it.Level == Index.SelfLevel).List_CsvMapWithLevel;

        MapFileForUsing = List_MapFile[Random.Range(0, List_MapFile.Count - 1)];
        ParseDataFromCsvMap();

        // print(MapFileForUsing.name);
    }
Ejemplo n.º 28
0
    private static void UnflowFluid(BlockInstance blockInst)
    {
        MapIndex curIndex   = new MapIndex(blockInst.x, blockInst.y, blockInst.z);
        int      fluidLevel = blockInst.block.FluidLevel;

        if (fluidLevel <= MinFluidLevel)
        {
            return;
        }

        UnflowIfPossible(blockInst.x, blockInst.y - 1, blockInst.z, curIndex, fluidLevel + 1);
        UnflowIfPossible(blockInst.x - 1, blockInst.y, blockInst.z, curIndex, fluidLevel);
        UnflowIfPossible(blockInst.x + 1, blockInst.y, blockInst.z, curIndex, fluidLevel);
        UnflowIfPossible(blockInst.x, blockInst.y, blockInst.z - 1, curIndex, fluidLevel);
        UnflowIfPossible(blockInst.x, blockInst.y, blockInst.z + 1, curIndex, fluidLevel);
    }
Ejemplo n.º 29
0
    void ParseDataFromCsvMapIndex()
    {
        string[] Indexs = CsvMapIndex.text.Replace("\r", "").Split('\n');

        for (int i = 0; i < Indexs.Length; i++)
        {
            string   EachLine = Indexs[i];
            string[] DataArr  = EachLine.Split(',');

            if (DataArr[0] == Config.TableMapIndex)
            {
                MapIndex NewMapIndex = new MapIndex(DataArr);
                List_MapIndex.Add(NewMapIndex);
            }
        }
    }
    public IEnumerator MovementTest()
    {
        MapIndex startTilePos = new MapIndex(1, 1);
        Tile     startTile    = m_mapGrid.GetTile(startTilePos);

        m_combatUnit.SetCurrentTile(startTile);
        m_player.SelectUnit(startTilePos);
        startTilePos.m_y += 6;
        m_player.SelectUnit(startTilePos);
        m_player.TurnEnd();
        Tile movedTile = m_player.GetUnits()[0].GetComponent <Unit>().GetCurrentTile();

        Assert.True(startTile != movedTile);

        yield return(null);
    }
Ejemplo n.º 31
0
		public MapRelation(
			MapResultSet slaveResultSet,
			MapIndex     slaveIndex,
			MapIndex     masterIndex,
			string       containerName)
		{
			if (masterIndex.Fields.Length == 0)
				throw new MappingException("Master index length can not be 0.");

			if ( slaveIndex.Fields.Length == 0)
				throw new MappingException("Slave index length can not be 0.");

			if (masterIndex.Fields.Length != slaveIndex.Fields.Length)
				throw new MappingException("Master and slave indexes do not match.");

			if (string.IsNullOrEmpty(containerName))
				throw new MappingException("Master container field name is wrong.");

			_slaveResultSet  = slaveResultSet;
			_masterIndex     = masterIndex;
			_slaveIndex      = slaveIndex;
			_containerName   = containerName;
		}
Ejemplo n.º 32
0
 public void RequestMove(CharacterScript hero, MapIndex position, bool isPrepositioning)
 {
     if(isPrepositioning)
     {
         hero.Move(position.posX, position.posY, false);
         if(myMap.IsAllCharacterOnPosition())
         {
             network.HeroPositions.Clear();
             foreach(var charac in myMap.GetCharacters())
             {
                 network.HeroPositions.Add(charac.Pos);
             }
         }
     }
     else
     {
         network.RequestMove(hero.Index, position);
     }
 }
Ejemplo n.º 33
0
		public override List<MapRelationBase> GetRelations(MappingSchema schema, ExtensionList typeExt, Type master, Type slave, out bool isSet)
		{
			var relations = new List<MapRelationBase>();
			var ext       = typeExt != null ? typeExt[master] : TypeExtension.Null;

			isSet = ext != TypeExtension.Null;

			if (!isSet)
				return relations;

			var ta = TypeAccessor.GetAccessor(master);

			foreach (var mex in ext.Members.Values)
			{
				var relationInfos = mex.Attributes[TypeExtension.NodeName.Relation];

				if (relationInfos == AttributeExtensionCollection.Null)
					continue;

				var destinationTypeName = relationInfos[0][TypeExtension.AttrName.DestinationType, string.Empty].ToString();
				var destinationType     = slave;
				var ma                  = ta[mex.Name];
				var toMany              = TypeHelper.IsSameOrParent(typeof(IEnumerable), ma.Type);

				if (destinationTypeName == string.Empty)
				{
					if (toMany)
						throw new InvalidOperationException("Destination type should be set for enumerable relations: " + ma.Type.FullName + "." + ma.Name);

					destinationType = ma.Type;
				}
				else
				{
					if (!destinationTypeName.Contains(","))
						destinationTypeName += ", " + ta.OriginalType.Assembly.FullName;
					
					try
					{
						destinationType = Type.GetType(destinationTypeName, true);
					}
					catch (TypeLoadException ex)
					{
						throw new InvalidOperationException(
							"Unable to load type by name: " + destinationTypeName
							+ "\n may be assembly is not specefied, please see Type.GetType(string typeName) documentation",
							ex);
					}
				}

				if (slave != null && !TypeHelper.IsSameOrParent(slave, destinationType))
					continue;

				var masterIndexFields = new List<string>();
				var slaveIndexFields  = new List<string>();

				foreach (var ae in relationInfos[0].Attributes[TypeExtension.NodeName.MasterIndex])
					masterIndexFields.Add(ae[TypeExtension.AttrName.Name].ToString());

				foreach (var ae in relationInfos[0].Attributes[TypeExtension.NodeName.SlaveIndex])
					slaveIndexFields.Add(ae[TypeExtension.AttrName.Name].ToString());


				if (slaveIndexFields.Count == 0)
				{
					var  accessor = toMany ? ta : TypeAccessor.GetAccessor(destinationType);
					var tex      = TypeExtension.GetTypeExtension(accessor.Type, typeExt);

					slaveIndexFields = GetPrimaryKeyFields(schema, accessor, tex);
				}

				if (slaveIndexFields.Count == 0)
					throw new InvalidOperationException("Slave index is not set for relation: " + ma.Type.FullName + "." + ma.Name);

				var slaveIndex  = new MapIndex(slaveIndexFields.ToArray());
				var masterIndex = masterIndexFields.Count > 0 ? new MapIndex(masterIndexFields.ToArray()) : slaveIndex;
				var mapRelation = new MapRelationBase(destinationType, slaveIndex, masterIndex, mex.Name);

				relations.Add(mapRelation);

			}

			isSet = relations.Count > 0;
			return relations;
		}
Ejemplo n.º 34
0
    public List<MapIndex> GetAttackableEffects(MapIndex stdIndex)
    {
        List<MapIndex> resultList = new List<MapIndex>();
        SkillModel curSkill = skills[currentSkillIdx];
        int rangeIdx = -1;
        var ranges = curSkill.attackableRanges;
        for (int i = 0; i < ranges.Count; ++i)
        {
            if (stdIndex.Equals(ranges[i]))
            {
                rangeIdx = i;
                break;
            }
        }


        foreach (var range in curSkill.attackableEffects[rangeIdx])
        {
            MapIndex newPos = new MapIndex();
            newPos.posX = stdIndex.posX + range.relativeX;
            newPos.posY = stdIndex.posY + range.relativeY;
            resultList.Add(newPos);
        }
        return resultList;
    }
Ejemplo n.º 35
0
 public bool Equals(MapIndex other)
 {
     return posX == other.posX && posY == other.posY;
 }
Ejemplo n.º 36
0
 public MapIndex(MapIndex other)
 {
     posX = other.posX;
     posY = other.posY;
 }
Ejemplo n.º 37
0
 public void RequestAction(CharacterScript hero, MapIndex targetPos)
 {
     network.RequestSkillAction(hero.Index, targetPos, hero.CurrentSkillIdx);
 }
Ejemplo n.º 38
0
 public GameObject GetTile(MapIndex index)
 {
     if (index.IsValid())
         return tiles[index.posX + index.posY * 3];
     else
         return null;
 }
Ejemplo n.º 39
0
	public void MakeSkillEffect(MapIndex position, SkillType type)
    {
        GameObject effect;

		//일단 피격 사운드는 디폴트로
		AudioManager.instance.PlaySfx(mapManager.defaultHit);

		switch (type)
		{
			case SkillType.PRIEST_HEAL:
				effect = Instantiate(HealEffect) as GameObject;
				break;
			case SkillType.MAGICIAN_FIRE_BLAST:
				effect = Instantiate(FireEffect) as GameObject;
				break;
			case SkillType.MAGICIAN_THUNDER_STORM:
				effect = Instantiate(ThunderEffect) as GameObject;
				break;
			default:
				effect = Instantiate(DefaultEffect) as GameObject;
				break;
		}
        effect.transform.parent = transform;
        Vector3 effectPos = GetTile(position).transform.localPosition;
        effect.transform.localPosition = new Vector3(effectPos.x, 2.0f, effectPos.z);
    }
Ejemplo n.º 40
0
 public GameObject GetTile(bool isMine, MapIndex index)
 {
     MapScript map = isMine ? myMap : otherMap;
     return map.GetTile(index);
 }
Ejemplo n.º 41
0
    void ParseDataFromCsvMapIndex()
    {
        string[] Indexs = CsvMapIndex.text.Replace("\r", "").Split('\n');

        for (int i = 0; i < Indexs.Length; i++)
        {
            string EachLine = Indexs[i];
            string[] DataArr = EachLine.Split(',');

            if (DataArr[0] == Config.TableMapIndex)
            {
                MapIndex NewMapIndex = new MapIndex(DataArr);
                List_MapIndex.Add(NewMapIndex);
            }
        }
    }
		public override List<MapRelationBase> GetRelations(MappingSchema schema, ExtensionList typeExt, Type master, Type slave, out bool isSet)
		{
			var masterAccessor = TypeAccessor.GetAccessor(master);
			var slaveAccessor  = slave != null ? TypeAccessor.GetAccessor(slave) : null;
			var relations      = new List<MapRelationBase>();

			foreach (MemberAccessor ma in masterAccessor)
			{
				var attr = ma.GetAttribute<RelationAttribute>();

				if (attr == null || (slave != null && attr.Destination != slave && ma.Type != slave))
					continue;

				if (slave == null)
					slaveAccessor = TypeAccessor.GetAccessor(attr.Destination ?? ma.Type);


				var toMany = TypeHelper.IsSameOrParent(typeof(IEnumerable), ma.Type);

				if (toMany && attr.Destination == null)
					throw new InvalidOperationException("Destination type should be set for enumerable relations: " + ma.Type.FullName + "." + ma.Name);

				var masterIndex = attr.MasterIndex;
				var slaveIndex  = attr.SlaveIndex;

				if (slaveIndex == null)
				{
					var accessor = toMany ? masterAccessor : slaveAccessor;
					var tex      = TypeExtension.GetTypeExtension(accessor.Type, typeExt);
					var keys     = GetPrimaryKeyFields(schema, accessor, tex);

					if (keys.Count > 0)
						slaveIndex = new MapIndex(keys.ToArray());
				}

				if (slaveIndex == null)
					throw new InvalidOperationException("Slave index is not set for relation: " + ma.Type.FullName + "." + ma.Name);

				if (masterIndex == null)
					masterIndex = slaveIndex;

				var relation = new MapRelationBase(attr.Destination ?? ma.Type, slaveIndex, masterIndex, ma.Name);

				relations.Add(relation);
			}

			isSet = true;
			return relations;
		}
Ejemplo n.º 43
0
 public MapIndex GetIndex()
 {
     MapIndex result = new MapIndex(x, y);
     return result;
 }