Example #1
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.tag == Tags.playerBox)
        {
            BoxEnemyChoice weaponEnemyChoice = other.gameObject.GetComponent <BoxEnemyChoice>();
            //string result = RockPaperScissors.WeaponResult(weaponCollision.weaponType, enemyType);

            if (weaponEnemyChoice.weaponType == enemyType)
            {
                gameControllerScoreScript.addScore(enemyPoints, enemyIndex);
                //animator.SetBool(animatorHash.dead, true);
                weaponEnemyChoice.KilledEnemy();

                if (transform.localScale == vectorUnScaled)
                {
                    if (!AudioManager.getIsPlaying(deathAudio.ToString()))
                    {
                        AudioManager.PlaySound(deathAudio.ToString(), Vector3.zero);
                    }
                }
                if (useSparkles)
                {
                    sparklesPooler.UsePooledObject(transform.position, Quaternion.identity);
                }

                gameObject.SetActive(false);
            }
            else
            {
                //gameControllerScoreScript.subtractScore(0);
                ////Destroy(gameObject);
                AudioManager.PlaySound(AudioNames.PlayerDraw.ToString(), Vector3.zero);
                gameObject.SetActive(false);
            }
            enemyCollider2d.enabled = false;
        }
    }
Example #2
0
 public static string GetFileName(AudioNames audioname)
 {
     int num = (int) audioname + 1;
     if (num >= 6) num++;
     return string.Format("{0:00}-", num) + audioname.ToString();
 }
Example #3
0
 public override void ExecuteEvents()
 {
     AudioManager.PlaySound(audio.ToString(), Vector3.zero);
 }
Example #4
0
 public void PlayTheAudio()
 {
     AudioManager.PlaySound(audioToPlay.ToString(), transform.position);
 }
Example #5
0
 public void MakeSoundCopy()
 {
     audioCopiedObject = AudioManager.CopySound(audioToCopy.ToString(), transform);
     audioSourceCopied = audioCopiedObject.GetComponent <AudioSource>();
 }