protected virtual void CheckCanvasAndGraphicsRaycaster() { Canvas v_canvas = GetComponent <Canvas>(); UnityEngine.UI.GraphicRaycaster v_graphicsRayCaster = GetComponent <UnityEngine.UI.GraphicRaycaster>(); if (!FullScreenRendering) { if (v_graphicsRayCaster != null) { KiltUtils.DestroyImmediate(v_graphicsRayCaster); } if (v_canvas != null) { KiltUtils.Destroy(v_canvas); } } else { if (v_canvas == null) { v_canvas = gameObject.AddComponent <Canvas>(); } if (v_graphicsRayCaster == null) { v_graphicsRayCaster = gameObject.AddComponent <UnityEngine.UI.GraphicRaycaster>(); } } }
public virtual bool HideParticleAuraRadius() { bool v_sucess = false; if (_currentRadiusAura != null) { KiltUtils.DestroyImmediate(_currentRadiusAura); _currentRadiusAura = null; v_sucess = true; } return(v_sucess); }
public static void UnregisterFragment(Fragment p_frag, bool p_forceDestroy = false) { if (p_frag != null) { m_currentAmountOfFragmentsInScene--; m_currentAmountOfFragmentsInScene = Mathf.Max(0, m_currentAmountOfFragmentsInScene); if (p_forceDestroy) { KiltUtils.DestroyImmediate(p_frag.gameObject); } } }
public bool Cut() { if (RopeParent != null) { return(RopeParent.CutNode(this.gameObject)); } else { KiltUtils.DestroyImmediate(this.gameObject); } return(true); }
protected virtual void PlaySoundInternal(AudioClip p_sound, bool p_isLoop = false, bool p_oneSoundOfThisTypeOnly = true , GameObject p_caller = null, float p_spartialBlend = 0.0f) { if(p_sound == null || (!p_isLoop && (EffectVolume <= 0 || EffectSoundIsMuted))) //Prevent Play When Muted to avoid Unnecessary Lag return; if(p_caller == null) p_caller = this.gameObject; //Check If any sound of this AudioClip is playing if(p_oneSoundOfThisTypeOnly) { foreach(AudioSource v_source in m_soundEffectsSource) { if(v_source != null && v_source.clip == p_sound && v_source.isPlaying) return; else if (v_source == null || !v_source.isPlaying) _needCleanAudio = true; } } //Find Any Source that is not playing AudioSource[] v_callerSources = p_caller.GetComponents<AudioSource>(); AudioSource v_hostSource = null; foreach(AudioSource v_callerSource in v_callerSources) { if(v_callerSource != null && !v_callerSource.isPlaying) { //MarkToDestroy not Playing when HostSource != null if(v_hostSource != null) { KiltUtils.DestroyImmediate(v_callerSource); _needCleanAudio = true; } //Found One HostSource To PlaySound else v_hostSource = v_callerSource; } } //Add New AudioSource if not found if(v_hostSource == null) v_hostSource = p_caller.AddComponent<AudioSource>(); v_hostSource.spatialBlend = Mathf.Clamp(p_spartialBlend, 0, 1f); v_hostSource.clip = p_sound; v_hostSource.loop = p_isLoop; v_hostSource.volume = EffectVolume; v_hostSource.mute = EffectSoundIsMuted; v_hostSource.playOnAwake = false; v_hostSource.Play(); m_soundEffectsSource.AddChecking(v_hostSource); }