コード例 #1
0
    protected virtual void Awake()
    {
        seeker = GetComponent <Seeker>();

        FoodSource = GameObject.FindWithTag("Foodsource");
        //Spawner = GameObject.FindWithTag("Spawner");

        _ANeeds = GetComponent <A_Needs>();

        transform.rotation = Random.rotation;
        target             = new Vector3(Random.Range(-50, 50), 0, Random.Range(-50, 50));
        Debug.Log(target);
        //This is a simple optimization, cache the transform component lookup
        tr = transform;

        //Cache some other components (not all are necessarily there)
        controller    = GetComponent <CharacterController>();
        navController = GetComponent <NavmeshController>();
        rigid         = GetComponent <Rigidbody>();
    }
コード例 #2
0
    protected virtual void Awake()
    {
        seeker = GetComponent<Seeker>();

        FoodSource = GameObject.FindWithTag("Foodsource");
        //Spawner = GameObject.FindWithTag("Spawner");

        _ANeeds = GetComponent<A_Needs>();

        transform.rotation = Random.rotation;
        target = new Vector3 (Random.Range(-50,50),0,Random.Range(-50,50));
        Debug.Log(target);
        //This is a simple optimization, cache the transform component lookup
        tr = transform;

        //Cache some other components (not all are necessarily there)
        controller = GetComponent<CharacterController>();
        navController = GetComponent<NavmeshController>();
        rigid = GetComponent<Rigidbody>();
    }