示例#1
0
    private float[] enemysDistance; //獲取所有敵人的距離

    public void Start()
    {
        //抓取有此物件的物件
        gm = FindObjectOfType <LevelManager>();

        hpDamage = GetComponentInChildren <HpDamage>(); //取得子物件的元件 (僅限於子物件只有一個)
    }
示例#2
0
    private void Start()
    {
        ani   = GetComponent <Animator>();
        agent = GetComponent <NavMeshAgent>();

        agent.speed            = data.speed;
        agent.stoppingDistance = data.stopDistance;

        hp = data.hp;

        targe    = GameObject.Find("Hero").transform;
        hpDamage = GetComponentInChildren <HpDamage>(); //取得子物件的元件 (僅限於子物件只有一個)
    }