コード例 #1
0
ファイル: Bot5.cs プロジェクト: C-Monster-Boy/The-Labyrinth
    // Start is called before the first frame update
    void Start()
    {
        timer        = roamTimer;
        currState    = BotStates.Roam;
        agent        = this.GetComponent <NavMeshAgent>();
        mazeGen      = GameObject.FindObjectOfType <Maze>();
        botPosHolder = GetComponent <BotTargetPosHolderScript>();
        Vector3 newPos = mazeGen.GetRandomPosOnMaze();

        agent.SetDestination(newPos);
        currTargetPos = newPos;
    }
コード例 #2
0
    // Start is called before the first frame update
    void Start()
    {
        roamTimer = Random.Range(5f, 15f);
        transform.GetChild(4).GetComponent <AudioSource>().Play();
        alertAudioSource     = transform.GetChild(3).GetComponent <AudioSource>();
        inSoundPlayCoroutine = false;
        walkingAudioSource   = transform.GetChild(2).GetComponent <AudioSource>();
        currState            = BotStates.Roam;
        agent        = this.GetComponent <NavMeshAgent>();
        mazeGen      = GameObject.FindObjectOfType <Maze>();
        botPosHolder = GetComponent <BotTargetPosHolderScript>();
        Vector3 newPos = mazeGen.GetRandomPosOnMaze();

        agent.SetDestination(newPos);
        currTargetPos      = newPos;
        playAlertSoundOnce = false;
    }