private void Awake() { Physics.IgnoreLayerCollision(layer, layer, true); pathing = GameObject.Find("A*").GetComponent <AStarManager>(); gridScript = GameObject.Find("UGrid").GetComponent <UGrid>(); myTransform = GetComponent <Transform>(); }
//TODO: need to move to another component #region Moving logic public void MoveTo(Vector3 position, Action <bool> movingOverCallback) { SettlersEngine.Point startPoint = new SettlersEngine.Point() { X = (int)this.transform.position.x, Y = (int)this.transform.position.z }; SettlersEngine.Point endPoint = new SettlersEngine.Point() { X = (int)position.x, Y = (int)position.z }; IEnumerable <AStarPathNode> path = AStarManager.GetInstance().Search(startPoint, endPoint); if (path != null) { if (currentMoveEnumerator != null) { StopCoroutine(currentMoveEnumerator); } currentMoveEnumerator = StartCoroutine(StartMoveTo(path, movingOverCallback)); } else { movingOverCallback(false); } }
private void OnEnable() { unit = base.target as AStarUnit; unitSize = serializedObject.FindProperty("unitSize"); target = serializedObject.FindProperty("target"); targetFootOffset = serializedObject.FindProperty("targetFootOffset"); targetFollowStartDistance = serializedObject.FindProperty("targetFollowStartDistance"); footOffset = serializedObject.FindProperty("footOffset"); fixedOffset = serializedObject.FindProperty("fixedOffset"); moveMode = serializedObject.FindProperty("moveMode"); rigidbody = serializedObject.FindProperty("rigidbody"); rigidbody2D = serializedObject.FindProperty("rigidbody2D"); controller = serializedObject.FindProperty("controller"); turnSpeed = serializedObject.FindProperty("turnSpeed"); moveSpeed = serializedObject.FindProperty("moveSpeed"); slopeLimit = serializedObject.FindProperty("slopeLimit"); stopDistance = serializedObject.FindProperty("stopDistance"); repathRate = serializedObject.FindProperty("repathRate"); drawGizmos = serializedObject.FindProperty("drawGizmos"); lineColor = serializedObject.FindProperty("lineColor"); pointColor = serializedObject.FindProperty("pointColor"); pathRenderer = serializedObject.FindProperty("pathRenderer"); animator = serializedObject.FindProperty("animator"); animaHorizontal = serializedObject.FindProperty("animaHorizontal"); animaVertical = serializedObject.FindProperty("animaVertical"); animaMagnitude = serializedObject.FindProperty("animaMagnitude"); manager = FindObjectOfType <AStarManager>(); }
public void AIActionStart(Unit _unit) { int enemyHero = (_unit.side + 1) % 2; bool isRangeAttack = _unit.IsRangeAttack; List <Unit> enemyList = BattleManager.instance.units[enemyHero]; //远程单位,且没有被近身 if (isRangeAttack) { Unit target = GetMaxDamageUnit(_unit, enemyList, isRangeAttack); UnitActionMgr.order = new Order(OrderType.rangeAttack, _unit, target); } else { int speed = _unit.GetComponent <Unit>().speed; List <Unit> targetList = GetEnemiesWithinRange(_unit, speed + 1); Unit target; if (targetList.Count > 0) { //攻击范围内有目标 target = GetMaxDamageUnit(_unit, targetList, isRangeAttack); List <NodeItem> path = AStarManager.FindPath(BattleManager.instance.map, _unit.nodeItem, target.nodeItem, false); path.RemoveAt(path.Count - 1); if (_unit.isWalker) { UnitActionMgr.order = new Order(OrderType.attack, _unit, path, target); } else { UnitActionMgr.order = new Order(OrderType.attack, _unit, path[path.Count - 1], target); } } else { //攻击范围内无目标 target = GetNearestUnit(_unit, enemyList); //且可到达 List <NodeItem> path = AStarManager.FindPath(BattleManager.instance.map, _unit.nodeItem, target.nodeItem, false); //去掉移动力之外的部分 path.RemoveRange(speed, path.Count - speed); if (_unit.isWalker) { UnitActionMgr.order = new Order(OrderType.move, _unit, path, target); } else { UnitActionMgr.order = new Order(OrderType.move, _unit, path[path.Count - 1], target); } } } }
protected override void Start() { AStarManager = AStarManager.Instance.GetComponent <AStarManager>(); clearToggle.onValueChanged.AddListener((bool val) => { ClearToggleValueChanged(val); }); }
//获取伤害范围 public Vector2Int GetDamageRange(Unit _origin, Unit _target, bool _isRangeAttack = false) { Vector2Int range = _origin.damage; float damageRate = DamageRate(_origin.att, _target.def); //print("伤害倍率:" + damageRate); //远程攻击,没有近战伤害不减的特质,超过10格伤害减半 if (_isRangeAttack && !TraitManager.PossessTrait(_origin, "No melee penalty") && AStarManager.GetNodeItemDistance(_origin.nodeItem, _target.nodeItem, true) > BattleManager.instance.rangeAttackRange) { damageRate /= 2; } //圣灵庇佑和诅咒判定,根据后来居上原则 for (int i = 0; i < _origin.behaviors.Count; i++) { if (_origin.behaviors[i].name == "Bestow Hope") { range = _origin.damage; range.x = range.y; } else if (_origin.behaviors[i].name == "Bestow Hope_2") { range = _origin.damage; range.y++; range.x = range.y; } else if (_origin.behaviors[i].name == "Cursed Strikes") { range = _origin.damage; range.y = range.x; } else if (_origin.behaviors[i].name == "Cursed Strikes_2") { range = _origin.damage; range.x--; range.y = range.x; } } //至少也有1点 range.x = Mathf.Max(range.x, 1); range.y = Mathf.Max(range.y, 1); //伤害乘以伤害倍率 range.x = (int)(range.x * damageRate); range.y = (int)(range.y * damageRate); return(range * _origin.num); }
private void Awake() { if (instance == null) { instance = this; } else { GameObject.Destroy(this.gameObject); } }
void Awake() { playerTrans = GameObject.FindWithTag("Player").GetComponent <Transform>(); aStarManager = this.GetComponent <AStarManager>(); levelManager = GameObject.FindGameObjectWithTag("Level Manager").GetComponent <LevelManager>(); totalFloorCount += levelManager.FloorAmount; amountOfEnemiesOnLevel = 0; }
// Use this for initialization void Start() { asMgr = FindObjectOfType <AStarManager>(); currentPathPoint = -1; RaycastHit hit; if (Physics.Raycast(new Vector3(transform.position.x, 500, transform.position.z), Vector3.down, out hit)) { transform.position = new Vector3(transform.position.x, hit.point.y + 1, transform.position.z); } }
void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } nodesInWorld = FindObjectsOfType <Node>(); }
private void Start() { GridAgent[] gridAgents = FindObjectsOfType <GridAgent>(); int size = (int)Mathf.Sqrt(gridAgents.Length); globalTilesList = new GridAgent[size, size]; for (int i = 0; i < gridAgents.Length; i++) { globalTilesList[gridAgents[i].position.x, gridAgents[i].position.y] = gridAgents[i]; } UpdateGrid(); AStarManager.GetInstance().CreateNewSolver(currentGrid); }
public ActionInfo GetActionInfo(Vector2Int position) { if ((possibleActions & ActionType.Walk) == ActionType.Walk) { LinkedList <AStarPathNode> path = AStarManager.GetInstance().Search(GridTransform.Position, position); if (path == null || path.Count <= 1) { Debug.LogWarning("Couldn't find path to " + position.ToString()); return(null); } if (path.Count - 1 > Stat.MovePoints.Value) { Debug.LogWarning("Not enough move points"); return(null); } ActionInfo actionInfo = new ActionInfo(); actionInfo.ActionList.Add(new MovingAction(path.Count - 1, path)); return(actionInfo); } Debug.LogWarning("Can't walk"); return(null); }
// Start is called before the first frame update protected virtual void Start() { GetStat(); ani = this.GetComponent <Animator>(); gameManager = GameObject.Find("GameManager").GetComponent <GameManager>(); _inputListener = GameManager.Instance.GetComponent <InputListener>(); aStarManager = GameObject.Find("MapGrid").GetComponent <AStarManager>(); aStarTarget = new GameObject(); // empty GameObject for Astar pathfinding state = ActorState.idle; boss = gameManager.GetBoss(); characters = gameManager.GetChars(); effectmanager = EffectManager.Instance; dungeonManager = DungeonManager.Instance; aStarPathfinding = GetComponent <AStarPathfinding>(); aStarPathfinding.grid = aStarManager.AStarGrid; selectiveObject = transform.Find("isSelect").gameObject; StartCoroutine(AttackMotion(1 / this.stat.attackSpeed)); }
public ActionInfo GetActionInfo(Actor selectedActor) { if (selectedActor == null) { Debug.LogError("Invalid param"); return(null); } LinkedList <AStarPathNode> path = AStarManager.GetInstance().SearchClosest(GridTransform.Position, selectedActor.GridTransform.Position); if (path == null || path.Count <= 0) { Debug.LogWarning("Couldn't find path to " + selectedActor.GridTransform.Position.ToString()); return(null); } if (path.Count - 1 + 2 > Stat.MovePoints.Value) { Debug.LogWarning("Not enough move points"); return(null); } ActionInfo actionInfo = new ActionInfo(); if (path.Count >= 2) { if ((possibleActions & ActionType.Walk) == ActionType.Walk) { actionInfo.ActionList.Add(new MovingAction(path.Count - 1, path)); actionInfo.ActionList.Add(new AttackAction(2, ActionType.Melee, selectedActor)); return(actionInfo); } } else { actionInfo.ActionList.Add(new AttackAction(2, ActionType.Melee, selectedActor)); return(actionInfo); } return(null); }
//鼠标进入节点 public void OnNodeHovered(NodeItem_Battle _node) { _node.ChangeBackgoundColor("hover"); playerHovered = _node; //是可到达节点,则显示路径 if (_node.battleNodeType == BattleNodeType.reachable) { CursorManager.instance.ChangeCursor("reachable"); //是地面移动单位,则计算路径 if (BattleManager.currentActionUnit.isWalker) { //print("hover"); FindPath(BattleManager.currentActionUnit, _node); } } else if (_node.battleNodeType == BattleNodeType.attackable) { if (BattleManager.currentActionUnit.IsRangeAttack) { //(有远程伤害不减的特质),或者距离10以内 //TraitManager.PossessTrait(BattleManager.currentActionUnit, "No melee penalty") || if (AStarManager.GetNodeItemDistance(BattleManager.currentActionUnit.nodeItem, _node, true) <= BattleManager.instance.rangeAttackRange) { CursorManager.instance.ChangeCursor("arrow"); } else { CursorManager.instance.ChangeCursor("arrow_penalty"); } } //显示文本 BattleInfoMgr.instance.SetText_Attack(BattleManager.currentActionUnit, _node.unit); } else if (_node.battleNodeType == BattleNodeType.spellable) { CursorManager.instance.ChangeCursor("spell"); } else { //如果不是可行动节点 //如果是单位 if (_node.nodeObject != null && _node.nodeObject.nodeObjectType == NodeObjectType.unit) { //显示并更新单位属性UI //BattleManager.instance.ShowUnitStatUI(true, _node.unit); //如果不是当前行动单位,开始闪烁 if (_node.nodeObject != BattleManager.currentActionUnit) { if (BattleManager.instance.isSamePlayer(_node.unit, BattleManager.currentActionUnit)) { UnitHaloMgr.instance.HaloFlashStart(_node.unit, "friend"); } else { UnitHaloMgr.instance.HaloFlashStart(_node.unit, "enemy"); } } //根据敌友改变指针 if (BattleManager.instance.isSamePlayer(_node.unit, BattleManager.currentActionUnit)) { CursorManager.instance.ChangeCursor("friend"); } else { CursorManager.instance.ChangeCursor("enemy"); } } } //不可到达点 // else if (_node.battleNodeType == BattleNodeType.empty) // { // CursorManager.instance.ChangeCursor("stop"); // } }
public List <Vector2> FindPath(Vector2Int _startLandIdx, Vector2Int _distLandIdx) { return(ChangeNodeListToPath(AStarManager.FindPath(_startLandIdx, _distLandIdx))); }
public override LinkedList <Node> GeneratePath(int _enemyPosX, int _enemyPosY) { GridManager grid = DungeonManager.Instance.Grids[(int)GridType.Knight]; LinkedList <Node> retPath = null; retPath = AStarManager.FindPath( grid.nodes[_enemyPosX, _enemyPosY], grid.nodes[GameManager.Instance.Player.PosX, GameManager.Instance.Player.PosY], grid); if (retPath == null) { /* Here we try the nearest nodes. If the second AStarPath still returns null, * it could be that the enemy piece is completely blocked off. * So don't waste more time trying to find a path, just random * move to the adjacent blocks. */ // Spiral Nearest when the adjacent tiles are not available. Spiral max radius of 3 tiles. int targetPosX = GameManager.Instance.Player.PosX; int targetPosY = GameManager.Instance.Player.PosY; bool emptyTileFound = false; int increment = 1; int iMax = 1; while ((iMax - 1) < 5) { for (int y = 0; y < iMax; y++) { targetPosY += increment; if (DungeonManager.Instance.IsCellEmpty(targetPosX, targetPosY)) { retPath = AStarManager.FindPath( grid.nodes[_enemyPosX, _enemyPosY], grid.nodes[targetPosX, targetPosY], grid); emptyTileFound = true; break; } } for (int x = 0; x < iMax; x++) { targetPosX += increment; if (DungeonManager.Instance.IsCellEmpty(targetPosX, targetPosY)) { retPath = AStarManager.FindPath( grid.nodes[_enemyPosX, _enemyPosY], grid.nodes[targetPosX, targetPosY], grid); emptyTileFound = true; break; } } if (emptyTileFound) { break; } iMax++; increment *= -1; } // If the path is still null (maybe enemy is blocked off by structure), just random anyhow position to the adjacent tiles. if (retPath == null) { LinkedList <Node> neighbours = grid.nodes[_enemyPosX, _enemyPosY].neighbours; for (LinkedListNode <Node> curNode = neighbours.First; curNode != null; curNode = curNode.Next) { if (DungeonManager.Instance.IsCellEmpty(curNode.Value.PosX, curNode.Value.PosY)) { retPath = new LinkedList <Node>(); retPath.AddFirst(grid.nodes[curNode.Value.PosX, curNode.Value.PosY]); retPath.AddFirst(grid.nodes[_enemyPosX, _enemyPosY]); break; } } } } // If STILL null (can't move all; all neighbours blocked), then no choice, return null and don't move. return(retPath); }
//点击节点 public override void OnNodePressed(NodeItem _node) { NodeItem_Travel node = (NodeItem_Travel)_node; NodeObject_Travel obj = (NodeObject_Travel)node.nodeObject; Hero hero = TravelManager.currentHero; if (hero == null) { Debug.LogError("当前英雄为空"); } //有路径,而且点击的是终点,则开始移动。否则寻路 if (path != null && node.pathType == TravelPathType.goal) { //是空地直接移动 //否则移动到目标点,然后开始交互 if (obj == null) { MoveObjectAlongPath(hero.gameObject, path); } else { targetNodeObject = obj; if (obj.objectType == TravelNodeType.empty) { MoveObjectAlongPath(hero.gameObject, path); } //是英雄,或者单位,或者物品,只要移动到相邻处,就能开始交互 else if (obj.objectType == TravelNodeType.hero || obj.objectType == TravelNodeType.unit || obj.objectType == TravelNodeType.item) { List <NodeItem> shortPath = new List <NodeItem>(path); shortPath.RemoveAt(shortPath.Count - 1); MoveObjectAlongPath(hero.gameObject, shortPath); } else { //城镇或者地点类物体,进入后交互 MoveObjectAlongPath(hero.gameObject, path); } } } else { //清除之前的路径显示 ClearPath(); path = AStarManager.FindPath(this, hero.nodeItem, _node); int movementRate = hero.movementRate; if (path != null) { NodeItem lastNode; for (int i = 1; i < path.Count; i++) { lastNode = path[i - 1]; if (movementRate >= 0) { movementRate -= GetNodeDistance(lastNode, path[i]); } NodeItem_Travel currentNode = (NodeItem_Travel)path[i]; if (i == path.Count - 1) { //是终点 currentNode.UpdateStatus(TravelPathType.goal); } else { currentNode.UpdateStatus(TravelPathType.path); } if (movementRate >= 0) { currentNode.ChangeColor(color_reachable); } else { currentNode.ChangeColor(color_outOfReach); } lastNode.GetComponent <NodeItem_Travel>().ArrowFaceTarget(path[i].gameObject); } } } }
public override LinkedList <Node> GeneratePath(int _enemyPosX, int _enemyPosY) { GridManager grid = DungeonManager.Instance.Grids[(int)GridType.King]; LinkedList <Node> retPath = null; // For king only, because the possibilities are a LOT more, so best to check if player is blocked off // For example, when it is completely surrounded by enemies, king cannot reach it. // So better to just skip the first AStar search because it is so expensive. // Check if there are any empty adjacent nodes to the player. LinkedList <Node> playerNodeNeighbours = grid.nodes[GameManager.Instance.Player.PosX, GameManager.Instance.Player.PosY].neighbours; for (LinkedListNode <Node> curNode = playerNodeNeighbours.First; curNode != null; curNode = curNode.Next) { // If it is one of the surrounding pieces, just directly generate the path. // Need this check, otherwise one of the pieces will move out of formation, // as it detects that the player is surrounded, but does not realize that it is one of the 8 surrounding pieces. if (curNode.Value.PosX == _enemyPosX && curNode.Value.PosY == _enemyPosY) { retPath = AStarManager.FindPath( grid.nodes[_enemyPosX, _enemyPosY], grid.nodes[GameManager.Instance.Player.PosX, GameManager.Instance.Player.PosY], grid); break; } if (DungeonManager.Instance.IsCellEmpty(curNode.Value.PosX, curNode.Value.PosY)) { retPath = AStarManager.FindPath( grid.nodes[_enemyPosX, _enemyPosY], grid.nodes[GameManager.Instance.Player.PosX, GameManager.Instance.Player.PosY], grid); break; } } if (retPath == null) { /* Here we try the nearest nodes. If the second AStarPath still returns null, * it could be that the enemy piece is completely blocked off. * So don't waste more time trying to find a path, just random * move to the adjacent blocks. */ // Spiral Nearest when the adjacent tiles are not available. Spiral max radius of 3 tiles. int targetPosX = GameManager.Instance.Player.PosX; int targetPosY = GameManager.Instance.Player.PosY; bool emptyTileFound = false; int increment = 1; int iMax = 1; while ((iMax - 1) < 5) { for (int y = 0; y < iMax; y++) { targetPosY += increment; if (DungeonManager.Instance.IsCellEmpty(targetPosX, targetPosY)) { retPath = AStarManager.FindPath( grid.nodes[_enemyPosX, _enemyPosY], grid.nodes[targetPosX, targetPosY], grid); emptyTileFound = true; break; } } for (int x = 0; x < iMax; x++) { targetPosX += increment; if (DungeonManager.Instance.IsCellEmpty(targetPosX, targetPosY)) { retPath = AStarManager.FindPath( grid.nodes[_enemyPosX, _enemyPosY], grid.nodes[targetPosX, targetPosY], grid); emptyTileFound = true; break; } } if (emptyTileFound) { break; } iMax++; increment *= -1; } // If the path is still null (maybe enemy is blocked off by structure), just random anyhow position to the adjacent tiles. if (retPath == null) { LinkedList <Node> neighbours = grid.nodes[_enemyPosX, _enemyPosY].neighbours; for (LinkedListNode <Node> curNode = neighbours.First; curNode != null; curNode = curNode.Next) { if (DungeonManager.Instance.IsCellEmpty(curNode.Value.PosX, curNode.Value.PosY)) { retPath = new LinkedList <Node>(); retPath.AddFirst(grid.nodes[curNode.Value.PosX, curNode.Value.PosY]); retPath.AddFirst(grid.nodes[_enemyPosX, _enemyPosY]); break; } } } } // If STILL null (can't move all; all neighbours blocked), then no choice, return null and don't move. return(retPath); }
void Awake() { instance = this; }
void Start() { Physics.IgnoreLayerCollision(layer, layer, true); pathing = GameObject.Find("A*").GetComponent<AStarManager>(); gridScript = GameObject.Find("UGrid").GetComponent<UGrid>(); myTransform = GetComponent<Transform>(); }
//寻找路径 bool FindPath(Unit _unit, NodeItem _target) { if (path != null) { ClearPath(); } NodeItem unitNode = _unit.nodeItem; /* * //判断是双格单位,而且前方点更近,则使用前方点进行寻路 * if(_unit.type.isTwoHexsUnit && (_target.pos - _unit.nodeAhead.pos).magnitude < (_target.pos - _unit.nodeItem.pos).magnitude) * { * unitNode = _unit.nodeAhead; * } * * if(_unit.type.isTwoHexsUnit) * { * //前方点不存在或被占用,则使用上个点为目的地 * Vector2Int pos = _target.pos; * pos.x += _unit.sideFacing; * if(!BattleManager.instance.map.isNodeAvailable(pos) || !BattleManager.instance.map.GetNode(pos).walkable) * { * pos.x -= 2 * _unit.sideFacing; * _target = BattleManager.instance.map.GetNodeItem(pos); * } * } */ //根据是否是双格单位,选中寻路方法 if (!_unit.type.isTwoHexsUnit) { path = AStarManager.FindPath(BattleManager.instance.map, unitNode, _target, !_unit.isWalker); } else { path = new List <NodeItem>(); MapManager map = BattleManager.instance.map; //如果目标点的前方点不存在,或者不在可到达节点,则目标点向后移动 Vector2Int ahead = new Vector2Int(_target.pos.x + _unit.sideFacing, _target.pos.y); if (!map.isNodeAvailable(ahead) || !NodeSelector.reachableNodes.Contains(map.GetNodeItem(ahead))) { _target = map.GetNodeItem(new Vector2Int(_target.pos.x - _unit.sideFacing, _target.pos.y)); } foreach (var item in AStarManager.FindPath_TwoHex(map, map.GetNode(unitNode.pos), map.GetNode(_unit.nodeAhead.pos), map.GetNode(_target.pos), !_unit.isWalker)) { path.Add(map.GetNodeItem(item.pos)); } } //print(path.Count); if (path == null) { //print("未能找到路径"); return(false); } path.RemoveAt(0); foreach (var item in path) { item.GetComponent <NodeItem_Battle>().ChangeBackgoundColor("path"); } return(true); }
// Ensure that the instance is destroyed when the game is stopped in the editor. void OnApplicationQuit() { s_Instance = null; }
public void ShowBattleGrid(int battleId) { if (globalTilesList == null) { return; } ClearBattleGrid(); foreach (LinkedList <GridAgent> column in tilesList) { foreach (GridAgent ga in column) { if (ga.isDirty) { ga.GetGrid(); } } } Actor currentActor = BattleManager.GetInstance().GetCurrentActor(battleId); if (currentActor == null) { Debug.LogError("There is no current actor in battle manager"); return; } Vector2Int startPos = currentActor.GridTransform.Position; int drawRange = currentActor.Stat.MovePoints.Value; Vector2Int gridMin = new Vector2Int(currentGrid[0, 0].X, currentGrid[0, 0].Y); Vector2Int gridMax = new Vector2Int(currentGrid[0, 0].X + currentGrid.GetLength(0) - 1, currentGrid[0, 0].Y + currentGrid.GetLength(1) - 1); currentBattleGrid.Clear(); AStarManager aStarManager = AStarManager.GetInstance(); int minX = startPos.x - drawRange; if (minX < gridMin.x) { if (minX < 0) { minX = gridMin.x; } else { MoveGrid(Direction.Left); ShowBattleGrid(battleId); return; } } int minY = startPos.y - drawRange; if (minY < gridMin.y) { if (minY < 0) { minY = gridMin.y; } else { MoveGrid(Direction.Down); ShowBattleGrid(battleId); return; } } int maxX = startPos.x + drawRange; if (maxX > gridMax.x) { if (maxX > GridMax.x) { maxX = gridMax.x; } else { MoveGrid(Direction.Right); ShowBattleGrid(battleId); return; } } int maxY = startPos.y + drawRange; if (maxY > gridMax.y) { if (maxY > GridMax.y) { maxY = gridMax.y; } else { MoveGrid(Direction.Up); ShowBattleGrid(battleId); return; } } int index = 0; for (int x = minX; x <= maxX; x++) { currentBattleGrid.Add(new List <Vector2Int>()); for (int y = minY; y <= maxY; y++) { LinkedList <AStarPathNode> path = aStarManager.Search(startPos, new Vector2Int(x, y)); int tileType = 0; if (path == null) { tileType = 3; } if (path != null && path.Count - 1 <= drawRange) { tileType = ((float)(path.Count - 1) / (float)drawRange) < 0.7f ? 2 : 1; } if (tileType == 0) { continue; } tilemap.SetTile(new Vector3Int(x, y, 0), tileBases[tileType]); currentBattleGrid[index].Add(new Vector2Int(x, y)); } index++; } }