Beispiel #1
0
 void Start()
 {
     _state = Enums.WarpDriveState.off;
     timer = Instantiate(timer);
     countdownText.text = "";
     miniGame.ResultReady += ProcessResult;
     playAudioSource = audioSource.gameObject.AddComponent<AudioSource>();
 }
Beispiel #2
0
 public void Engage()
 {
     if (!_countingDown)
     {
         _state = Enums.WarpDriveState.charging;
         Countdown(chargeUpTime);
         _countingDown = true;
         _miniGameStarted = false;
     }
 }
Beispiel #3
0
    IEnumerator PerformWarpMove(float time, float effectsStartTime, float effectsEndTime, float speedLinesSpeed)
    {
        cameraController.EnterWarp(effectsStartTime, speedLinesSpeed);
        GameManager.instance.cameraController.ShakeCamera(2f, 40f, 0.4f);
        _state = Enums.WarpDriveState.on;
        GameObject startPosition = new GameObject();
        startPosition.transform.position = transform.position;
        GameObject endPosition = new GameObject();
        endPosition.transform.position = _targetPosition;

        if (endPosition.transform.position == Vector3.zero)
        {
            yield break;
        }

        float timeSinceStarted = 0f;
        float percentageComplete = 0f;
        float startTime = Time.time;

        while (percentageComplete < 1f)
        {
            timeSinceStarted = Time.time - startTime;
            percentageComplete = timeSinceStarted / time;
            transform.position = Vector3.Lerp(startPosition.transform.position, endPosition.transform.position, percentageComplete);
            yield return null;
        }
        Destroy(startPosition);
        Destroy(endPosition);
        cameraController.ExitWarp(effectsEndTime);
        _state = Enums.WarpDriveState.waitingForCommand;
    }
Beispiel #4
0
 public void PowerDown()
 {
     _state = Enums.WarpDriveState.off;
 }