// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.F)) { Vector3 sceneBombPosition = board.GetPlayers()[0].transform.position + board.GetPlayers()[0].transform.forward; Vector2 boardBombPosition = positionConverter.ConvertScenePositionToBoard(sceneBombPosition); explosionManager.PutBomb(player, player.remoteDetonationBonus ? bombPrefab : bombWithTimerPrefab, boardBombPosition); } else if (Input.GetKeyDown(KeyCode.Q) && player.remoteDetonationBonus) { explosionManager.DetonateBombs(player); } }
public void OnPostionChanged(Vector3 newPostion) { Vector2 boardPostion = positonConverter.ConvertScenePositionToBoard(newPostion); GameCell gameCell = board.GetGameCell(boardPostion); if (gameCell.Equals(currentCell)) { return; } if (currentCell != null) { currentCell.RemovePlayer(player); } currentCell = gameCell; gameCell.AddPlayer(player); }
private Exit CreateExit(ArrayList availableExits, ArrayList destructibleCubes, float cubeWidth, GameCell[,] cells, PositionConverter positionConverter) { int index = rnd.Next(0, availableExits.Count); Vector2 exitPostion = (Vector2)availableExits[index]; destructibleCubes.Remove(exitPostion); mazeExit.transform.localScale = new Vector3(cubeWidth / 10, 1f, cubeWidth / 10); Exit exit = CreateGameObject(exitPostion.x, 0.01f, exitPostion.y, mazeExit, "Exit"); exit.gameObject.GetComponent <Spin>().SetSpeed(GameManager.instance.GetExitSpinSpeed()); exit.gameObject.GetComponent <SphereCollider>().radius = cubeWidth / 10; Vector2 position = positionConverter.ConvertScenePositionToBoard(exit.transform.localPosition); cells[(int)position.x, (int)position.y].finding = exit; return(exit); }
private void CreateFindingObject(ArrayList destructibleCubes, float cubeWidth, GameCell[,] cells, PositionConverter positionConverter, AbstractFinding findingPrefab, int i, GameObject minimapFindingPrefab) { int index = rnd.Next(0, destructibleCubes.Count); Vector2 findingPostion = (Vector2)destructibleCubes[index]; destructibleCubes.Remove(findingPostion); AbstractFinding finding = CreateGameObject(findingPostion.x, cubeWidth / 4 + 0.5f, findingPostion.y, findingPrefab, "Fiding " + (i + 1)); finding.minimapObject = CreateGameObject(findingPostion.x, cubeWidth / 4 + 0.5f, findingPostion.y, minimapFindingPrefab, "MinimapFiding " + (i + 1)); finding.transform.localScale = new Vector3(cubeWidth / 4, cubeWidth / 4, cubeWidth / 4); finding.GetComponent <SphereCollider>().radius = cubeWidth / 4; finding.gameObject.GetComponent <Spin>().SetSpeed(GameManager.instance.GetFindingSpinSpeed()); FloatEffect floatEffect = finding.gameObject.GetComponent <FloatEffect>(); floatEffect.SetSpeed(GameManager.instance.GetFindingFloatSpeed()); floatEffect.SetDistance(GameManager.instance.GetFindingFloatDistance()); Vector2 position = positionConverter.ConvertScenePositionToBoard(finding.transform.localPosition); cells[(int)position.x, (int)position.y].finding = finding; }