// 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 OnCollisionEnter2D(Collision2D col) { if (!(col.gameObject.CompareTag("Membrane"))) //반사막 생성 필살기로 생겨난 반사막을 제외하고 { bottleController.isSuperPowerAvailabe = false; //더 이상 초능력을 적용할 수 없음 if (gameObject.CompareTag("isActBottle")) { if (Time.timeScale != 1) { Time.timeScale = 1; Time.fixedDeltaTime = 0.02f * Time.timeScale; screenEffectController.shadowEffect.enabled = false; screenEffectController.screenEffectNum = 1; screenEffectController.psychoTime = 0.4f; usefullOperation.FadeOut(1, redAura.GetComponent <SpriteRenderer>()); psychokinesis.psychoAvailable = false; } gameObject.tag = "unActBottle";//태그 변경 freezeRange.SetActive(false); bottleSelectController.bottleSelected = false; bottleGenerator.GenerateBottleWithDelay(1); //딜레이를 주고 물병 생성 bottleSelectController.ReselectBottleWithDelay(1); //딜레이를 주고 물병 재선택 } } if (col.gameObject.GetComponent <PlaneTile>() != null) //물병이 planeTile에 부딛힌 경우 { PlaneTile planeTile = col.gameObject.GetComponent <PlaneTile>(); contactPlaneTile.Add(planeTile); var list = new List <PlaneTile>(); list.AddRange(rangePlaneTile); foreach (PlaneTile plane in list) { if (plane == planeTile) { transform.SetParent(plane.transform); break; } } } else if (col.gameObject.GetComponent <BottleCollision>() != null) //물병과 무딛혔을 경우 { BottleCollision bottle = col.gameObject.GetComponent <BottleCollision>(); var tempList = new List <BottleCollision>(); tempList.AddRange(bottle.bottleChain); bool brk = false; //아래 foreach문 탈출값. 아래 체계는 가능하면 수정하도록 한다. if (rangePlaneTile != null) //물병이 aboveRange에 들어오지 않을 정도로 쌓이는 경우는 추후 필요한 경우가 생기면 작업한다. { foreach (BottleCollision bottleCollision in tempList) { if (bottleCollision.contactPlaneTile != null) { foreach (PlaneTile plane in bottleCollision.contactPlaneTile) { foreach (PlaneTile plane1 in rangePlaneTile) { if (plane == plane1) //연쇄적으로 연결되어 있는 물병이 닿아 있는 planeTile과 본 물병이 range안에 들어가 있는 planeTile이 같은지의 여부를 확인 { transform.SetParent(plane.transform); break; //물병을 추가 하는건 한 번만 } } if (brk) { break; } } } if (brk) { break; } } } } else if (col.gameObject.CompareTag("floor")) { bottleController.onFloor = true; //물병이 바닥에 부딛힌 경우 } }
void Start() { planeTile = gameObject.GetComponentInParent <PlaneTile>(); bottles = GameObject.Find("Bottles"); }