private void ConfigureShotFeedback(ShotFeedbackTypes feedbackType, ShotFeedbackUnit feedbackUnit) { switch (feedbackType) { case ShotFeedbackTypes.Score: feedbackUnit.SetColor(new Color(252.0f / 255.0f, 218.0f / 255.0f, 19.0f / 255.0f, 1.0f)); feedbackUnit.SetFontSize(58); feedbackUnit.SetShadowThickness(3); feedbackUnit.SetLifetime(1.0f); feedbackUnit.SetMovementAnimation(Vector3.up, 0.1f); feedbackUnit.SetAlphaAnimation(0.0f, 1.0f); break; case ShotFeedbackTypes.EffectBonus: feedbackUnit.SetColor(Color.white); feedbackUnit.SetFontSize(42); feedbackUnit.SetShadowThickness(3); feedbackUnit.SetLifetime(1.0f); feedbackUnit.SetMovementAnimation(Vector3.up, 0.1f); feedbackUnit.SetAlphaAnimation(0.0f, 1.0f); break; case ShotFeedbackTypes.YellowZone: feedbackUnit.SetColor(Color.white); feedbackUnit.SetFontSize(42); feedbackUnit.SetShadowThickness(2); feedbackUnit.SetLifetime(1.0f); feedbackUnit.SetAlphaAnimation(0.0f, 1.0f); break; case ShotFeedbackTypes.ShotReview: feedbackUnit.SetColor(Color.white); feedbackUnit.SetFontSize(90); feedbackUnit.SetShadowThickness(5); feedbackUnit.SetLifetime(1.5f); break; case ShotFeedbackTypes.ExtraLife: feedbackUnit.SetColor(Color.white); feedbackUnit.SetFontSize(42); feedbackUnit.SetShadowThickness(2); feedbackUnit.SetLifetime(1.0f); feedbackUnit.SetMovementAnimation(Vector3.up, 0.1f); feedbackUnit.SetAlphaAnimation(0.0f, 1.0f); break; } }
public GameObject SpawnShotFeedback(MultiColoredString feedbackText, Vector3 feedbackPosition, ShotFeedbackTypes feedbackType) { GameObject go = Instantiate(shotFeedbackPrefab) as GameObject; ShotFeedbackUnit sfu = go.GetComponent <ShotFeedbackUnit>(); if (sfu != null) { sfu.SetMulticoloredText(feedbackText); sfu.SetPosition(Camera.main.WorldToViewportPoint(feedbackPosition)); ConfigureShotFeedback(feedbackType, sfu); sfu.AdjustGUISize(); } return(go); }
public GameObject SpawnShotFeedback(string feedbackText, Vector3 feedbackPosition, ShotFeedbackTypes feedbackType) { GameObject go = Instantiate(shotFeedbackPrefab) as GameObject; ShotFeedbackUnit sfu = go.GetComponent <ShotFeedbackUnit>(); if (sfu != null) { sfu.SetText(feedbackText); Vector3 vector = Camera.main.WorldToViewportPoint(feedbackPosition); vector.x = Mathf.Clamp(vector.x, 0.1f, 0.9f); sfu.SetPosition(vector); ConfigureShotFeedback(feedbackType, sfu); sfu.AdjustGUISize(); } return(go); }