//创造滞留块 public void SetBattleMapBlockRetrad(List <Vector2> vector2s) { BattleMapBlock bm = null; foreach (Vector2 vector2 in vector2s) { bm = BattleMap.Instance().GetSpecificMapBlock(vector2); bm.blockType = EMapBlockType.Retire; } }
//创造灼烧块 public void SetBattleMapBlockBurning(List <Vector2> vector2s) { BattleMapBlock bm = null; foreach (Vector2 vector2 in vector2s) { bm = BattleMap.Instance().GetSpecificMapBlock(vector2); bm.blockType = EMapBlockType.Burnning; } }
/// <summary> /// 移除BattleBlock下的 unit /// </summary> public void RemoveUnitOnBlock(Unit deadUnit) { //获取死亡单位的Pos Vector2 unitPos = GetUnitCoordinate(deadUnit); //通过unitPos的坐标获取对应的地图块儿 BattleMapBlock battleMap = GetSpecificMapBlock(unitPos); //移除对应地图块儿下的deadUnit battleMap.units_on_me.Remove(deadUnit); }
/// <summary> /// 传入MapBlock,返回该MapBlock的坐标 /// </summary> /// <param name="mapBlock"></param> /// <returns></returns> public Vector3 GetCoordinate(BattleMapBlock mapBlock) { for (int i = columns - 1; i >= 0; i--) { for (int j = 0; j < rows; j++) { if (_mapBlocks[i, j] == mapBlock) { return(new Vector3(i, j, 0f)); } } } return(new Vector3(-1, -1, 0f)); }
/// <summary> /// 获取地图块儿上的list 单位 /// </summary> /// <param name="position">单位位置</param> /// <returns></returns> public static List <GameUnit> GetUnitFromBattleMapBlock(Vector2 position) { BattleMap.BattleMapBlock mapBlock = BattleMap.BattleMap.Instance().GetSpecificMapBlock(position); return(mapBlock.units_on_me); }
//单位进入滞留块 public void UnitEnterRetire(Unit unit, BattleMapBlock battleMapBlock) { unit.mapBlockBelow = battleMapBlock; }