/// <summary>
        /// Setup the area
        /// </summary>
        private void Start()
        {
            // Create checkpoints along the race path
            Debug.Assert(racePath != null, "Race path was not set");
            Checkpoints = new List <GameObject>();
            int numCheckpoints = (int)racePath.MaxUnit(CinemachinePathBase.PositionUnits.PathUnits);

            for (int i = 0; i < numCheckpoints; i++)
            {
                // Instantiate either checkpoint or finish line checkpoint
                GameObject checkPoint;
                if (i == numCheckpoints - 1)
                {
                    checkPoint = Instantiate <GameObject>(finishCheckPointPrefab);
                }
                else
                {
                    checkPoint = Instantiate <GameObject>(checkPointPrefab);
                }

                // Set the parent, position and rotation
                checkPoint.transform.SetParent(racePath.transform);
                checkPoint.transform.localPosition = racePath.m_Waypoints[i].position;
                checkPoint.transform.rotation      = racePath.EvaluateOrientationAtUnit(i, CinemachinePathBase.PositionUnits.PathUnits);

                // Add checkpoint to list
                Checkpoints.Add(checkPoint);
            }
        }
Exemplo n.º 2
0
    void Start()
    {
        checkpoints = new List <GameObject>();
        int NoCheckpoints = (int)racePath.MaxUnit(CinemachinePathBase.PositionUnits.PathUnits);

        for (int i = 0; i < NoCheckpoints; i++)
        {
            GameObject checkpoint = Instantiate <GameObject>(checkPointPrefab);

            if (i == NoCheckpoints - 1)
            {
                checkpoint.tag = "finalCheckpoint";
            }

            checkpoint.transform.SetParent(racePath.transform);
            checkpoint.transform.localPosition = racePath.m_Waypoints[i].position;
            checkpoint.transform.rotation      = racePath.EvaluateOrientationAtUnit(i, CinemachinePathBase.PositionUnits.PathUnits);

            checkpoints.Add(checkpoint);
        }
    }
Exemplo n.º 3
0
    private void Start()
    {
        Debug.Assert(racePath != null, "Racepath was not set");
        Checkpoints = new List <GameObject>();
        int numCheckpoints = (int)racePath.MaxUnit(CinemachinePathBase.PositionUnits.PathUnits);

        for (int i = 0; i < numCheckpoints; i++)
        {
            GameObject checkpoint;
            if (i == numCheckpoints - 1)
            {
                checkpoint = Instantiate <GameObject>(finishCheckpointprefab);
            }
            else
            {
                checkpoint = Instantiate <GameObject>(checkpointprefab);
            }
            checkpoint.transform.SetParent(racePath.transform);
            checkpoint.transform.localPosition = racePath.m_Waypoints[i].position;
            checkpoint.transform.localRotation = racePath.EvaluateOrientationAtUnit(i, CinemachinePathBase.PositionUnits.PathUnits);
            Checkpoints.Add(checkpoint);
        }
    }