public static IEnumerator FlashOutlineWhiteForSeconds(SpriteOutline outline, float seconds) { var outlineColor = outline.color; outline.color = Color.white; outline.Regenerate(); yield return(new WaitForSeconds(seconds)); outline.color = outlineColor; outline.Regenerate(); }
public override void OnInspectorGUI() { DrawDefaultInspector(); EditorGUILayout.Space(); GUIStyle hr = new GUIStyle(GUI.skin.box); hr.border.top = 0; hr.border.bottom = 0; hr.margin.top = 0; hr.margin.bottom = 8; hr.stretchWidth = true; hr.fixedHeight = 1; Color originalColor = GUI.color; GUI.color = Color.black; GUILayout.Box("", hr); GUI.color = originalColor; GUILayout.Label("Editor Actions:"); if (GUILayout.Button("Regenerate")) { System.Array.ForEach(targets, target => { SpriteOutline outline = (SpriteOutline)target; outline.Regenerate(); }); } if (GUILayout.Button("Export")) { System.Array.ForEach(targets, target => { SpriteOutline outline = (SpriteOutline)target; outline.Export(); }); } if (GUILayout.Button("Clear")) { System.Array.ForEach(targets, target => { SpriteOutline outline = (SpriteOutline)target; outline.Clear(); }); } EditorGUILayout.Space(); }
// Start is called before the first frame update public override void Start() { base.Start(); SpawnManager.instance.RegisterEnemy(this); outline = this.sprite.GetComponent <SpriteOutline>(); outline.size = 3; outline.enabled = hasShield; if (!outline.enabled) { outline.Clear(); } ColorUtility.TryParseHtmlString(ShieldColorMap.map[this.shieldColor], out outline.color); outline.Regenerate(); }