public void StartMerge(Transform MergeTransform, PlatletManager manager, bool small) { MergeReady = false; ChangeToMergeSprite(); toggleCollider(true); StartCoroutine(GoToMerger(MergeTransform, manager, small)); }
IEnumerator GoToMerger(Transform merger, PlatletManager manager, bool small) { Vector2 currentPos = transform.position; RB.velocity = Vector3.zero; while (!(Vector2.Distance(currentPos, merger.position) < 0.3f)) { transform.position = Vector2.MoveTowards(transform.position, merger.position, 2 * Time.deltaTime); currentPos = transform.position; yield return(null); } merger.localScale = new Vector2(merger.localScale.x * 1.1f, merger.localScale.y * 1.1f);; mySpriteRender.enabled = false; Debug.Log("Arrived"); AudioManager.Instance.Play("MergeBubble"); MergeReady = true; toggleCollider(false); manager.CheckIfMergeisDone(small, merger.gameObject); }
public void CustomStart() { if (gameManager == null) { gameManager = GameManager.gameManager; } organManager = gameManager.organManager; myOrganViewAnimation = transform.GetComponent <OrganView_UI_Animation>(); plateletManager = FindObjectOfType <PlatletManager>(); organDispalyInfo = FindObjectOfType <OrganInfo>(); plateletManager.CustomStart(); UpdateUnlockedOrgans(); UpdateOrgans(); UpdateButtons(); SetOrganIndicator(); UpdateNewOrganUI(); AudioManager.Instance.Play("Music"); }