// Use this for initialization void Start() { combatBoard = GameObject.Find ("CombatBoard").GetComponent<CombatBoard>(); boardInfo = GameObject.Find("BoardManager").GetComponent<BoardMaker>(); troopsPlaced = false; }
IEnumerator Follow() { target = path.Dequeue(); float startTime = Time.time; while (true) { //move towards current target float lerpNumb = (Time.time - startTime) / speed; Vector2 newPos = Vector2.Lerp(myTrans.position, BoardMaker.IndexToPos(Data.instance.boardSize, target), lerpNumb); myTrans.position = new Vector3(newPos.x, newPos.y, myTrans.position.z); //check reset if (Vector3.Distance(myTrans.position, BoardMaker.IndexToPos(Data.instance.boardSize, target)) < 0.1f) { if (path.Count == 0) { break; } //increment target = path.Dequeue(); startTime = Time.time; } yield return(null); } movin = false; }
void SetupBases(Vector2Int pos) { baseZone.Add(pos); Unit_Node baseTemp = Instantiate(Data.instance.playerBaseObj, BoardMaker.IndexToPos(new Vector2Int(currBoard.GetLength(0), currBoard.GetLength(1)), pos), Quaternion.identity, baseHolder).GetComponent <Unit_Node>(); currBoard[pos.x, pos.y].unitObj = (Unit_Base)baseTemp; currBoard[pos.x, pos.y].unitObj.indexPos = pos; }
public void ShowPath(Vector2Int[] path) { ClearPath(); foreach (Vector2Int pos in path) { debugPath.Add(Instantiate(debugObj, BoardMaker.IndexToPos(new Vector2Int(currBoard.GetLength(0), currBoard.GetLength(1)), pos), Quaternion.identity, PathHolder)); } }
void SetupWall(Vector2Int pos) { Unit_Wall wallTemp = Instantiate(Data.instance.wallObj, BoardMaker.IndexToPos(new Vector2Int(currBoard.GetLength(0), currBoard.GetLength(1)), pos), Quaternion.Euler(0, 0, 45), blockerHolder).GetComponent <Unit_Wall>(); wallTemp.indexPos = pos; currBoard[pos.x, pos.y].unitObj = (Unit_Base)wallTemp; numberOfWalls++; UpdateText(); }
void SetupSpawners(Vector2Int pos) { Unit_Spawn spawnerTemp = Instantiate(Data.instance.spawnerObj, BoardMaker.IndexToPos(new Vector2Int(currBoard.GetLength(0), currBoard.GetLength(1)), pos), Quaternion.identity, SpawnerHolder).GetComponent <Unit_Spawn>(); currBoard[pos.x, pos.y].unitObj = (Unit_Base)spawnerTemp; currBoard[pos.x, pos.y].unitObj.indexPos = pos; spawnerTemp.StartUp(); spHandler.spawners.Add(spawnerTemp); }
public void TestCreateRandomBoard(int sideLength) { BoardMaker maker = new BoardMaker(); maker.LoadRandomBoard(sideLength); var board = maker.GetBoard(); board.Chars.Length.Should().Be(sideLength * sideLength); }
private void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } }
void Start() { currBoard = BoardMaker.MakeBoard(Data.instance.currBoard); turretBoard = new BoardNode[currBoard.GetLength(0), currBoard.GetLength(1)]; BoardMaker.MakeTurretBoard(new Vector2Int(currBoard.GetLength(0), currBoard.GetLength(1))); blockerHolder = new GameObject("Blockers").GetComponent <Transform>(); baseHolder = new GameObject("AllYourBASE").GetComponent <Transform>(); SpawnerHolder = new GameObject("Spawners").GetComponent <Transform>(); PathHolder = new GameObject("Pathways").GetComponent <Transform>(); SetupForTesting(); UpdateText(); curState = stateGame; }
/* * public void RecievePath(Vector2Int[] waypoints, bool succPath) * { * if (succPath) * { * for (int i = 0; i < waypoints.Length; i++) * { * print(waypoints[i]); * * Instantiate(debugObj, BoardMaker.IndexToPos(new Vector2Int(currBoard.GetLength(0), currBoard.GetLength(1)), new Vector2Int(waypoints[i].x, waypoints[i].y)), Quaternion.identity); * * * } * } * } * //*/ public void BuildWall(Vector3 pos) { //get position to position Vector2Int newPos = BoardMaker.PositionToIndex(new Vector2Int(currBoard.GetLength(0), currBoard.GetLength(1)), pos); //Check its legal //# of walls if (numberOfWalls >= maxWalls) { return; } //blocks paths SetupWall(newPos); }
void Start() { Data_Board boardDat = Data.instance.currBoard; gameBoard = BoardMaker.MakeBoard(boardDat); foreach (Vector2Int charPos in boardDat.playerPositions) { AddCharacter(charPos); } foreach (ReflectorZones reflectorZ in boardDat.refZones) { AddReflector(reflectorZ.pos, reflectorZ.rot); } background.color = Data.instance.artData.characterColour[charTurn]; }
public void TestCreateRandomBoardFailure(int sideLength) { BoardMaker board = new BoardMaker(); try { board.LoadRandomBoard(sideLength); } catch (Exception ex) { ex.Should().NotBeNull(); board = null; } board.Should().BeNull(); }
/// <summary> /// Manager that will handle running the game cmdline options and return a status code to the caller. /// </summary> /// <param name="opts">CmdLineOptions object that contains the parsed command line args.</param> /// <returns>Error Code. 0 = Success, 1 = Failure.</returns> public static async Task<int> RunAndReturnExitCodeAsync(CmdLineOptions opts) { if (opts == null) { throw new ArgumentNullException(nameof(opts)); } RuntimeTimer.RegisterAppStart(); m_cmdLineOpts = opts; // Validate Input ValidateCmdLine val = new ValidateCmdLine(); val.IsCmdLineValid(opts); // Load the dictionary from disk await LoadDictFromDiskAsync(); await Task.Run(() => { BoardMaker maker = new BoardMaker(); maker.LoadRandomBoard(opts.SideLength); Board board = maker.GetBoard(); IGameSolver solver = null; if (m_cmdLineOpts.Singlethreaded) { solver = new SinglethreadedGameSolverService(); } else { solver = new AsyncGameSolverService(); } var foundWords = solver.Solve(m_wordDict, board); // This is a little odd. I want to stop timing before I write all the words, which takes a long time RuntimeTimer.RegisterAppEnd(); var totalOperations = solver.GetTotalOperations(); PrintFoundWordsToConsole(foundWords, totalOperations, opts.ForceWriteFoundWords); }); return Utils.Consts.c_exitCodeSuccess; }
public void BuildBoard(int sizeX, int sizeY) { DecideStartPoints(sizeX, sizeY); GameObject instance; for (int x = 0; x < sizeX; x++) { for (int y = 0; y < sizeY; y++) { instance = Instantiate(cell, positionToPut, Quaternion.identity); instance.name = "" + x + "-" + y; instance.transform.SetParent(transform); instance.transform.localScale = new Vector2(cellScale, cellScale); GameLogic.instance.UpdateArrayCell(instance, x, y); positionToPut.x = positionToPut.x + cellScale; } positionToPut.x = -startPointX; positionToPut.y = positionToPut.y - cellScale; } }
// Use this for initialization void Start() { isSelected = false; redGeneralOnMe = false; blueGeneralOnMe = false; highlit = false; boardInfo = GameObject.Find ("BoardManager").GetComponent<BoardMaker>(); }
// Use this for initialization void Start() { boardInfo = GameObject.Find ("BoardManager").GetComponent<BoardMaker>(); redDeclareAttacker = redDeclareDefender = blueDeclareAttacker = blueDeclareDefender = false; redGeneral = GameObject.Find ("Red General").GetComponent<GeneralUnits>(); blueGeneral = GameObject.Find ("Blue General").GetComponent<GeneralUnits>(); blueGeneralUnits = new GUIContent[10]; redGeneralUnits = new GUIContent[10]; attackingUnit = defendingUnit = null; damage = 0; damageDealt = false; redUnitDestroyed = blueUnitDestroyed = false; }
//The grid should be generated on game start void Awake() { selectedUnit = -1; aHexIsSelected = false; hexArray = new GameObject[gridWidthInHexes,gridHeightInHexes]; setSizes(); createGrid(); redUnits = new List<GameObject>(); blueUnits = new List<GameObject>(); redUnitPositions = new List<Vector2>(); blueUnitPositions = new List<Vector2>(); boardInfo = GameObject.Find ("BoardManager").GetComponent<BoardMaker>(); }
// Use this for initialization void Start() { boardInfo = GameObject.Find ("BoardManager").GetComponent<BoardMaker>(); }
// Use this for initialization void Start() { boardInfo = GameObject.Find ("BoardManager").GetComponent<BoardMaker>(); unitQueue = new List<UnitsInBase>[2,3]; units = new List<UnitsInBase>[2]; structBuildTime = 4; unitBuildTime = 4; queueCap = 5; unitCap = 20; buildingStruct = new bool[2,3]; structTurnStarted = new int[2,3]; structBuilt = new bool[2,3]; buildingUnit = new bool[2,3]; for(int i=0;i<2;i++) { units[i] = new List<UnitsInBase>(); for(int j=0;j<3;j++) { buildingStruct[i,j] = false; structBuilt[i,j] = false; buildingUnit[i,j] = false; unitQueue[i,j] = new List<UnitsInBase>(); } } structMsg = new string[]{"Barracks","Factory","Air Base"}; unitMsg = new string[]{"Grunt","Tank","Plane"}; }
void Start() { board = GetComponent <BoardMaker>(); growthModifier = ConfigurationManager.Instance.getGrowthModifier(); colorChangeModifier = ConfigurationManager.Instance.getColorChangeModifier(); }
public BoardMakerTests() { Subject = new BoardMaker(); }
public static Vector2 IndexToTurretPos(Vector2Int boardSize, Vector2Int position) { Vector2 toReturn = BoardMaker.IndexToPos(boardSize, position); return(new Vector2(toReturn.x + 0.5f, toReturn.y + 0.5f)); }
// Use this for initialization void Start() { boardInfo = GameObject.Find ("BoardManager").GetComponent<BoardMaker>(); blueGeneral = GameObject.Find("Blue General"); baseClickedOn = false; buildings = new Building_BASE_CLASS[6]; unitContent = new GUIContent[20]; displayChoices = false; buttonNum = -1; for(int i = 0; i < 20; i++) { unitContent[i] = GUIContent.none; } }