private static void InformAllCheckpointsWithId(CheckpointId id)
 {
     foreach (var checkpoint in checkpointsInScene[id])
     {
         checkpoint.OnReached();
     }
 }
Example #2
0
 public LevelId LevelIdFromCheckpoint(CheckpointId id)
 {
     if (id.CheckpointIdValue() == 99)
     {
         return(new LevelId(2));
     }
     return(new LevelId(id.CheckpointIdValue() > 3 ? 1 : 0));
 }
 public override void PassedCheckpoint(CheckpointId id)
 {
     // transform.parent.BroadcastMessage("OnPassedCheckpoint", id);
     Debug.Log("Passed checkpoint:" + id.CheckpointIdValue());
     if (playerNotifications)
     {
         Debug.Log("Notifying Player about checkpoint");
         playerNotifications.SendMessage("OnPassedCheckpoint", id);
     }
 }
Example #4
0
    public bool SetStartCheckpoint(CheckpointId id)
    {
        data.startingCheckpointId = id;
        bool visitedBefore = HasVisitedCheckpoint(id);

        if (!visitedBefore)
        {
            data.checkpointsPassed.Add(id.CheckpointIdValue());
        }
        Save();
        return(!visitedBefore);
    }
        public static void Reach(CheckpointId id)
        {
            if (IsReached(id))
            {
                Debug.LogWarning($"Tried to reach already reached Checkpoint {id}");
                return;
            }

            InformAllCheckpointsWithId(id);

            reachedCheckpointIds.Add(id);
            persistentProgression.PersistCheckpointReached((int)id);
        }
    void OnPassedCheckpoint(CheckpointId id)
    {
        bool isNewCheckpointForMe = player.playerStorage.SetStartCheckpoint(id);

        if (isNewCheckpointForMe)
        {
            Debug.Log("Checkpoint triggered: Yes, this is a new checkpoint");
            player.playerStorage.Save();
        }
        else
        {
            Debug.Log("Checkpoint triggered: I have been here before");
        }
    }
Example #7
0
    public PlayerCheckpoint PlayerCheckpointFromId(CheckpointId checkpointId)
    {
        int checkpointValue = checkpointId.CheckpointIdValue();

        foreach (var checkpoint in checkpoints)
        {
            if (checkpoint.checkpointId == checkpointValue)
            {
                return(checkpoint);
            }
        }
        Debug.LogError("Couldn't find checkpoint with id:" + checkpointValue);
        return(null);
    }
Example #8
0
 public virtual void PassedCheckpoint(CheckpointId id)
 {
 }
 public void ContinueFromCheckpoint(CheckpointId checkpointId)
 {
     playerStorage.SetStartCheckpoint(checkpointId);
     Load();
 }
Example #10
0
 public bool HasVisitedCheckpoint(CheckpointId id)
 {
     return(data.checkpointsPassed.Contains(id.CheckpointIdValue()));
 }
 private static bool IsFirstWithId(CheckpointId id)
 {
     return(!checkpointsInScene.ContainsKey(id));
 }
 private static bool IsReached(CheckpointId id)
 {
     return(reachedCheckpointIds.Contains(id));
 }