private void DestroyEverything() { if (spoutSender != System.IntPtr.Zero) { GraphicEventManager.IssuePluginEvent((int)NativePluginBridge.SPOUT.GraphicEvent.Dispose, spoutSender); spoutSender = System.IntPtr.Zero; } // Unregister delegates properly GetTextureByOnRenderImage getTextureComponent = gameObject.GetComponent <GetTextureByOnRenderImage>(); if (getTextureComponent != null) { getTextureComponent.UnregisterDelegates(); } // Don't bother to destroy managed components in case of game starting if (!EditorApplication.isPlayingOrWillChangePlaymode) { MonoBehaviourManager.DestroyManagedComponent <GetTextureByOnRenderImage>(gameObject, null); } Utils.DestroyUnityObject(blitMaterial); Utils.DestroyUnityObject(sharedTexture); }
private void destroyEverything() { // Make sure to unregister GetTextureByAsyncReadback getTextureComponent = gameObject.GetComponent <GetTextureByAsyncReadback>(); if (getTextureComponent != null) { getTextureComponent.UnregisterDelegates(); } // Don't bother to destroy managed components in case of game starting if (!EditorApplication.isPlayingOrWillChangePlaymode) { MonoBehaviourManager.DestroyManagedComponent <GetTextureByAsyncReadback>(gameObject, null); } if (ndiSender != IntPtr.Zero) { NativePluginBridge.NDI.DestroySender(ndiSender); ndiSender = IntPtr.Zero; } }
IEnumerator ShootStartIE() { while (_wave > 0) { var bullet = PoolManager.InstantiateGameObject(_bullet, PoolType.Bullet); MonoBehaviourManager.Add(bullet.GetComponent <BulletBase>(), _bulletDamage, _targetLayer); bullet.transform.position = transform.position; bullet.transform.right = _bulletDir; _wave--; if (_intervalTime != 0) { float timeCount = 0; while (timeCount < _intervalTime) { timeCount += GameManager.DeltaTime; yield return(null); } } //yield return new WaitForSeconds(_intervalTime); } ShootEnd = true; }
private void Start() { string path = ""; switch (Type) { case EnemyType.怪物: MonsterConfig mCfg = MonsterConfig.GetData(EnemyId); path = PathManager.RolePrefabsPath + mCfg.Name + "/" + mCfg.Name; break; case EnemyType.Boss: BossConfig bCfg = BossConfig.GetData(EnemyId); path = PathManager.RolePrefabsPath + bCfg.Name + "/" + bCfg.Name; break; } var obj = ResourceManager.Load <GameObject>(path); var go = GameObject.Instantiate(obj); go.transform.SetParent(transform, false); var character = go.GetComponent <Character>(); MonoBehaviourManager.Add(character); }
public static void StopOtherTime(MonoEntity mono, bool value) { MonoBehaviourManager.SetOtherAnimatorSpeed(mono, value?0:1); IsTimeStop = value; }
void OnDestroy() { MonoBehaviourManager.WipeCleanManagedComponents(gameObject); }
void OnDisable() { MonoBehaviourManager.WipeCleanManagedComponents(gameObject); }
private void DestroyManagedComponents(System.Action callback) { MonoBehaviourManager.WipeCleanManagedComponents(gameObject); callback.Invoke(); }
void OnDestroy() { MonoBehaviourManager.Remove(this); }
void OnEnable() { MonoBehaviourManager.Add(this); }
public virtual void OnDestory() { MonoBehaviourManager.Remove(this); }