void StopUnits() { foreach (GameObject unit in unitsSpawned) { if (unit != null) { SelectedUnit_MoveHandler moveHandler = unit.GetComponent <SelectedUnit_MoveHandler>(); moveHandler.attackTarget = null; moveHandler.moving = false; moveHandler.movingToAttack = false; } } }
public void MoveUnitsBack() { for (int x = 0; x < unitsSpawned.Length; x++) { if (unitsSpawned[x] != null) { SelectedUnit_MoveHandler moveHandler = unitsSpawned[x].GetComponent <SelectedUnit_MoveHandler>(); moveHandler.moving = true; moveHandler.movingToAttack = false; moveHandler.mX = Mathf.RoundToInt(unitPositions[x].x); moveHandler.mY = Mathf.RoundToInt(unitPositions[x].y); } } // StopUnits (); }
void MoveUnits(Vector3 pos) { foreach (GameObject unit in unitsSpawned) { if (unit != null && attackTarget != null) { SelectedUnit_MoveHandler moveHandler = unit.GetComponent <SelectedUnit_MoveHandler>(); moveHandler.attackTarget = attackTarget; moveHandler.moving = true; moveHandler.movingToAttack = true; // Transform child = enemyUnit.transform.FindChild("sprite").transform; moveHandler.mX = Mathf.RoundToInt(pos.x); moveHandler.mY = Mathf.RoundToInt(pos.y); } } }