public virtual void Initialize() { _destroyed = false; collider.enabled = true; isPolymorph = false; animator.gameObject.SetActive(true); _spawnedTime = 0; target = null; _attackedTarget = null; image_HealthBar.fillAmount = 1f; RendererEffect.Reset(); if (animator != null) { animator.SetFloat(AnimationHash.MoveSpeed, 0); var client = ActorProxy.Client as RWNetworkClient; var factor = client.GameState.factor; if (isAttackSpeedFactorWithAnimation) { animator.SetFloat("AttackSpeed", 1f / attackSpeed / factor); } animator.speed = factor; } _dicEffectPool.Clear(); objectHealthBar?.SetColor(ActorProxy.IsLocalPlayerAlly); }
public void PlayRendererHitEffect() { var amount = 0.0f; var targetValue = 0.7f; var duration = 0.2f; Tweener tweener = DOTween.To(() => amount, x => amount = x, targetValue, duration); tweener.OnUpdate(() => { RendererEffect.SetTintColor(Color.red, amount); }); tweener.SetLoops(2, LoopType.Yoyo).SetEase(Ease.InOutQuad); }
protected virtual void Awake() { _poolObjectAutoDeactivate = GetComponent <PoolObjectAutoDeactivate>(); objectHealthBar = GetComponentInChildren <UI_ObjectHealthBar>(); RendererEffect = new RendererEffect(gameObject); }