private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "bgCollider") { isCollider = true; target = collision.GetComponent <BottleController>(); } }
// Update is called once per frame void Update() { if (targetObject.Count > 0) { for (int i = targetObject.Count - 1; i >= 0; i--) //리스트의 마지막 요소부터 검사 { if (targetObject[i].fadeOut) { targetObject[i].color.a -= 4 * Time.deltaTime; //약 0.25초동안 페이드 아웃 효과 targetObject[i].spriteRenderer.color = targetObject[i].color; if (targetObject[i].color.a < 0) { switch (targetObject[i].statusCase) { case 0: //오브젝트 상태 유지 break; case 1: targetObject[i].spriteRenderer.gameObject.SetActive(false); break; case 2: BottleController bottleController = targetObject[i].spriteRenderer.gameObject.GetComponent <BottleController>(); if (bottleController != null) { bottleController.DestroyBottle(); } else { Destroy(targetObject[i].spriteRenderer.gameObject); } break; } targetObject.RemoveAt(i); } } else if (targetObject[i].fadeIn) { targetObject[i].color.a += 4 * Time.deltaTime; //약 0.25초동안 페이드 인 효과 targetObject[i].spriteRenderer.color = targetObject[i].color; if (targetObject[i].color.a > 1) { targetObject.RemoveAt(i); } } else if (targetObject[i].shakeTime > 0) { targetObject[i].transform.position = Random.insideUnitSphere * targetObject[i].shakeAmount + targetObject[i].initialPosition; targetObject[i].shakeTime -= Time.deltaTime; if (targetObject[i].shakeTime < 0) { targetObject[i].transform.position = targetObject[i].initialPosition; targetObject.RemoveAt(i); } } } } }
protected virtual void OnCollisionExit2D(Collision2D coll) { BottleController _bottle = coll.gameObject.GetComponent <BottleController> (); if (_bottle != null) { _bottle.EnableThrow = false; } }
protected virtual void OnCollisionEnter2D(Collision2D coll) { BottleController _bottle = coll.gameObject.GetComponent <BottleController> (); if (_bottle != null) { _bottle.EnterObstacle(); } }
void Start() { bottleSelectController = GameObject.Find("BottleManager").GetComponent <BottleSelectController>(); bottleGenerator = GameObject.Find("BottleManager").GetComponent <BottleGenerator>(); padStrength = GameObject.Find("Pad_Strength").GetComponent <PadStrength>(); bottleController = GameObject.FindWithTag("isActBottle").GetComponent <BottleController>(); //NEW: 처음에 시작할 때 태그로 찾아줘야 함 thisBottleCollision = gameObject.GetComponent <BottleCollision>(); usefullOperation = GameObject.Find("GameResource").GetComponent <UsefullOperation>(); redAura = transform.Find("RedAura").gameObject; freezeRange = transform.Find("FreezeRange").gameObject; screenEffectController = GameObject.Find("Main Camera").GetComponent <ScreenEffectController>(); psychokinesis = GameObject.Find("Player").GetComponent <Psychokinesis>(); bottleChain.Add(thisBottleCollision); //체인과 같이 연속적으로 이어진 물병들의 리스트에는 자신도 포함한다 }
// Increase number of complete mission public void CountCompleteMission() { // If complete mission number is smaller than tartget number if (CompleteMissionNumber < StageData.GoalNumber) { switch (StageData.MissionIndexNumber) { case 0: completeMissionNumber = BottleController.CountStandingBottle(); break; case 3: completeMissionNumber = PlaneTile.CountStandingBottleOnPlaneTile(); break; } } }
void OnTriggerEnter2D(Collider2D other) { if (this.HasChecked) { return; } BottleController _bottle = other.GetComponent <BottleController> (); if (_bottle != null) { this.HasChecked = true; StartCoroutine(OnTriggerEnterCoroutine()); } }
void Awake() { bottle = transform.parent.GetComponentInChildren<BottleController> (); }
private float zRotation; //물병의 z회전값 // Start is called before the first frame update void Start() { bottleController = transform.parent.gameObject.GetComponent <BottleController>(); }
public void Avtivate(int key, BottleController bottleController) //upside에 맞았으면 1이, downside에 맞았으면 -1이 전달된다. { bottleController.rb.velocity = key * membraneDirection * presentStrength; //물병 튕겨냄 }
void Awake() { bottle = transform.parent.GetComponentInChildren <BottleController> (); }