// ************************************************************************************************************* // find the next level, and calculate the position of the destination // ************************************************************************************************************* public void Next() { nextLevel = elevator.Next(); destPos.x = transform.position.x; destPos.y = nextLevel.gameObject.transform.position.y; destPos.z = transform.position.z; }
// Use this for initialization void Start() { // make dictionary MakeDictionary(); // find platform in children if (!platform) { platform = gameObject.GetComponentInChildren<Elevator_Platform>(); } // initial the next level nextLevel = levels[startAtLevelIndex]; }
void RecalculateNext() { // in this case just loop the levels, use the start at level index as the current index startAtLevelIndex = (startAtLevelIndex + 1) % levels.Length; nextLevel = levels[startAtLevelIndex]; }