internal void Swipe(int v) { if (currentBlock.damageState) { currentBlock.Repair(); Instantiate(swipeParticles[v], currentBlock.transform.position, Quaternion.identity); swiperAudio.PlayOneShot(swipeClips[currentBlock.buildStatus]); } else if (currentBlock.buildStatus < currentBlock.buildMax) { if (v == currentBlock.buildSequence[currentBlock.buildStatus]) { Instantiate(swipeParticles[v], currentBlock.transform.position, Quaternion.identity); swiperAudio.PlayOneShot(swipeClips[currentBlock.buildStatus]); currentBlock.Progress(); if (currentBlock.buildStatus == currentBlock.buildMax) { spriteRenderer.sprite = swipes[4]; } else { spriteRenderer.sprite = swipes[currentBlock.buildSequence[currentBlock.buildStatus < currentBlock.buildSequence.Length ? currentBlock.buildStatus : currentBlock.buildMax - 1]]; } } else { currentBlock.Damage(); swiperAudio.PlayOneShot(swipeClips[4]); spriteRenderer.sprite = swipes[currentBlock.buildSequence[currentBlock.buildStatus < currentBlock.buildSequence.Length ? currentBlock.buildStatus : currentBlock.buildMax - 1]]; } } }
void OnCollisionEnter2D(Collision2D col) { if (bdone) { return; } bdone = true; TowerBlock block = col.collider.gameObject.GetComponent <TowerBlock>(); if (block != null) { block.Damage(); } Instantiate(corpse, transform.position, Quaternion.identity); Destroy(gameObject); }