void Update() { ai.ImplementedUpdate(); ai = gameObject.GetComponent <AI>(); ai.AIAttack(); ai.AIMove(); UpdateRoot(); }
void Start() { UnitManage.UpdateUnit(); UnitManage.SortUnit(0); OpenSideBar(false); DispalyScreen(); UpdateFog(); AI.AIMove(); }
void Update() { if (Input.GetKey(KeyCode.Escape)) { SceneManager.LoadScene("LevelSelect"); } else if (Input.GetKeyDown("e")) { Cancel(); CurrentTurn++; ObjectReference.Turn.text = CurrentTurn.ToString(); UnitManage.UpdateEvent(); UpdateFog(); AI.AIMove(); } else if (Input.GetKeyDown("q")) { FindUnit(); } if (Input.GetMouseButton(1)) { Cursor.SetCursor(ResourceFile.DragCursor, Vector2.zero, CursorMode.ForceSoftware); DragScreen(); Cancel(); } else if (Input.GetMouseButtonUp(1)) { Cursor.SetCursor(null, Vector2.zero, CursorMode.ForceSoftware); Check = false; } if (MoveMode) { PathFinding.ClearRoute(Route); if (Physics.Raycast(ObjectReference.Camera.GetComponent <Camera>().ScreenToWorldPoint(Input.mousePosition), Vector3.forward, out Hit, 11)) { int MouseX = Hit.transform.parent.GetComponent <Tile>().XCor; int MouseY = Hit.transform.parent.GetComponent <Tile>().YCor; Route = PathFinding.FindPath(Selected.transform.parent.gameObject, Selected.transform.parent.gameObject, Tool.GetTile(MouseX, MouseY)); PathFinding.DrawRoute(Route); } } }
public void OnClickBlockAI() { if (turns == board.boardSizeX * board.boardSizeY) { return; } ai.usedBlock.Add(selectedBlock); ai.playerMoves.Add(selectedBlock); ai.moves.Clear(); ai.AIMove(); //Debug.Log (ai.moves [0].value); if (ai.moves.Count > 1) { selectedBlock = ai.moves [Random.Range(0, ai.moves.Count)]; } else { selectedBlock = ai.moves [0]; } turns++; selectedBlock.type = BlockType.ZERO; currentSprite = zero; selectedBlock.image.sprite = currentSprite; selectedBlock.button.interactable = false; ai.usedBlock.Add(selectedBlock); ai.aiMoves.Add(selectedBlock); if (CheckWin()) { return; } ChangePlayer(); if (turns == board.boardSizeX * board.boardSizeY) { StartCoroutine(Quit()); winner = "Draw"; } }