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;
}
↧