private void UpdateSingleTemporaryVisualEffect(ref TemporaryVisualEffect tempEffect, GameObject resource, float effectRadius, bool active, CharacterBody characterBody, string childLocatorOverride = "") { bool flag = tempEffect != null; if (flag != active) { if (active) { if (!flag) { GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(resource, characterBody.corePosition, Quaternion.identity); gameObject.SetActive(true); tempEffect = gameObject.GetComponent <TemporaryVisualEffect>(); tempEffect.parentTransform = characterBody.coreTransform; tempEffect.visualState = TemporaryVisualEffect.VisualState.Enter; tempEffect.healthComponent = characterBody.healthComponent; tempEffect.radius = effectRadius; LocalCameraEffect component = gameObject.GetComponent <LocalCameraEffect>(); if (component) { component.targetCharacter = characterBody.gameObject; } if (!string.IsNullOrEmpty(childLocatorOverride)) { ModelLocator modelLocator = characterBody.modelLocator; ChildLocator childLocator; if (modelLocator == null) { childLocator = null; } else { Transform modelTransform = modelLocator.modelTransform; childLocator = ((modelTransform != null) ? modelTransform.GetComponent <ChildLocator>() : null); } ChildLocator childLocator2 = childLocator; if (childLocator2) { Transform transform = childLocator2.FindChild(childLocatorOverride); if (transform) { tempEffect.parentTransform = transform; return; } } } } } else if (tempEffect) { tempEffect.visualState = TemporaryVisualEffect.VisualState.Exit; } } }
public void Awake() { this.temporaryVisualEffect = this.gameObject.GetComponent <TemporaryVisualEffect>(); }