コード例 #1
0
        /// <summary>
        /// Instantiates a new `SequenceOverlayEntity` prefab and returns its corresponding `InputSequence`
        /// </summary>
        public InputSequence CreateSequence(string text, Transform worldTarget)
        {
            SequenceOverlayEntity entity = Instantiate(_sequenceEntityPrefab, transform);

            _spawnedSequences.Add(entity);

            // Keep name updated.
            entity.Sequence.OnTextUpdated += delegate
            {
                entity.name = $"Sequence: {entity.Sequence.Text}";
            };

            entity.Target = worldTarget;
            entity.MoveToTargetPosition();
            entity.Sequence.Text         = text;
            entity.Sequence.OnCompleted += delegate
            {
                InputSequenceManager.UnregisterSequence(entity.Sequence);
                _spawnedSequences.Remove(entity);
            };
            entity.Sequence.OnRemoval += delegate
            {
                _spawnedSequences.Remove(entity);
                Destroy(entity.gameObject);
            };

            return(entity.Sequence);
        }
コード例 #2
0
ファイル: InputSequence.cs プロジェクト: furbet1992/Swipo2
 private void OnDestroy()
 {
     InputSequenceManager.UnregisterSequence(this);
 }