// Start is called before the first frame update
    void Start()
    {
        Player = GameObject.FindGameObjectWithTag("Player");
        Enemy  = transform.root.gameObject;

        animator = Enemy.GetComponent <Animator>();

        Canvas = GameObject.FindGameObjectWithTag("Canvas");

        PSButton  = Canvas.transform.Find("PistolShootButton").Find("PSButton");
        lbbScript = PSButton.GetComponent <LiveBulletOnButton>();

        Camera   = GameObject.FindGameObjectWithTag("MainCamera");
        lbScript = Camera.GetComponent <LiveBullet>();

        agent = Enemy.GetComponent <NavMeshAgent>();

        foundPlayer   = false;
        warningPlayer = false;

        SetDestinationRandomly();

        randomCountD1 = Random.Range(2f, 4f);   //Battle時に移動する時間
        randomCountD2 = Random.Range(2f, 5f);   //Battle時にアイドルする時間

        randomCountF1 = Random.Range(2f, 4f);   //発砲時のインターバル
        randomCountF2 = Random.Range(1f, 2.5f); //発砲時間

        audioSources = transform.GetComponents <AudioSource>();

        gocScript = GameObject.FindGameObjectWithTag("Goal").GetComponent <GoalObjectController>();
    }
    // Start is called before the first frame update
    void Start()
    {
        Canvas = GameObject.FindGameObjectWithTag("Canvas");

        Reticle      = Canvas.transform.Find("Reticle");
        ReticleImage = Reticle.GetComponent <Image>();

        PistolShootButton = Canvas.transform.Find("PistolShootButton");
        PSButton          = PistolShootButton.Find("PSButton");
        lbbScript         = PSButton.GetComponent <LiveBulletOnButton>();

        PistolReadySlider = PistolShootButton.Find("PistolReadySlider");
        slider            = PistolReadySlider.GetComponent <Slider>();

        ReloadButton       = Canvas.transform.Find("ReloadButton");
        RButton            = ReloadButton.Find("RButton");
        reloadlivebbScript = RButton.GetComponent <ReloadLiveBulletOnButton>();

        bulletNum = bulletNumMax;

        bulletCounttime = bulletshootInterval;

        audioSources = transform.GetComponents <AudioSource>();

        phpScript = transform.parent.GetChild(0).GetComponent <PlayerHP>();
    }