void Update() { //Make sure we are in the correct GameScreen if (IsActive == false) { return; } if (_bits.Count <= 0) { return; } if (!Inpt.Down()) { return; } var randomIndex = Random.Range(0, _bits.Count); var bit = _bits[randomIndex]; _bits.RemoveAt(randomIndex); bit.GetComponent <SpriteRenderer>().sortingOrder = 10; var rb = bit.AddComponent <Rigidbody2D>(); var rX = Random.Range(-5f, 5f); var rY = Random.Range(-5f, 5f); rb.AddForce(new Vector2(rX, rY), ForceMode2D.Impulse); }
private void StepByStepPixel() { if (_currentSteps >= _map.Count) { return; } if (!Inpt.Down()) { return; } var pixel = _map[_currentSteps]; var buildPixel = Instantiate(BuildPixelPrefab, Vector3.zero, Quaternion.identity); buildPixel.GetComponent <Bixel>().Init(pixel.Color, pixel.Position, transform); _currentSteps++; if (_currentSteps >= _map.Count) { Morph(); } }
private void RandomPixel() { if (_map.Count <= 0) { return; } if (!Inpt.Down()) { return; } var randomIndex = Random.Range(0, _map.Count); var pixel = _map[randomIndex]; _map.RemoveAt(randomIndex); var buildPixel = Instantiate(BuildPixelPrefab, Vector3.zero, Quaternion.identity); buildPixel.GetComponent <Bixel>().Init(pixel.Color, pixel.Position, transform); if (_map.Count <= 0) { Morph(); } }