protected virtual async Task FireColorChangeEventAsync(object sender, ServerChatColorChangeEventArgs args) { if (ColorChangeEvent != null) { await ColorChangeEvent?.Invoke(sender, args); } }
private void Reset() { spriteRenderers = GetComponentsInChildren <SpriteRenderer>(); lightRenderers = GetComponentsInChildren <Light>(); trailRenderers = GetComponentsInChildren <TrailRenderer>(); particleRenderers = GetComponentsInChildren <ParticleSystem>(); if (currentColor == null) { currentColor = new ColorChangeEvent(); } if (spriteRenderers != null && spriteRenderers.Length > 0) { currentColor.Value = spriteRenderers[0].color; } else if (lightRenderers != null && lightRenderers.Length > 0) { currentColor.Value = lightRenderers[0].color; } else if (trailRenderers != null && trailRenderers.Length > 0) { currentColor.Value = trailRenderers[0].startColor; } else if (particleRenderers != null && particleRenderers.Length > 0) { currentColor.Value = particleRenderers[0].main.startColor; } else { currentColor.Value = Color.white; } }
public void FireEvent(int id) { Color color = Color.clear; switch (id) { case 0: color = Color.blue; break; case 1: color = Color.green; break; case 2: color = Color.black; break; case 3: color = Color.grey; break; case 4: color = Color.red; break; } ColorChangeEvent colorChangeEvent = new ColorChangeEvent(color); EventManager.Fire(colorChangeEvent); }
private async Task FireServerChatColorChangeEventAsync(object sender, ServerChatColorChangeEventArgs args) { if (ColorChangeEvent != null) { await ColorChangeEvent?.Invoke(sender, args); } }
private void HandleOnColorChangeEvent(ColorChangeEvent colorChangeEvent) { _meshRenderer.material.color = colorChangeEvent.Color; }
private static void OnChange() { ColorChangeEvent?.Invoke(); }