public EnemyTarget GetEnemyTarget(Vector3 from) { EnemyTarget r = null; float minDis = float.MaxValue; for (int i = 0; i < enemyTargets.Count; i++) { float tDis = Vector3.Distance(from, enemyTargets[i].GetTarget().position); if (tDis < minDis) { minDis = tDis; r = enemyTargets[i]; } } return(r); }
// Use this for initialization void Start() { health = 100; anim = GetComponentInChildren <Animator>(); enTarget = GetComponent <EnemyTarget>(); enTarget.Init(this); rigid = GetComponent <Rigidbody>(); a_hook = anim.GetComponent <AnimatorHook>(); if (a_hook == null) { a_hook = anim.gameObject.AddComponent <AnimatorHook>(); } a_hook.Init(null, this); InitRagdoll(); parryIsOn = false; }