public bool Shoot() { if (!m_gun.Shoot()) { return(false); } FireType fireType = m_gun.Config.FireType; if (fireType == FireType.RayTrace) { RaycastHit hit; Debug.DrawRay(transform.TransformPoint(m_gun.Config.MuzzlePosition), transform.forward * 10.0f, Color.red, 5.0f); if (!Physics.Raycast(transform.TransformPoint(m_gun.Config.MuzzlePosition), transform.forward, out hit)) { return(true); } Debug.DrawLine(transform.TransformPoint(m_gun.Config.MuzzlePosition), hit.point, Color.yellow, 5.0f); Debug.LogWarning("Hit object " + hit.collider.gameObject); IDamage damageable = hit.transform.GetComponent <IDamage>(); if (damageable == null) { damageable = hit.transform.GetComponentInParent <IDamage>(); if (damageable == null) { return(true); } } damageable.Take(m_gun.Config.Damage); } else if (fireType == FireType.Projectile) { } return(true); }