Esempio n. 1
0
 // Start is called before the first frame update
 void Start()
 {
     listBuilder = new VectorListBuilder();
     pathPoints  = listBuilder.Builder1();
     Player      = GameObject.Find("Player");
     destination = GameObject.Find("Diamond");
     destination.transform.position = pathPoints[pathPoints.Count - 1] + new Vector3(0f, 2f, 0f);
 }
Esempio n. 2
0
 private void Start()
 {
     Diamond     = GameObject.Find("Diamond");
     Player      = GameObject.Find("Player");
     listBuilder = new VectorListBuilder();
     pathPoints  = listBuilder.Builder1();
     pathPoints2 = new List <Vector3>();
     foreach (Vector3 location in pathPoints)
     {
         Vector3 newLocation = location + new Vector3(0.0f, 1.5f, 0.0f);
         //Debug.Log(newLocation);
         pathPoints2.Add(newLocation);
     }
     Diamond.transform.position = pathPoints[pathPoints.Count - 1] + new Vector3(0f, 2f, 0f);
 }
Esempio n. 3
0
    void Start()
    {
        Player  = GameObject.Find("Player");
        Diamond = GameObject.Find("Diamond");

        PlayerPrefs.SetInt("Points", 0);
        PlayerPrefs.SetInt("Collision", 0);

        pathBuilder = new VectorListBuilder();
        Paths       = new List <List <Vector3> >();
        Paths.Add(pathBuilder.Builder16());//0
        Paths.Add(pathBuilder.Builder17());
        Paths.Add(pathBuilder.Builder18());

        Paths.Add(pathBuilder.Builder13());//3
        Paths.Add(pathBuilder.Builder14());
        Paths.Add(pathBuilder.Builder15());

        Paths.Add(pathBuilder.Builder10());
        Paths.Add(pathBuilder.Builder11());
        Paths.Add(pathBuilder.Builder12());

        Paths.Add(pathBuilder.Builder7());
        Paths.Add(pathBuilder.Builder8());
        Paths.Add(pathBuilder.Builder9());

        Paths.Add(pathBuilder.Builder4());
        Paths.Add(pathBuilder.Builder5());
        Paths.Add(pathBuilder.Builder6());

        Paths.Add(pathBuilder.Builder1());//15
        Paths.Add(pathBuilder.Builder2());
        Paths.Add(pathBuilder.Builder3());

        Arrow = Resources.Load <GameObject>("Arrow");

        PlayerPrefs.SetInt("UserID", 12);

        /**
         * SummaryFile = Application.dataPath + "/Resources/Records/" + "User" + PlayerPrefs.GetInt("UserID") + ".txt";
         * PlayerPrefs.SetString("SummaryFile", SummaryFile);
         * if (!File.Exists(SummaryFile))
         * {
         *  File.WriteAllText("SummaryFile", "TaskID,Method,StartTime,EndTime,TimeSpan,Waypoint,Collision \n");
         * }
         **/
    }
Esempio n. 4
0
    void Start()
    {
        Player      = GameObject.Find("Player");
        destination = GameObject.Find("Diamond");

        Arrow = Resources.Load <GameObject>("Arrow");

        //Arrow = Instantiate(Resources.Load("Prefabs/Arrow", typeof(GameObject))) as GameObject;

        pathPoints = pathBuilder.Builder1();
        destination.transform.position = pathPoints[pathPoints.Count - 1] + new Vector3(0f, 2f, 0f);
        //destination.transform.localScale -= new Vector3(0.5f, 0.5f, 0.5f);


        for (int i = 0; i < pathPoints.Count - 1; i++)
        {
            pathPoints[i] += new Vector3(0f, 0.1f, 0f);
        }

        for (int i = 0; i < pathPoints.Count - 1; i++)
        {
            amount = Mathf.RoundToInt(Mathf.Floor(Vector3.Distance(pathPoints[i + 1], pathPoints[i]) / 0.7f));
            // pathPoints[i]: origin
            // pathPoints[i+1]: destination
            //amount = Mathf.RoundToInt(Vector3.Distance(pathPoints[i + 1], pathPoints[i]) / 0.4f);
            distance            = 1 / amount;
            instantiatePosition = new Vector3(0, 0, 0);
            float x = (pathPoints[i + 1].x - pathPoints[i].x) / amount;
            float y = (pathPoints[i + 1].y - pathPoints[i].y) / amount;
            float z = (pathPoints[i + 1].z - pathPoints[i].z) / amount;
            for (int j = 0; j < amount; j++)
            {
                //We increase our lerpValue
                //lerpValue += distance;
                //Get the position
                //instantiatePosition = Vector3.Lerp(pathPoints[i], pathPoints[i + 1], lerpValue);
                //Instantiate the object
                instantiatePosition += new Vector3(x, y, z);

                ArrowInstance = Instantiate(Arrow, pathPoints[i] + instantiatePosition, transform.rotation);
                ArrowInstance.transform.LookAt(pathPoints[i + 1]);
                ArrowInstance.transform.Rotate(90f, -90f, 0f, Space.Self);
            }
        }
    }