// ---------------------------------------------------------------------------------------------------- #endregion #region Initialization // ---------------------------------------------------------------------------------------------------- /// <summary> /// Called upon awaking this behavior. /// </summary> private void Awake() { this.spawnEffectPrefabID = spawnEffectPrefab.GetInstanceID(); this.spawnEffectPool = FeatherPoolManager.Instance.GetPool(this.spawnEffectPrefabID); this.teleportEffectPrefabID = teleportEffectPrefab.GetInstanceID(); this.teleportEffectPool = FeatherPoolManager.Instance.GetPool(this.teleportEffectPrefabID); this.playerStateController = this.GetComponent <PlayerStateController>(); this.materialController = this.GetComponent <ActorMaterialController>(); this.playerStateController.OnDisable += (dataController) => { this.materialController.PrepareSpawn(); }; this.playerStateController.OnRespawn += (dataController, spawnData) => { this.materialController.PrepareSpawn(); }; this.playerStateController.OnSpawn += (dataController, spawnData) => { if (spawnData.IsSilentSpawn) { this.spawnEffectPool.Spawn(transform.position); } this.materialController.DoSpawnEffect(spawnData.SpawnEffectMultiplier); }; this.playerStateController.OnTeleport += (dataController, targetTransform) => { var effectObject = this.teleportEffectPool.Spawn(transform.position); effectObject.GetComponent <ParticleAttractor>().TargetTransform = targetTransform; this.materialController.DoDespawnEffect(); }; }
// ---------------------------------------------------------------------------------------------------- #endregion #region Initialization // ---------------------------------------------------------------------------------------------------- /// <summary> /// Called upon awaking this behavior. /// </summary> private void Awake() { this.effectPrefabID = effectPrefab.GetInstanceID(); this.effectPool = FeatherPoolManager.Instance.GetPool(this.effectPrefabID); this.playerStateController = this.GetComponent <PlayerStateController>(); this.playerStateController.OnDeath += (dataController) => { this.effectPool.Spawn(transform.position); }; }
// ---------------------------------------------------------------------------------------------------- #endregion #region Initialization // ---------------------------------------------------------------------------------------------------- /// <summary> /// Called upon awaking this behavior. /// </summary> private void Awake() { this.effectPrefabID = effectPrefab.GetInstanceID(); this.effectPool = FeatherPoolManager.Instance.GetPool(this.effectPrefabID); this.collisionTarget = this.GetComponent <CollisionTarget>(); this.collisionTarget.OnTriggerCollision += (collisionController) => { this.effectPool.Spawn(transform.position); this.gameObject.SetActive(false); }; }
// ---------------------------------------------------------------------------------------------------- #endregion #region Initialization // ---------------------------------------------------------------------------------------------------- /// <summary> /// Called upon awaking this behavior. /// </summary> private void Awake() { this.effectPrefabID = effectPrefab.GetInstanceID(); this.effectPool = FeatherPoolManager.Instance.GetPool(this.effectPrefabID); this.playerDamageReceiver = this.GetComponent <PlayerDamageReceiver>(); this.materialController = this.GetComponent <ActorMaterialController>(); this.playerDamageReceiver.OnReceivedDamage += (damage) => { this.effectPool.Spawn(transform.position); this.materialController.DoHitEffect(); }; }