- Home /
Question by
convictcartel · Apr 08, 2014 at 11:18 PM ·
enemydamageapply
ApplyDamage Error
I am trying to get my MecaAnim character to attack my player, so far ive got it to work but the problem I cant figure out is that im only getting damaged when im behind the enemy.. help please lol
float distance = Vector3.Distance(shootTarget.position, myTransform.position);
// If close enought to shoot a laser beam in the target person
if (distance <= shootDistance)
{
shootTarget.gameObject.SendMessage("ApplyDamage", 5.0F);
int rand = UnityEngine.Random.Range(0, 50);
animator.SetBool(AttackParameterName, rand == 20);
idleAfterShootingTimeCounter = idleTimeAfterShooting;
}
Comment
Your answer
Follow this Question
Related Questions
Damaging Enemy strangely not working. 0 Answers
Health below zero but shows negative numbers 1 Answer
Object Not Recieving Damage 3 Answers
Staged bullet damage? 1 Answer
One enemy triggers all the enemies 2 Answers