Exemple #1
0
        private void AttachSequenceToAsteroid(Asteroid asteroid)
        {
            string        inputText = _texts.FindUniquelyTargetableText();
            InputSequence sequence  = _sequenceOverlay.CreateSequence(inputText, asteroid.transform);

            sequence.OnInputAccepted += delegate { _player.FireAt(asteroid); };
            sequence.OnCompleted     += delegate { asteroid.Explode(); };
        }
        /// <summary>
        /// Generates a text with a given difficulty.
        /// </summary>
        private string GenerateSequenceText(int difficulty)
        {
            List <string> texts = new List <string>();

            texts.Add(_texts.FindUniquelyTargetableText());
            for (int i = 1; i < difficulty; i++)
            {
                texts.Add(_texts.PickRandomText());
            }
            return(string.Join(" ", texts));
        }
        private void AddSequenceToObject(GameObject sceneObject)
        {
            // Generate a text sequence with a unique among the other sequences active sequences
            string text = _texts.FindUniquelyTargetableText();

            // Crate a sequence with the given text and object to follow in the scene.
            InputSequence sequence = _sequenceOverlay.CreateSequence(text, sceneObject.transform);

            // Let's make it so that the object is destroyed when the sequence is completed.
            sequence.OnCompleted += delegate { Destroy(sceneObject); };
        }
Exemple #4
0
        private void AttachSequence(GameObject obj)
        {
            string        textSequence = _texts.FindUniquelyTargetableText();
            InputSequence sequence     = _sequenceOverlay.CreateSequence(textSequence, obj.transform);

            sequence.OnCompleted += delegate
            {
                Destroy(obj);
                if (_respawn)
                {
                    AddSequenceObject();
                }
            };
            sequence.OnRemoval += delegate
            {
                Destroy(obj);
            };
        }