public void SoundEvent(string sound_name) { if (!this.m_AudioSource) { return; } if (!this.m_Sounds.ContainsKey(sound_name)) { DebugUtils.Assert("Can't find sound - " + sound_name, true, DebugUtils.AssertType.Info); return; } List <AudioClip> list = this.m_Sounds[sound_name]; if (list.Count == 0) { DebugUtils.Assert("Missing clips of sound - " + sound_name, true, DebugUtils.AssertType.Info); return; } AudioClip audioClip = list[UnityEngine.Random.Range(0, list.Count)]; if (this.m_HumanAI) { this.m_HumanAI.m_HumanAISoundModule.PlaySound(audioClip); return; } this.m_AudioSource.Stop(); this.m_AudioSource.clip = audioClip; this.m_AudioSource.Play(); if (this.m_Log) { CJDebug.Log("SoundEvent " + audioClip.name); } }
public static void Log(string message) { CJDebug.OutputDebugString(message); Debug.Log(message); CJDebug.m_Log += "\n"; CJDebug.m_Log += message; }
public static bool Assert(bool condition, string msg, bool show_stack = true, DebugUtils.AssertType type = DebugUtils.AssertType.Info) { if (condition) { return(false); } CJDebug.Log(msg); return(true); }
private void TryGiveDamage() { if (base.transform.position.Distance(this.m_Player.transform.position) > this.m_Agent.stoppingDistance) { return; } DamageInfo damageInfo = new DamageInfo(); damageInfo.m_Damager = base.gameObject; damageInfo.m_Damage = ((ShamanManager.Get().m_AttackVersion == ShamanManager.AttackVersion.Fast) ? 5f : 20f); this.m_Player.TakeDamage(damageInfo); CJDebug.Log("TryGiveDamage"); }
public void AnimEvent(AnimEventID event_id) { for (int i = 0; i < this.m_AnimEventsReceivers.Length; i++) { if (this.m_AnimEventsReceivers[i].IsActive() || this.m_AnimEventsReceivers[i].ForceReceiveAnimEvent()) { this.m_AnimEventsReceivers[i].OnAnimEvent(event_id); } } if (this.m_Log) { CJDebug.Log("AnimEvent " + event_id.ToString()); } }
public GameObject GetPrefab(string name) { if (!this.m_PrefabsPathMap.ContainsKey(name.ToLower())) { CJDebug.Log("GreenHellGame::GetPrefab prefab doesn't exist in map"); return(null); } GameObject result = null; if (this.m_LoadAllPrefabs) { this.m_AllPrefabsMap.TryGetValue(name.ToLower(), out result); } else { result = (Resources.Load(this.m_PrefabsPathMap[name.ToLower()]) as GameObject); } return(result); }
public void AnimEvent(AnimationEvent anim_event) { if (!this.m_ThisFrameIntAnimEvents.CheckAndStore(anim_event.intParameter)) { for (int i = 0; i < this.m_AnimEventsReceivers.Length; i++) { if (this.m_AnimEventsReceivers[i].IsActive() || this.m_AnimEventsReceivers[i].ForceReceiveAnimEvent()) { this.m_AnimEventsReceivers[i].OnAnimEvent((AnimEventID)anim_event.intParameter); } } } for (int j = 0; j < this.m_AnimEventsReceiversEx.Length; j++) { if (this.m_AnimEventsReceiversEx[j].IsActive() || this.m_AnimEventsReceiversEx[j].ForceReceiveAnimEvent()) { this.m_AnimEventsReceiversEx[j].OnAnimEventEx(anim_event); } } if (this.m_Log) { CJDebug.Log("AnimEvent " + anim_event.intParameter.ToString()); } }