public void PerformNoiseAttack(Player target) { if (this.currAttackType == AttackType.None) { EnvironmentElement currEnvElement = gameManagerRef.getActiveEnvElement(); GameObject sound = GameObject.FindGameObjectWithTag("Audio"); AudioSource aux1 = sound.GetComponent <AudioSource>(); var aux = Resources.Load("Loud Noise") as AudioClip; aux1.PlayOneShot(aux); int damage = 10; if (target.currAttackType == AttackType.Aerial || currEnvElement.GetType() == EnvElementType.Car) { damage = 0; } else if (currEnvElement.GetType() == EnvElementType.Girl) { this.AddReputation(10); damage = 10; } else if (currEnvElement.GetType() == EnvElementType.Swagger) { this.RemoveReputation(10); damage = 0; } this.currAttackType = AttackType.Noise; isAttacking = true; this.noiseAttackSprite.SetActive(true); gameManagerRef.StartCoroutine(FinishAttack(noiseAttackSprite, damage, target)); } }
//attack methods public void PerformAerialAttack(Player target) { if (this.currAttackType == AttackType.None) { bool success = IsSuccess(); if (success) { this.currAttackType = AttackType.Aerial; GameObject randSprite = this.aerialAttackSprites[Random.Range(0, aerialAttackSprites.Count)]; randSprite.SetActive(true); if (target.currAttackType == AttackType.Bird) { gameManagerRef.StartCoroutine(FinishAttack(randSprite, 0, target)); } else { gameManagerRef.StartCoroutine(FinishAttack(randSprite, 10, target)); } } else { EnvironmentElement currEnvElement = gameManagerRef.getActiveEnvElement(); this.currAttackType = AttackType.AerialFail; GameObject randSprite = this.aerialAttackFailSprites[Random.Range(0, aerialAttackFailSprites.Count)]; randSprite.SetActive(true); gameManagerRef.StartCoroutine(FinishAttack(randSprite, 0, target)); if (currEnvElement.GetType() == EnvElementType.Car || currEnvElement.GetType() == EnvElementType.Girl || currEnvElement.GetType() == EnvElementType.Swagger) { this.RemoveReputation(10); } } } }