//------------------------------------------------------------------------------------------------------------------ // A aranha morre //------------------------------------------------------------------------------------------------------------------ public void die(){ if(dead) return; dead = true; collider2D.enabled = false; soundToPlay = SpiderSound.death; audio.volume = ApplicationModel.SaveData.Volume; if(audio.clip != roarAudio) audio.clip = roarAudio; audio.pitch = 1.0f; audio.Play(); }
//------------------------------------------------------------------------------------------------------------------ // Exibe o emoticon Wut //------------------------------------------------------------------------------------------------------------------ void callWut(){ if(wuted) return; soundToPlay = SpiderSound.wut; Instantiate(wut,transform.position + new Vector3(0,0.5f,0),Quaternion.identity); wuted = true; }
//------------------------------------------------------------------------------------------------------------------ // A aranha atira no jogador //------------------------------------------------------------------------------------------------------------------ void shootAtPlayer(){ if(++shotCooldownCount >= shotCooldown) shotCooldownCount = 0; if(shotCooldownCount<= 0){ bulletType.GetComponent<Gunshot>().copyBullet( bulletSpawner.transform.position, spiderArm.transform.localEulerAngles.z, (int)Mathf.Sign(transform.localScale.x)<0 ); soundToPlay = SpiderSound.gunshot; } }
//------------------------------------------------------------------------------------------------------------------ // Exibe o emoticon Hey //------------------------------------------------------------------------------------------------------------------ void callHey(){ if(heyed) return; soundToPlay = SpiderSound.hey; Instantiate(hey,transform.position + new Vector3(0,0.5f,0),Quaternion.identity); heyed = true; }
//------------------------------------------------------------------------------------------------------------------ // Toca o som pertinente ao momento //------------------------------------------------------------------------------------------------------------------ void playSound(){ switch(soundToPlay){ case SpiderSound.gunshot: if(audio.clip != shootingAudio) audio.clip = shootingAudio; audio.pitch = Random.Range(1.0f,2.0f); audio.volume = ApplicationModel.SaveData.Volume; audio.Play(); break; case SpiderSound.hey: if(audio.clip != emoticonAudio) audio.clip = emoticonAudio; audio.volume = ApplicationModel.SaveData.Volume; audio.pitch = Random.Range(2.0f,3.0f); audio.Play(); break; case SpiderSound.wut: if(audio.clip != emoticonAudio) audio.clip = emoticonAudio; audio.volume = ApplicationModel.SaveData.Volume; audio.pitch = Random.Range(0.5f,1.5f); audio.Play(); break; } soundToPlay = SpiderSound.nothing; }