Beispiel #1
0
        protected void InitView()
        {
            m_cHangPoint = gameObject.AddComponentOnce <HangPoint>();
            m_cHangPoint.Init(m_sPrefab);
            m_cCollider = ObjectPool <GameCollider> .Instance.GetObject();

            m_cCollider.Init(m_sPrefab);
            m_cCollider.Update(curPosition, curForward);

            GameObjectPool.Instance.GetObject(m_sPrefab, OnResLoad);
        }
Beispiel #2
0
        protected void DisposeView()
        {
            if (m_cCollider != null)
            {
                ObjectPool <GameCollider> .Instance.SaveObject(m_cCollider);

                m_cCollider = null;
            }
            m_cHangPoint.Clear();
            if (m_cView != null)
            {
                GameObjectPool.Instance.SaveObject(m_sPrefab, m_cView);
                m_cView = null;
            }
            GameObjectPool.Instance.RemoveCallback(m_sPrefab, OnResLoad);
        }
Beispiel #3
0
        public void Init(uint id, int configId, int campId, TSVector position, TSVector forward, uint targetAgentId, AgentObjectType targetAgentType, TSVector targetPosition, TSVector targetForward)
        {
            m_nId                = id;
            m_nConfigId          = configId;
            m_nCampId            = campId;
            this.gameObject.name = "remote_" + m_nId + "_" + m_nConfigId;
            m_cRemoteTree        = RemoteTreePool.Instance.GetRemoteTree(m_nConfigId);
            m_cRemoteData        = m_cRemoteTree.data as RemoteData;
            m_cAgentObj          = new AgentRemote(this);
            SetPosition(position);
            SetViewPosition(position);
            m_sLastPosition = position;
            SetForward(forward);
            SetViewForward(forward);
            m_sLastForward = forward;
            if (m_cBlackBoard == null)
            {
                m_cBlackBoard = new RemoteBlackBoard(this);
            }

            m_cTarget         = AgentObject.GetAgentObject(targetAgentId, targetAgentType);
            m_sTargetPosition = targetPosition;
            m_sTargetForward  = targetForward;
            m_cView           = SceneEffectPool.Instance.CreateEffect(m_cRemoteData.remotePath, false, this.transform);
            m_cLerpView       = gameObject.AddComponentOnce <LerpMoveView>();
            m_cLerpView.Init();
            m_cLerpView.StopMove();

            m_cHangPoint = gameObject.AddComponentOnce <HangPoint>();
            string remoteFullPath = PathTool.GetSceneEffectPath(m_cRemoteData.remotePath);

            m_cHangPoint.Init(remoteFullPath);
            //暂时不支持表现挂点(特效上挂特效)
            m_cHangPoint.InitHangView(null);

            m_cCollider = ObjectPool <GameCollider> .Instance.GetObject();

            m_cCollider.Init(remoteFullPath);
            m_cCollider.Update(curPosition, curForward);
        }
Beispiel #4
0
        public void Reset()
        {
            if (m_cView != null)
            {
                SceneEffectPool.Instance.DestroyEffectGO(m_cView);
                m_cView = null;
            }
            if (m_cCollider != null)
            {
                ObjectPool <GameCollider> .Instance.SaveObject(m_cCollider);

                m_cCollider = null;
            }
            m_cLerpView.StopMove();
            m_cBlackBoard.Clear();
            m_cHangPoint.Clear();
            m_cTarget = null;
            RemoteTreePool.Instance.SaveRemoteTree(m_nConfigId, m_cRemoteTree);
            m_cRemoteData = null;
            m_cRemoteTree = null;
            ClearAgent();
        }
Beispiel #5
0
        public bool CheckCollider(GameCollider otherCollider, out TSVector sCrossPoint)
        {
            sCrossPoint = otherCollider.center;
            TSVector2 sCenter2     = new TSVector2(otherCollider.center.x, otherCollider.center.z);
            TSVector2 sCrossPoint2 = sCenter2;

            for (int i = m_lstColliders.Count - 1; i > -1; i--)
            {
                var collider2        = m_lstColliders[i];
                var lstOtherCollders = otherCollider.lstCollider;
                for (int j = 0; j < lstOtherCollders.Count; j++)
                {
                    if (collider2.CheckCollider(lstOtherCollders[j]))
                    {
                        collider2.CheckLine(sCenter2, collider2.center - sCenter2, out sCrossPoint2);
                        sCrossPoint.x = sCrossPoint2.x;
                        sCrossPoint.z = sCrossPoint2.y;
                        return(true);
                    }
                }
            }
            return(false);
        }