示例#1
0
        public void SpawnText(string text, float duration)
        {
            if (!textSpawner)
            {
                return;
            }
            Vector3 position        = new Vector3(0, 10, 0);
            float   initialDuration = textSpawner.GetField <float, FlyingTextSpawner>("_duration");

            textSpawner.SetField("_duration", duration);
            textSpawner.SpawnText(position, worldRotation, inverseWorldRotation, text);
            textSpawner.SetField("_duration", initialDuration);
        }
示例#2
0
        private void SpawnText(string text, float duration)
        {
            // Little hack to spawn text for a chosen duration in seconds:
            // Save the initial float _duration field to a variable,
            // then set it to the chosen duration, call SpawnText, and restore the
            // previously saved duration.
            //    textSpawner.InitAndPresent(text, duration, new Vector3(0, 4, 0), Color.red, 6f, true);
            float initialDuration = textSpawner.GetField <float>("_duration");

            textSpawner.SetField("_duration", duration);
            textSpawner.SpawnText(Settings.Position, text);
            textSpawner.SetField("_duration", initialDuration);
        }