public PetAutoPath GetAutoPathComp() { if (m_AutoPath == null) { m_AutoPath = gameObject.AddComponent <PetAutoPath>(); } return(m_AutoPath); }
public virtual void Init(GameObject playerGo, int guid) { m_Guid = guid; m_PlayerGo = playerGo; m_Player = playerGo.GetComponent <Player>(); m_Rigidbody2D = GetComponent <Rigidbody2D>(); m_CircleCollider2D = GetComponent <CircleCollider2D>(); m_Animator = GetComponentInChildren <Animator>(); m_AutoPath = gameObject.AddComponent <PetAutoPath>(); m_LockPosGo = playerGo.transform.Find("PetNode"); CircleRadio = m_CircleCollider2D.radius * transform.localScale.x; m_NameNode = transform.Find(GameConstVal.NameNode); }