private void InitPieceShow(Piece pieceData) { //不是自己的棋子 不能拖 if (m_pvpProxy.GetSelfColor() != pieceData.color) { var collider = GetComponent <CapsuleCollider>(); if (collider != null) { collider.enabled = false; } } SetPiecePos(pieceData.x, pieceData.y); if (m_target == null) { App.ObjectPoolManager.RegisteObject("m_target", "FX/m_target", 0, 30, -1); App.ObjectPoolManager.Instantiate("m_target", (GameObject obj) => { //obj.SetActive(true); obj.transform.parent = transform; obj.transform.localPosition = Vector3.zero; obj.transform.localScale = new Vector3(2, 1.5f, 1); m_target = obj; }); } }
public void InitView(GameObject gameObject, Piece pieceData, bool pve = false) { isPVE = pve; m_gameObject = gameObject; //m_gameObject.transform.localRotation = Quaternion.Euler(0, 180, 0); m_Attack = gameObject.transform.Find("m_Attack").gameObject; m_pvpProxy = App.Facade.RetrieveProxy("PVPProxy") as PVPProxy; selfColor = m_pvpProxy.GetSelfColor(); m_type = pieceData.type; pieceColor = pieceData.color; InitPieceShow(pieceData); m_name = m_X + "_" + m_Z; m_mediator = new PieceItemMediator(this, m_name); App.Facade.RegisterMediator(m_mediator); m_mediator.InitPieceData(pieceData); OpenView(); }