コード例 #1
0
    private void GenerateChunk(ChunkEnteredEvent e)
    {
        GameObject chunk = null;

        if (chunks == winAmountOfChunks)
        {
            chunk = (GameObject)Instantiate(winChunk);
            SpawnWinChunk(chunk);
        }
        else if (chunks < winAmountOfChunks)
        {
            int ran  = Random.Range(0, chunkList.Count);
            int ran2 = Random.Range(0, 1);

            chunk = (GameObject)Instantiate(chunkList[ran]);

            //chunk = (GameObject)Instantiate (list [ran]);

            SpawnChunk(chunk);
        }
        else
        {
            ArrangeChunkList();
        }
    }
コード例 #2
0
 private void YouHaveToAvoid(ChunkEnteredEvent e)
 {
     if (isTutorial && !haveToAvoid)
     {
         haveToAvoid = true;
         PlaySound("Play_MisVO16");
     }
 }
コード例 #3
0
    /// <summary>
    /// Defines what the new target position is
    /// </summary>
    /// <param name="e">E.</param>
    public void PlayerProgression(ChunkEnteredEvent e)
    {
        if (numberOfPreviousChunks == -1)
        {
            EventManager.Instance.TriggerEvent(new PlayerHitsTheFirstRoadChunk());
            gameStarted = true;
            ProgBar.SetActive(true);
        }

        ChunkScript script = e.chunk.GetComponent <ChunkScript>();

        startPoint  = script.StartPoint.transform.position;
        endPoint    = script.EndPoint.transform.position;
        chunkLength = Vector3.Distance(startPoint, endPoint);
        numberOfPreviousChunks++;
    }
コード例 #4
0
 void MoveWithPlayer(ChunkEnteredEvent e)
 {
     moveTowardsPlayer = true;
     rotationDamping   = 3.0f;
 }
コード例 #5
0
 private void StartTrack(ChunkEnteredEvent e)
 {
     movementController.StartTrack();
     EventManager.Instance.StopListening <ChunkEnteredEvent>(StartTrack);
 }