public void SelectFadeMethod(FloatingFadeMethod fadeMethod, float fadeTime = 2f, float fadeStart = 1f) { //Debug.Log("Fade method selected"); hasFade = true; fadeType = fadeMethod; fadeStartTime = fadeStart; fadeTotalTime = fadeTime; // Alpha fade // **Currently alpha fades by default** //startingColor = proFloatingText.color; //fadedColor = startingColor; //fadedColor.a = 0; }
// TODO: Create individual prefabs for each type of floatign text (damage, healing, etc) and add them to an array // Specify the array number when requesting floating text - this will allow for much more stylistic displays public FloatingPopupText CreateFloatingPopupText(string text, Vector2 location, Color color = new Color(), FloatingFadeMethod method = FloatingFadeMethod.None, float speedMult = 1, float randomXRange = 0, float randomSpeedMult = 1, float textTime = 2, float maxPlaneDistance = 0) { if (floatingTextDisabled) { return(null); } GameObject newFloatingText = Instantiate(floatingTextPrefab); FloatingPopupText popupText = newFloatingText.GetComponent <FloatingPopupText>(); popupText.StartFloating(text, globalSpeedMult, randomXRange, randomSpeedMult, textTime, maxPlaneDistance); newFloatingText.transform.position = location; newFloatingText.transform.SetParent(mainCanvas, false); if (method != FloatingFadeMethod.None) { newFloatingText.GetComponent <FloatingPopupText>().SelectFadeMethod(method); } if (color != new Color()) { popupText.proFloatingText.color = color; } // Add a small delay to further popups floatingTextDisabled = true; Invoke("EnableFloatingText", 1); return(popupText); }