Пример #1
0
    public void CreateTrailStart()
    {
        Vector3    pointPos = new Vector3(cursorPos.x, cursorPos.y + 0.5f, cursorPos.z);
        GameObject newTrail = Instantiate(trailPrefab, pointPos, transform.rotation);

        currentTrail = newTrail;
        TrailComp  trailComp       = newTrail.GetComponent <TrailComp> ();
        GameObject trailStartPoint = Instantiate(trailStartPointPrefab, pointPos, transform.rotation);

        trailStartPoint.transform.parent = newTrail.transform;
        trailComp.trailStart             = trailStartPoint;
        lastPointMarker = trailStartPoint;
        potTrailLineRend.SetActive(true);
        trailCreationPhase = 1;
    }
Пример #2
0
    public void SpawnNewTrailPoint()
    {
        TrailComp trailComp = currentTrail.GetComponent <TrailComp> ();
        Vector3   pointPos  = new Vector3(cursorPos.x, cursorPos.y + (skierHeight / 2), cursorPos.z);

        GameObject       newPoint   = Instantiate(pointMarkerPrefab, pointPos, transform.rotation);
        TrailPointMarker markerComp = newPoint.GetComponent <TrailPointMarker> ();

        markerComp.target = lastPointMarker;
        AddPointToList(newPoint);
        trailLineRendPosList.Add(markerComp.trailLineMarker);
        markerComp.markerNumber = currentPointNumber;
        currentColliders.Add(newPoint);
        currentPointNumber += 1;
    }
Пример #3
0
    public IEnumerator FinishNewTrail()
    {
        TrailComp trailComp = currentTrail.GetComponent <TrailComp> ();

        yield return(new WaitForSeconds(0.01f));

        trailComp.name        = "Trail" + currentTrailBeingCreated.ToString();
        trailComp.trailEnd    = trailComp.wps [trailComp.wps.Count - 1];
        trailComp.trailNumber = currentTrailBeingCreated;
//		trailComp.wps = currentTrail;
        trailComp.trailDifficulty = currentTrailDifficultyLevel;
        trailComp.StartCoroutine(trailComp.ScanArea());

/*		foreach (GameObject go in currentTrail) {
 *                      go.transform.parent = newTrail.transform;
 *              }*/
        foreach (GameObject go in currentBorders)
        {
            go.transform.parent = currentTrail.transform;
        }

        foreach (GameObject go in currentColliders)
        {
            DestroyObject(go);
            //go.transform.parent = newTrail.transform;
        }

        yield return(new WaitForSeconds(0.1f));

        currentWayUpPosList.Reverse();
        GameObject newWayUp = Instantiate(emptyPrefab, currentWayUpPosList [0], transform.rotation);

        newWayUp.name = "WayUp" + currentTrailBeingCreated.ToString();
        newWayUp.tag  = "WayUpStart";
        newWayUp.AddComponent <WayUpComp> ();
        BoxCollider bComp = newWayUp.AddComponent <BoxCollider> ();

        bComp.isTrigger = true;
        Rigidbody rigidC = newWayUp.AddComponent <Rigidbody> ();

        rigidC.useGravity = false;
        int w = 0;

        foreach (Vector3 v in currentWayUpPosList)
        {
            if (w >= 1)
            {
                GameObject newWp = Instantiate(emptyPrefab, v, transform.rotation);
                newWp.transform.parent = newWayUp.transform;
                newWp.tag = "wayUpWP";
                newWayUp.GetComponent <WayUpComp> ().wps.Add(newWp);
                BoxCollider boxComp = newWp.AddComponent <BoxCollider> ();
                boxComp.isTrigger = true;
                Rigidbody rigidComp = newWp.AddComponent <Rigidbody> ();
                rigidComp.useGravity = false;
                if (w == currentWayUpPosList.Count - 1)
                {
                    newWp.name = "WayUpFinish";
                }
            }
            w += 1;
        }

        yield return(new WaitForSeconds(0.25f));

        SetTrailCreationModeOff();
        currentTrailBeingCreated += 1;

        trailComp.isFinished = true;
        trailComp.StartCoroutine(trailComp.ScanArea());
        StartToSpawnSkiers(12);
    }