private void Start() { currentIndex = new Vector2Int(1, 0); // Start in middle lane renderQuad = GetComponent <RenderQuad>(); renderQuad.laneWidth = board.laneWidth; renderQuad.rowHeight = board.rowHeight; renderQuad.Render(transform.position); transform.position = board.GetPosition(currentIndex); audioSource = gameObject.AddComponent <AudioSource>(); }
public void Initialize(BoardManager board, Vector2Int currentIndex) { this.board = board; this.currentIndex = currentIndex; renderQuad = GetComponent <RenderQuad>(); renderQuad.laneWidth = board.laneWidth; renderQuad.rowHeight = board.rowHeight; renderQuad.SetColor(this.flavor.color); renderQuad.Render(transform.position); transform.position = board.GetPosition(currentIndex); collider = gameObject.AddComponent <BoxCollider2D>(); collider.size = new Vector3(renderQuad.laneWidth / 2.5f, renderQuad.rowHeight / 2.5f, 0); scoopIndicator = (ScoopIndicator)GetComponentsInChildren <ScoopIndicator>()[0]; scoopIndicator.SetIncomingFlavor(flavor); scoopIndicator.SetPosition(board.GetPosition(new Vector2Int(currentIndex.x, board.numberOfRows - 1))); BoardManager.FreezeGame += FreezeScoop; BoardManager.UnfreezeGame += UnfreezeScoop; }