Пример #1
0
    public void Init(SpeedrunManager _speedRun)
    {
        if (initialCheckpoint == null)
        {
            Debug.LogError("An initial checkpoint should always be setted", initialCheckpoint);
            return;
        }

        if (_speedRun.GetIsActive())
        {
            for (int i = 0; i < checkpointContainer.childCount; i++)
            {
                checkpointContainer.GetChild(i).gameObject.SetActive(false);
            }

            activeCheckpoint = initialCheckpoint;
        }
        else
        {
            for (int i = 0; i < checkpointContainer.childCount; i++)
            {
                CheckpointBase _current = checkpointContainer.GetChild(i).GetComponent <CheckpointBase>();
                checkpoints.Add(_current);
                _current.Init();
                _current.ActivateCheckpoint += HandleActivateCheckpoint;
            }

            activeCheckpoint = initialCheckpoint;
            activeCheckpoint.Enable();
        }
    }
Пример #2
0
 private void HandleActivateCheckpoint(CheckpointBase _checkpoint)
 {
     if (!LevelManager.instance.GetSpeedrunManager().GetIsActive() && activeCheckpoint != _checkpoint)
     {
         activeCheckpoint.Disable();
         activeCheckpoint = _checkpoint;
         activeCheckpoint.Enable();
     }
 }