Esempio n. 1
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Player" && CheckpointAction != null)
     {
         CheckpointAction.Invoke();
     }
 }
Esempio n. 2
0
        private void OnCheckpointAction(CheckpointAction checkpointAction)
        {
            switch (checkpointAction)
            {
            case CheckpointAction.Finish:
                CurrentCheckpoint.Finish();

                return;

            case CheckpointAction.Respawn:
                CurrentCheckpoint.RespawnPlayers();
                return;
            }
        }
Esempio n. 3
0
    public void RespawnPlayerHere()
    {
        string[] checkPoints = GLPlayerPrefs.GetStringArray(scope, LAST_CHECKPOINT);
        if (checkPoints.Length == 0)
        {
            return;
        }

        string lastCode = checkPoints[checkPoints.Length - 1];

        if (lastCode == GetCode())
        {
            Debug.Log("Respawn player at: " + GetCode());
            player.transform.position = this.transform.position + player.transform.up * 0.5f;
            lastCheckpoint            = this;
        }
    }
Esempio n. 4
0
 public override void Execute()
 {
     if (!isChecked)
     {
         isChecked = true;
         string[] checkPoints = GLPlayerPrefs.GetStringArray(scope, LAST_CHECKPOINT);
         var      exists      = Array.Exists(checkPoints, x => x == GetCode());
         if (!exists)
         {
             Array.Resize(ref checkPoints, checkPoints.Length + 1);
             checkPoints[checkPoints.Length - 1] = GetCode();
             GLPlayerPrefs.SetStringArray(scope, LAST_CHECKPOINT, checkPoints);
             Debug.Log("Checkpoint saved: " + GetCode());
             lastCheckpoint = this;
         }
     }
 }
Esempio n. 5
0
 private void InitializeInstanceFields()
 {
     _directory  = TestDirectory.testDirectory(this.GetType(), _fs.get());
     Rules       = outerRule(_fs).around(_directory).around(_pageCacheRule).around(_random);
     _checkpoint = new CheckpointAction(this);
 }