private void OnTriggerStay2D(Collider2D other) { if (canCollect == true && other.gameObject.tag == "coin") { instantiateCoin.destroyCoin(); instantiateCoin.setCanInstantiate(true); main.setCoins(); isSuccessed = true; } }
IEnumerator InviseCoin(float time, float waitTime) { yield return(new WaitForSeconds(time)); for (int i = 0; i < 3; i++) { objRenderer.color = new Color(objRenderer.color.r, objRenderer.color.g, objRenderer.color.b, 0f); yield return(new WaitForSeconds(waitTime)); objRenderer.color = new Color(objRenderer.color.r, objRenderer.color.g, objRenderer.color.b, 1f); yield return(new WaitForSeconds(waitTime)); } InstantiateCoin instantiate = gameObject.GetComponentInParent <InstantiateCoin>(); instantiate.setCanInstantiate(true); instantiate.GetComponentInParent <InstantiateCoin>().instantiateCoin(); instantiate.GetComponentInParent <InstantiateCoin>().addAttempts(); instantiate.setStage(); instantiate.destroyCoin(); }
public void setStage(bool isClick) { if (stage == 3 && !isClick) { stage = 1; if (ball.getSuccessed() == false) { instantiateCoin.destroyCoin(); } instantiateCoin.instantiateCoin(); instantiateCoin.setCanInstantiate(false); horizontalSlider.transform.position = new Vector3(horizontalPoints[0].position.x, horizontalPoints[0].position.y, horizontalSlider.transform.position.z); verticalSlider.transform.position = new Vector3(vertcalPoints[0].position.x, vertcalPoints[0].position.y, verticalSlider.transform.position.z); } if (stage != 3 && isClick) { stage++; } }