예제 #1
0
        public void FixedUpdate()
        {
            if (!_isRecording || _startedRecordingAt == 0f || _currentRecording == null)
            {
                return;
            }

            float elapsedTime       = Time.fixedTime - _startedRecordingAt;
            float elapsedPercentage = elapsedTime / availableSeconds;

            _progressManager.UpdatePercentage(elapsedPercentage);

            if (elapsedTime < availableSeconds && !_forceRecordingEnd)
            {
                return;
            }

            _forceRecordingEnd = false;
            _isRecording       = false;
            _progressManager.ResetAccent();

            _currentRecording.AddEvent(new RecordingEvent()
            {
                EventType = RecordingEventType.Disappear
            });

            GameObject playback = Instantiate(characterPrefab, new Vector2(-1000, -1000), Quaternion.identity);

            playback.tag = "Clone";
            playback.GetComponentInChildren <SpeechBubbleManager>().gameObject.SetActive(false);
            CharacterManager characterManager = playback.GetComponent <CharacterManager>();

            characterManager.isMain = false;
            characterManager.color  = colors[slots];
            PlaybackManager playbackManager = playback.GetComponent <PlaybackManager>();

            playbackManager.times             = repeatTimes;
            playbackManager.RecordingPlayback = new RecordingPlayback()
            {
                Recording = _currentRecording
            };
            playbackManager.recordingManager = this;
            playback.SetActive(true);

            _isRecording        = false;
            _startedRecordingAt = 0f;
        }
예제 #2
0
        public void OnRecord(InputAction.CallbackContext context)
        {
            if (!GlobalInstanceManager.GetStateManager().CanMove)
            {
                return;
            }

            if (!GlobalInstanceManager.GetStateManager().CanUsePower)
            {
                return;
            }

            if (!context.performed)
            {
                return;
            }

            if (_isRecording)
            {
                _forceRecordingEnd = true;
                return;
            }

            if (slots <= 0)
            {
                return;
            }

            slots--;

            _isRecording        = true;
            _startedRecordingAt = Time.fixedTime;
            _progressManager.FadeInAccent();

            Recording recording = new Recording();

            recording.AddEvent(new RecordingEvent()
            {
                Position           = transform.position,
                Velocity           = GetComponent <Rigidbody2D>().velocity,
                HorizontalMovement = GetComponent <PlayerMovement>().GetHorizontalMovement(),
                EventType          = RecordingEventType.Appear
            });
            _currentRecording = recording;
        }