コード例 #1
0
        /// <summary>
        /// Factory method for building a ComboText instance
        /// </summary>
        /// <param name="template">Template GameObject to based on</param>
        /// <param name="parent">Transform of the Canvas parent</param>
        /// <param name="position">Position of the ComboText instance</param>
        /// <param name="delay">Delay in second before the animation begin</param>
        /// <param name="text">Text to be displayed</param>
        /// <returns>Built ComboText instance</returns>
        public static ComboText Factory(GameObject template, Transform parent, Vector3 position, float delay, string text)
        {
            GameObject cloned = Instantiate(template);

            cloned.transform.SetParent(parent, false);
            cloned.transform.position   = position;
            cloned.transform.localScale = template.transform.localScale;
            ComboText clonedComboText = cloned.GetComponentInChildren <ComboText>();

            clonedComboText.setDelay(delay);
            clonedComboText.GetComponent <Text>().text = text;
            cloned.SetActive(true);
            return(clonedComboText);
        }
コード例 #2
0
 /// <summary>
 /// Print a new Combo text at a given position with a given delay
 /// </summary>
 /// <param name="position">Vector3 position that this ComboText should be located</param>
 /// <param name="delayAppearence">Delay in second that this ComboText should be visible and SFX is played</param>
 public void PrintNewCombo(Vector3 position, float delayAppearence) {
     combo.Add(ComboText.Factory(comboTemplate, this.transform, position, delayAppearence, "Combo " + Coordinator.Coordinator.GetCombo()));
     Sound.SoundSystem.instance.playComboSFX(Coordinator.Coordinator.GetCombo(), delayAppearence);
 }