예제 #1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Player")
        {
            RespawnComponent rc = other.GetComponent <RespawnComponent>();


            if (!rc)
            {
                return;
            }



            if (rc.checkpointNum == checkpointNum - 1)
            {
                rc.checkpointCount++;
                rc.checkpointNum = checkpointNum;
                rc.respawnPoint  = transform;
            }
            else if (rc.checkpointNum == checkpointNum)
            {
                rc.checkpointNum = checkpointNum;
                rc.respawnPoint  = transform;
            }
        }
    }
예제 #2
0
 public SceneManager()
     : base()
 {
     RC = new RespawnComponent(this);
     this.AddComponent(RC);
     GetAllLevels();
 }
예제 #3
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Player")
        {
            PlayerScore      ps = other.GetComponent <PlayerScore>();
            RespawnComponent rc = other.GetComponent <RespawnComponent>();

            if (!ps)
            {
                return;
            }

            if (rc.checkpointCount >= raceCheckpoints)
            {
                if (ps.laps < raceLaps - 1)
                {
                    ps.laps++;
                    rc.checkpointCount = 0;
                    rc.checkpointNum   = 0;
                    return;
                }


                ps.score += rewardScore;
                rewardScore--;

                RandomAllRacePlayerScore rarPS = other.GetComponent <RandomAllRacePlayerScore>();
                if (rarPS)
                {
                    rarPS.UpdatePlayerScore();
                }



                Instantiate(ps.finishParticles, other.gameObject.transform.position, other.gameObject.transform.rotation);
                Destroy(other.gameObject);

                playersLeft--;
            }
        }
    }