public void Spawn(int a_onlineId, eCharType a_type, bool a_isOwnPlayer)
    {
        m_id          = a_onlineId;
        m_isOwnPlayer = a_isOwnPlayer;
        m_type        = a_type;
        GameObject prefab = GetPrefab();

        if (null != prefab)
        {
            if (null != m_avatar)
            {
                Object.Destroy(m_avatar);
            }
            m_avatar = (GameObject)Object.Instantiate(prefab, base.transform.position, base.transform.rotation);
            m_avatar.transform.parent = base.transform;
            m_animControl             = m_avatar.GetComponent <BodyHeadAnim>();
            m_animControl2            = m_avatar.GetComponent <CharAnim2>();
            m_sound = m_avatar.GetComponent <CharSounds>();
            if (m_isOwnPlayer)
            {
                m_itemPopupGui = (PopupItemGUI)Object.FindObjectOfType(typeof(PopupItemGUI));
                m_quitGameGui  = (QuitGameGUI)Object.FindObjectOfType(typeof(QuitGameGUI));
            }
            else
            {
                base.gameObject.layer = m_avatar.layer;
            }
            if (null != m_animControl)
            {
                m_animControl.Init(m_isOwnPlayer);
            }
        }
    }
 public void SetOnOff(bool a_on)
 {
     if (m_on == a_on)
     {
         return;
     }
     m_on = a_on;
     if (m_on)
     {
         Init();
     }
     if (m_type == eMissiontype.eKill || m_type == eMissiontype.eRescue)
     {
         int        num        = (int)m_objPerson % 2;
         GameObject gameObject = (m_type != eMissiontype.eKill) ? m_runawayPrefabs[num] : m_ragdollPrefabs[num];
         if (null != m_char)
         {
             Object.Destroy(m_char);
         }
         m_char = (GameObject)Object.Instantiate((!m_on) ? gameObject : m_charPrefabs[num], base.transform.position, base.transform.rotation);
         if (m_on)
         {
             Renderer[] componentsInChildren = m_char.GetComponentsInChildren <Renderer>();
             for (int i = 0; i < componentsInChildren.Length; i++)
             {
                 if (null != componentsInChildren[i])
                 {
                     componentsInChildren[i].gameObject.layer = 22;
                 }
             }
         }
         BodyHeadAnim bodyHeadAnim = (BodyHeadAnim)m_char.GetComponent(typeof(BodyHeadAnim));
         if (null != bodyHeadAnim)
         {
             bodyHeadAnim.ChangeHeadItem((int)m_objPerson);
         }
     }
     else if (m_type == eMissiontype.eDestroy && !m_on)
     {
         Vector3    position    = base.transform.position + Vector3.up * 0.5f + (Camera.main.transform.position - base.transform.position) * 0.25f;
         GameObject gameObject2 = (GameObject)Object.Instantiate(m_explosionPrefab, position, Quaternion.identity);
         gameObject2.transform.parent = Camera.main.transform;
     }
     UpdateGameObjects();
 }