예제 #1
0
        public EnemyTarget GetEnemy(Vector3 from)
        {
            EnemyTarget r       = null;
            float       minDist = float.MaxValue;

            for (int i = 0; i < enemyTargets.Count; i++)
            {
                float tDist = Vector3.Distance(from, enemyTargets[i].GerTarget().position);
                if (tDist < minDist)
                {
                    minDist = tDist;
                    r       = enemyTargets[i];
                }
            }
            return(r);
        }
예제 #2
0
        void Start()
        {
            health   = 10000;
            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;
        }