protected override void Awake() { base.Awake(); heart.enabled = false; if (gruntClips == null) { AudioList theList = (Resources.Load("Grunts") as AudioList); gruntClips = theList.clips; gruntIndices = new int[gruntClips.Length]; for (int i = 0; i < gruntIndices.Length; i++) { gruntIndices[i] = i; } PieceSpawner.SortInPlaceRandom(gruntIndices); } if (scoreClips == null) { AudioList theList = (Resources.Load("ScoreSounds") as AudioList); scoreClips = theList.clips; scoreIndices = new int[scoreClips.Length]; for (int i = 0; i < scoreIndices.Length; i++) { scoreIndices[i] = i; } PieceSpawner.SortInPlaceRandom(scoreIndices); } sleepCountdown.fillAmount = 0; }
public void GetNewPiece() { if (CurrentPiece != null || GameManager.State != GameState.Playing) { return; } acceleration = 1f; var curPos = controller.position; curPos.x = initialX; controller.position = curPos; CurrentPiece = PieceSpawner.SpawnPieceForAI(); decal.size = new Vector2((CurrentPiece.transform.rotation.eulerAngles.z == 90 || CurrentPiece.transform.rotation.eulerAngles.z == 270) ? CurrentPiece.size.y : CurrentPiece.size.x, decal.size.y); CurrentPiece.MyRigidBody.mass = 1; CurrentPiece.transform.SetParent(controller, false); CurrentPiece.transform.position = spawnPoint.position; CurrentPiece.onCollisionCallback.AddListener(ClearCurrentPiece); CurrentPiece.onCollisionCallback.AddListener(GetNewPiece); Analyze(); }
private void CreateBoard() { currentGameState = GameState.InGame; var pieceSpawner = new PieceSpawner(); var board = Board.Create(boardDefinition, pieceSpawner); _boardRenderer.Initialize(board); }
void Start() { GetTilesPosition5x4(); TilesColors.TilesColor(_colorSwitch, blocksHandlerGo.GetComponent <BlockHandler>()); PieceSpawner.GetEnemiesInChunk(); }
private void Awake() { if (Instance != null) { Destroy(Instance.gameObject); } Instance = this; piecePools = new List <Pool>(piecePoolsContainer.GetComponentsInChildren <Pool>()); InGamePieces = new List <Piece>(); }
private static AudioClip GetNextScoreClip() { int index = scoreIndices[currentScoreIndex]; currentScoreIndex++; if (currentScoreIndex >= scoreIndices.Length) { currentScoreIndex = 0; PieceSpawner.SortInPlaceRandom(scoreIndices); } return(scoreClips[index]); }
private static AudioClip GetNextGruntClip() { int index = gruntIndices[currentGruntIndex]; currentGruntIndex++; if (currentGruntIndex >= gruntIndices.Length) { currentGruntIndex = 0; PieceSpawner.SortInPlaceRandom(gruntIndices); } return(gruntClips[index]); }
// Use this for initialization void Start() { spawner = FindObjectOfType <PieceSpawner>(); playBoard = FindObjectOfType <Board>(); piecesManager = FindObjectOfType <PiecesManager>(); board = new bool[40, 40]; board[20, 20] = true; board[19, 20] = true; board[20, 19] = true; board[19, 19] = true; for (int i = 0; i <= 9; i++) { for (int j = 0; j <= 9; j++) { board[j, 30 + i] = true; board[j, i] = true; board[39 - j, 30 + i] = true; board[39 - j, i] = true; } } }
void Awake() => instance = this;
void Awake() { actionRef = gameObject.GetComponent <Action>(); pieceSpawnerRef = GameObject.Find("PieceSpawner").GetComponent <PieceSpawner>(); }