// Use this for initialization void Start() { navManager = GameObject.FindGameObjectWithTag ("NavManager").GetComponent<NavmanagerScript>(); mask = navManager.navMask; SortedList adjacentNav = new SortedList(); GameObject[] navs = navManager.GetNavGroupManager().GetComponent<NavgroupScript>().GetPointsInSharedGroups(gameObject); for(int i = 0; i < navs.Length; i++){ if(!navs[i].Equals (gameObject) && !Physics2D.Linecast(transform.position, navs[i].transform.position, mask)){ adjacentNav.Add(Vector3.Distance (transform.position, navs[i].transform.position), navs[i]); } } adjNodes = new GameObject[adjacentNav.Count]; dists = new float[adjacentNav.Count]; for(int i = 0; i < adjacentNav.Count; i++){ adjNodes[i] = (GameObject)(adjacentNav.GetByIndex (i)); dists[i] = Vector3.Distance (transform.position, adjNodes[i].transform.position); } }
//AudioDoorScript audioDoorManager = GameObject.FindGameObjectWithTag("AudioDoorManager").GetComponent<AudioDoorScript>(); // Use this for initialization void Awake() { itemManager = GameObject.FindGameObjectWithTag("ItemPositions").GetComponent<ItemPositionManagerScript>(); customerManager = GameObject.FindGameObjectWithTag ("EventManager").GetComponent<CustomerManagerScript>(); conversationManager = GameObject.FindGameObjectWithTag ("EventManager").GetComponent<ConversationManagerScript>(); animator = GetComponent<Animator>(); Physics2D.IgnoreLayerCollision(gameObject.layer, gameObject.layer, true); navManager = GameObject.FindGameObjectWithTag("NavManager").GetComponent<NavmanagerScript>(); }