Пример #1
0
 public void ChangeToScene(string SceneToChangeTo)
 {
     thisLine = Object.FindObjectOfType <GenerateLine>();
     thisLine.sceneChange();
     DontDestroyOnLoad(thisLine);
     SceneManager.LoadScene(SceneToChangeTo, LoadSceneMode.Single); // Supposed to delete previous scene and load new one. Does not do so properly at the moment. Currently adds new scene on top of previous scene.
 }
    public void ChangeToScene(string SceneToChangeTo)
    {
        SceneManager.LoadScene(SceneToChangeTo, LoadSceneMode.Single);
        DayCount.Instance.Day += 1;
        Debug.Log(DayCount.Instance.Day);
        GenerateLine thisLine = Object.FindObjectOfType <GenerateLine>();

        Destroy(thisLine);
    }
Пример #3
0
    //De-caches LineRenderer generated positions by creating an array of positions for truck to follow
    void Start()
    {
        //Local reference to LineRenderer object that was not deleted from scene transition
        Line = Object.FindObjectOfType <LineRenderer>();

        Nodes = GameObject.FindGameObjectsWithTag("MapLocationalNode");

        //6.25 string and node
        map = FindObjectOfType <GenerateLine>();
        int sizeOfList = map.list_as_string.Length;

        foreach (string x in map.list_as_string)
        {
            if (x == null)
            {
                Debug.Log("decrement once due to null");
                sizeOfList--;
            }
        }


        Path = new GameObject[sizeOfList];
        int nodeIterate = 0;

        foreach (string s in map.list_as_string)
        {
            if (s != null)
            {
                foreach (GameObject node in Nodes)
                {
                    if (s.Equals(node.name))
                    {
                        Path[nodeIterate++] = node;
                    }
                }
            }
        }



        //# of points since GetPositions requires an array parameter with a specific size.
        //line_points = Line.positionCount;



        //Local array for truck to follow
        //target = new Vector3[line_points];
        target = new Vector3[sizeOfList];


        //Method for retrieving positions of generated line
        //Line.GetPositions(target);
        for (int t = 0; t < target.Length; t++)
        {
            target[t] = Path[t].transform.position;
        }

        /*
         *
         * movement_flag = false;
         *
         * //Set current index position of truck
         * foreach (GameObject x in Nodes)
         * {
         *  if (x.transform.position == transform.position)
         *  {
         *      break;
         *  }
         *  current_index++;
         * }
         * Debug.Log(current_index); // Should be 0 to start
         *
         * /*
         * Static_Button_Info.Up = false;
         * Static_Button_Info.Down = false;
         * Static_Button_Info.Left = false;
         * Static_Button_Info.Right = false;
         *
         * UI_Directions = GameObject.FindGameObjectsWithTag("UI_Directions");
         *
         *
         * foreach (GameObject e in UI_Directions)
         * {
         *
         *  if (e.name == "Right Arrow")
         *  {
         *      UI_Image_RIGHT = e;
         *      Debug.Log("Success for " + e.name);
         *      //e.SetActive(false);
         *  }
         *  if (e.name == "Left Arrow")
         *  {
         *      UI_Image_LEFT = e;
         *      Debug.Log("Success for " + e.name);
         *      //e.SetActive(false);
         *  }
         *  if (e.name == "Up Arrow")
         *  {
         *      UI_Image_UP = e;
         *      Debug.Log("Success for " + e.name);
         *      //e.SetActive(false);
         *  }
         *  if (e.name == "Down Arrow")
         *  {
         *      UI_Image_DOWN = e;
         *      Debug.Log("Success for " + e.name + " " + e.transform.position);
         *  }
         *
         * }
         *
         * up = Static_Button_Info.Up;
         * down = Static_Button_Info.Down;
         * left = Static_Button_Info.Left;
         * right = Static_Button_Info.Right;
         */
        //Test
        //down = true;
    }