コード例 #1
0
ファイル: EnemyManager.cs プロジェクト: alanw777/souls-like
        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);
        }
コード例 #2
0
ファイル: EnemyStates.cs プロジェクト: alanw777/souls-like
        // 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;
        }