/// <summary> /// Start effect /// </summary> private void BunnyEffect() { if (block == null) { Debug.Log("Special blog effect null"); return; } block.transform.GetChild(0).gameObject.SetActive(true); Block[] blocksInRow = BoardManager.instance.GetRow(block.y); foreach (Block blockEntry in blocksInRow) { blockEntry.SetState(BlockState.Selected); if (SpecialBlock.IsSpecialBlock(blockEntry) && block != blockEntry && !specialBlocks.Contains(block)) { AddSpecialBlock(blockEntry); } if (!Block.IsSpecialBlock(blockEntry)) { if (!blocks.Contains(blockEntry)) { blocks.Add(blockEntry); } } } //Kich hoat am thanh if (SoundManager.instance != null) { SoundManager.instance.PlaySFX(SFX.BUNNY); } block.transform.GetComponentInChildren <BunnyAniControl>().SetRun(this); }
public StmtCil(Ctx ctx, IEnumerable<Instruction> insts, Stmt endCil, SpecialBlock blockType = SpecialBlock.Normal) : base(ctx) { this.Insts = insts; this.BlockType = blockType; this.EndCil = endCil; this.StartStackSize = 0; this.EndStackSize = 0; }
public StmtCil(Ctx ctx, IEnumerable <Instruction> insts, Stmt endCil, SpecialBlock blockType = SpecialBlock.Normal) : base(ctx) { this.Insts = insts; this.BlockType = blockType; this.EndCil = endCil; this.StartStackSize = 0; this.EndStackSize = 0; }
/// <summary> /// This function is used to track the amount of time since the last special block was assigned. /// If the cooldown has passed, then a new special block can be assigned. /// </summary> /// <param name="initial"></param> /// <param name="powerNum"></param> /// <returns></returns> IEnumerator CooldownSB(bool initial, int powerNum = -1) { int counter = 0; if (initial) { counter = cooldownSB; while (counter > 0) { yield return(new WaitForSeconds(1)); counter--; if (counter < 1) { putSpecialBlock = true; } } } else { counter = 5; while (counter > 0) { yield return(new WaitForSeconds(1)); counter--; if (counter < 1) { if (powerNum == 0) { power0used = false; power0Script = null; power0Num = -1; } if (powerNum == 1) { power1used = false; power1Script = null; power1Num = -1; } if (powerNum == 2) { power2used = false; power2Script = null; power2Num = -1; } } } } }
void SpecialBlock(int blockIndex, int powerChoice) { GameObject block = blocks[blockIndex]; //Activates special block based on block and powerup chosen if (powerChoice == 0) { power0Script = block.transform.GetChild(0).gameObject.GetComponent <SpecialBlock>(); power0Script.choice = powerChoice; power0Script.blockActivated = true; power0Script.enabled = true; power0Num = blockIndex; power0used = true; } else if (powerChoice == 1) { power1Script = block.transform.GetChild(0).gameObject.GetComponent <SpecialBlock>(); power1Script.choice = powerChoice; power1Script.blockActivated = true; power1Script.enabled = true; power1Num = blockIndex; power1used = true; } else if (powerChoice == 2) { power2Script = block.transform.GetChild(0).gameObject.GetComponent <SpecialBlock>(); power2Script.choice = powerChoice; power2Script.blockActivated = true; power2Script.enabled = true; power2Num = blockIndex; power2used = true; } if (powerChoice != -1) { // Cooldown putSpecialBlock = false; StartCoroutine(CooldownSB(true)); } }
private void BirdEffect(SpecialBlock block) { // Random blocktype BlockType blockType = RandomBlockType(); birdEffects = new List <BirdEffect>(); this.block = block; //Kich hoat am thanh if (SoundManager.instance != null) { SoundManager.instance.PlaySFX(SFX.BIRD_FLY); } for (int i = 0; i < BoardManager.instance.width; i++) { for (int j = 0; j < BoardManager.instance.height; j++) { Block blockEntry = BoardManager.instance.GetBlock(i, j); if (blockEntry.type == blockType) { blocks.Add(blockEntry); blockEntry.SetState(BlockState.Selected); GameObject go = GameObject.Instantiate(block.effectPrefab, startPosition, Quaternion.identity) as GameObject; BirdEffect effect = go.GetComponent <BirdEffect>(); effect.target = blockEntry; effect.onDestroy = OnBirdEffectDestroyed; birdEffects.Add(effect); } } } //Kich hoat am thanh Debug.Log("So luong quan: " + blocks.Count); if (SoundManager.instance != null) { SoundManager.instance.PlaySFX(SFX.BIRD_PERCHE); } }
/* * PuppyEffect(): Hieu ung chay cua cho con * Input: block cho con * Output: void * */ private void PuppyEffect(Block block) { this.block = block; //block.transform.GetChild(0).gameObject.SetActive(true); int row = block.y; int col = block.x; for (int i = row - 1; i <= row + 1; ++i) { for (int j = col - 1; j <= col + 1; ++j) { if (i >= 0 && j >= 0 && i < boardManager.width && j < boardManager.height) { Block b = boardManager.GetBlock(i, j); b.SetState(BlockState.Selected); if (SpecialBlock.IsSpecialBlock(b) && b != block && !specialBlocks.Contains(b)) { AddSpecialBlock(b); } if (!SpecialBlock.IsSpecialBlock(b)) { if (!blocks.Contains(b)) { blocks.Add(b); } } } } } //Kich hoat am thanh if (SoundManager.instance != null) { SoundManager.instance.PlaySFX(SFX.DOG); } }
// 배경을 선택, 파트별 배경 리스트 중 순서를 결정 // 선택되었으면 partData -> subPartData에 저장한다. private void QueueBGInstToSubPart(Part part) { int bgSeq; int bgSeq_temp; // bgSeq를 다시 뽑을 때 사용되는 임시 변수 if (string.Equals(curMapData.mapName, "Tokyo")) { for (int i = 0; i < curMapData.partBGCount[(int)part]; i++) // 파트 내 생성될 BG 개수만큼 { // 몇 번째 배경을 뽑을 지 결정 (bgSequence) bgSeq = Random.Range(0, SingleBGControl.instance.curBG.bgListByPart[(int)part].bgByPart.Count); if (Equals(part, Part.A)) { if (bgSeq == 0) { SpecialBlock sb = new SpecialBlock(); sb.block = curMapData.specialBlockData[0].block; // 0번은 Tokyo 전용(plane_non_gimmick) sb.part = part; sb.pos = bgPos + 3; specialBlockList.Add(sb); } if (i == curMapData.partBGCount[(int)part] - 1) // 맨 끝에는 파트 B에 대비해 non_gimmick을 2개 만든다 { for (int j = 0; j < 2; j++) { SpecialBlock sb = new SpecialBlock(); sb.block = curMapData.specialBlockData[0].block; // 0번은 Tokyo 전용(plane_non_gimmick) sb.part = part; sb.pos = bgPos + j + 4; specialBlockList.Add(sb); } } } else if (Equals(part, Part.B)) { if (i == 0) { bgSeq = 0; // tunnel_start SpecialBlock sb = new SpecialBlock(); sb.block = curMapData.specialBlockData[0].block; // 0번은 Tokyo 전용(plane_non_gimmick) sb.part = part; sb.pos = bgPos; specialBlockList.Add(sb); } else if (i == curMapData.partBGCount[(int)part] - 1) { bgSeq = 2; // tunnel_end for (int j = 0; j < 2; j++) { SpecialBlock sb = new SpecialBlock(); sb.block = curMapData.specialBlockData[0].block; sb.part = part; sb.pos = bgPos + j + 5; // bg시작 좌표 + 375 specialBlockList.Add(sb); } } else { bgSeq = 1; // tunnel_mid } } // 뽑을 배경 리스트 입력 BGPool bgPool = null; while (true) { for (int j = 0; j < MAX_BG_COUNT; j++) { // bgPool에 등록된 배경 중 종류(bgSeq, part)가 같고, SubPartData에 넣지 않은(!isQueued) 배경을 찾는다. bgPool = mapPool.bgPool.Find(x => x.bgSequence == bgSeq && x.part == part && x.isQueued == false); // id도 체크 필요 if (bgPool != null) { bgPool.isQueued = true; // queue 되었음 체크 break; } } // BG를 생성하려 하는데 pool에 없을 경우 다른 BG를 뽑기 위해 다시 랜덤값 생성 if (bgPool == null) { bgSeq_temp = bgSeq; while (true) { bgSeq = Random.Range(0, SingleBGControl.instance.curBG.bgListByPart[(int)part].bgByPart.Count); if (bgSeq == bgSeq_temp) { continue; } else { break; } } } else { break; } } SubPartData subPartData = new SubPartData(); subPartData.bgSequence = bgPool.bgSequence; subPartData.bgID = bgPool.id; subPartData.part = part; subPartData.bgCount = bgCount; subPartData.bgPos = bgPos; partData[(int)part].subPartData.Add(subPartData); bgCount++; bgPos = bgPos + 6; } } }