示例#1
0
    void Start()
    {
        //We need to deactivate the cursor, and lock it to the game screen.
        pauseMenu.SetActive(false);
        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible   = false;
        Time.timeScale   = 1.0f;
        bCanTakeInput    = false;
        Invoke("CanUseInput", 1);


        om = GameObject.FindGameObjectWithTag("WorldManager").GetComponent <sOptionsManager>();
    }
    void Awake()
    {
        //Getting reference to the player.
        player = GameObject.FindGameObjectWithTag("Player");
        //Getting reference to the Character Controller.
        cc = player.transform.GetComponent <sCharacterController>();
        //Getting reference to the Enemy Nav Mesh Agent.
        nav = GetComponent <UnityEngine.AI.NavMeshAgent>();
        //Setting the position to a random position on the NavMesh.
        transform.position = GetRandomPosition(200.0f * radiusMod);
        //Setting the walking and running speed of the enemy.
        walkingSpeed = 5.0f;
        runningSpeed = 10.0f;
        nav.speed    = walkingSpeed;
        //Getting reference to the Options Menu Manager.
        om = GameObject.FindGameObjectWithTag("WorldManager").GetComponent <sOptionsManager>();
        //Getting reference to the audio source.
        OtherSource = GameObject.FindGameObjectWithTag("OtherSource").GetComponent <AudioSource>();

        bPlayLaugh = false;
        bInRadius  = false;
    }