public override void Initialize() { base.Initialize(); var overlay = new EffectOverlay(this, prototypeManager, _mapManager); overlayManager.AddOverlay(overlay); }
public override void Initialize() { base.Initialize(); IoCManager.InjectDependencies(this); var overlay = new EffectOverlay(this); overlayManager.AddOverlay(overlay); }
public override void Initialize() { base.Initialize(); SubscribeNetworkEvent <EffectSystemMessage>(CreateEffect); SubscribeLocalEvent <EffectSystemMessage>(CreateEffect); var overlay = new EffectOverlay(this, prototypeManager, _mapManager); overlayManager.AddOverlay(overlay); }
IEnumerator DamageOverlayRoutine(EffectOverlay eff) { effectOverlayList.Add(eff); float duration = 0; while (duration < 1) { eff.pos += new Vector3(0, 1.5f * Time.deltaTime, 0); eff.color.a = 1 - duration; duration += Time.deltaTime * 1.5f; yield return(null); } effectOverlayList.Remove(eff); }
public void OnEffectOverlay(EffectOverlay eff) { effectOverlayList.Add(eff); if (!eff.useColor) { //StartCoroutine(DamageOverlayRoutine(eff, eff.pos, eff.msg, color)); eff.color = UI.colorH; StartCoroutine(DamageOverlayRoutine(eff)); } else { //StartCoroutine(DamageOverlayRoutine(eff, eff.pos, eff.msg, eff.color)); StartCoroutine(DamageOverlayRoutine(eff)); } }
void DrawOverlay() { GUIStyle style = new GUIStyle(); style.fontStyle = FontStyle.Bold; style.alignment = TextAnchor.UpperCenter; style.fontSize = 16; for (int i = 0; i < effectOverlayList.Count; i++) { EffectOverlay effect = effectOverlayList[i]; Camera cam = CameraControl.GetActiveCamera(); Vector3 screenPos = cam.WorldToScreenPoint(effect.pos); screenPos.y = Screen.height - screenPos.y; style.normal.textColor = new Color(0, 0, 0, effect.color.a); GUI.Label(new Rect(screenPos.x - 50 + 2, screenPos.y + 2, 100, 40), effect.msg, style); style.normal.textColor = effect.color; GUI.Label(new Rect(screenPos.x - 50, screenPos.y, 100, 40), effect.msg, style); } }
IEnumerator DamageOverlayRoutine(EffectOverlay eff){ effectOverlayList.Add(eff); float duration=0; while(duration<1){ eff.pos+=new Vector3(0, 1.5f*Time.deltaTime, 0); eff.color.a=1-duration; duration+=Time.deltaTime*1.5f; yield return null; } effectOverlayList.Remove(eff); }
public void OnEffectOverlay(EffectOverlay eff){ effectOverlayList.Add(eff); if(!eff.useColor){ //StartCoroutine(DamageOverlayRoutine(eff, eff.pos, eff.msg, color)); eff.color=UI.colorH; StartCoroutine(DamageOverlayRoutine(eff)); } else{ //StartCoroutine(DamageOverlayRoutine(eff, eff.pos, eff.msg, eff.color)); StartCoroutine(DamageOverlayRoutine(eff)); } }