1234567891011121314151617181920212223242526272829303132333435363738 |
- using UnityEngine;
- using System.Collections;
- public class SpermicidalWaveManager : MonoBehaviour
- {
- public PoolObject spermicidalWavePrefab;
- public Transform anchor;
- public SpermicidalWaveFollower spermicidalWaveParticleSystem;
- Pool _pool;
- public CondomDispenser condomDispenser;
- #region Unity Callbacks
- void Awake()
- {
- _pool = Pool.Create(spermicidalWavePrefab, 2);
- NotificationCenter.AddListener(OnFireSpermicidalWave, NotificationType.FireSpermicidalWave);
- }
- void OnDestroy()
- {
- NotificationCenter.RemoveListener(OnFireSpermicidalWave, NotificationType.FireSpermicidalWave);
- }
- #endregion
- void OnFireSpermicidalWave(Notification note)
- {
- SoundManager.Play(SoundEvent.spermicidalWaveFire);
- PoolObject wave = _pool.Spawn();
- condomDispenser.condoms.Add(wave.GetComponent<CondomBase>());
- Transform waveTransform = wave.transform;
- spermicidalWaveParticleSystem.StartFollowing(waveTransform);
- Vector3 originalScale = waveTransform.localScale;
- waveTransform.parent = anchor;
- waveTransform.localScale = originalScale;
- waveTransform.localPosition = Vector3.zero;
- }
- }
|