public void SetUp(GameplayUIController gameUI) { gameScreen = gameUI; data = new DataHolder[4]; for (int i = 0; i < data.Length; i++) { data[i] = new DataHolder(i); } mappings = new int[4] { 0, 1, 2, 3 }; if (NetworkManager.instance) { networkID = NetworkManager.instance.GetId(); entities[networkID].border.SetActive(true); //NetworkManager.instance.GetPlayerOfID(networkID).GetComponent<Winner>().BecomeWinner(true); //remove crown for now since it breaks networking } else { entities[0].border.SetActive(true); } CheckOrder(); }
public static void Setup(int intialLevel = 1) { instance.currentLevel = intialLevel; matrix = new Block[ instance.dimensions.x, instance.dimensions.y ]; instance.transform.position = new Vector3( (instance.dimensions.x / 2f) - .5f, (instance.dimensions.y / 2f) - .5f, .5f ); instance.transform.localScale = new Vector3( instance.dimensions.x, instance.dimensions.y, 1 ); instance.GetComponent <Renderer>().material.SetTextureScale( "_MainTex", instance.dimensions ); instance.gravity = GameData.GetGravityForLevel(instance.currentLevel); instance.rowsRequired = 10 * instance.currentLevel; GameplayUIController.UpdateLevel(); instance.FillBag(); instance.SetNextTetramino(); }
public void Init(GameplayUIController p) { parent = p; anim = GetComponent <Animator>(); gameObject.SetActive(false); }
void Start() { thisWaveEnemyData = Instantiate(enemyData); thisWaveEnemyAttributes = ThisWaveEnemyData.EnemyAttributes; gameplayUiController = GameInstance.Instance.gameplayUiController; }
void LevelUp() { currentLevel++; gravity = GameData.GetGravityForLevel(currentLevel); clearedRowsCount -= 10; rowsRequired = 10; GameplayUIController.UpdateLevel(); SoundController.PlaySfx(GameData.GetAudioClip("Level Up")); }
private void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); return; } }
public static void Score(int rowsCleared) { rowsCleared = (int)Mathf.Clamp( rowsCleared - 1, 0, instance.scorePerRows.Length - 1 ); int scored = instance.scorePerRows[rowsCleared] * PlayfieldController.instance.currentLevel; saveData.score += scored; GameplayUIController.ShowScored(scored); if (saveData.score > saveData.highscore) { saveData.highscore = saveData.score; } }
public static void ClearRows() { List <Block> cleared = new List <Block>(); int rowsCleared = 0; for (int y = 0; y < instance.dimensions.y; ++y) { cleared.Clear(); for (int x = 0; x < instance.dimensions.x; ++x) { if (matrix[x, y]) { cleared.Add(matrix[x, y]); if (rowsCleared > 0) { matrix[x, y - rowsCleared] = matrix[x, y]; matrix[x, y - rowsCleared].SetPosition( new Vector2Int(x, y - rowsCleared) ); matrix[x, y] = null; } } } if (cleared.Count == instance.dimensions.x) { cleared.ForEach(block => Destroy(block.gameObject)); rowsCleared++; } } if (rowsCleared > 0) { GameController.Score(rowsCleared); GameplayUIController.UpdateScore(); SoundController.PlaySfx(GameData.GetAudioClip("Clear")); instance.clearedRowsCount += rowsCleared; } }
private void Awake() { ins = this; }
public static void GameOver() { GameplayUIController.ShowGameOver(); SoundController.PlaySfx(GameData.GetAudioClip("Top out")); instance.currentTetromino = null; }