/// <summary> /// 走向传送门 /// </summary> void GoToPortal() { var targetPos = this.m_PlayerBehaviour.WalkToPosition.Value; Vector3 from = new Vector3(targetPos.x, this.m_PlayerBehaviour.ThisTransform.position.y, targetPos.z); if (Vector3.Distance(this.m_PlayerBehaviour.ThisTransform.position, this.m_PlayerBehaviour.WalkToPosition.Value) >= ConfigDefineManager.DISTANCE_ARRIVED_TARGET) { //var targetPos = this.m_PlayerBehaviour.WalkToPosition.Value; //Vector3 from = new Vector3(targetPos.x, this.m_PlayerBehaviour.ThisTransform.position.y, targetPos.z); m_moveVector = from - this.m_PlayerBehaviour.ThisTransform.position; m_moveVector.y = 0; m_moveVector.Normalize(); UpdateRotation(targetPos); //this.m_PlayerBehaviour.ThisTransform.rotation = Quaternion.LookRotation(from - this.m_PlayerBehaviour.ThisTransform.position, Vector3.up); //this.m_PlayerBehaviour.ThisTransform.rotation = Quaternion.Slerp(this.m_PlayerBehaviour.ThisTransform.rotation // , Quaternion.LookRotation(from - this.m_PlayerBehaviour.ThisTransform.position, Vector3.up), Time.deltaTime * 10); } else { this.m_PlayerBehaviour.WalkToPosition = null; //Send Portal To Service var portalBehaviour = this.m_PlayerBehaviour.TargetSelected.Target.GetComponent <PortalBehaviour>(); if (portalBehaviour != null) { SMsgPropCreateEntity_SC_Channel dataModel = (SMsgPropCreateEntity_SC_Channel)portalBehaviour.PortalDataModel; NetServiceManager.Instance.EntityService.SendEnterPortal(dataModel.SMsg_Header.uidEntity); } else { //TraceUtil.Log("没找到PortalBehaviour组件"); } } }
void OnTriggerEnter(Collider collidObject) { if (GameManager.Instance.UseJoyStick) { PlayerBehaviour pb = collidObject.GetComponent <PlayerBehaviour>(); if (null != pb) { if (pb.IsHero) { SMsgPropCreateEntity_SC_Channel dataModel = (SMsgPropCreateEntity_SC_Channel)this.PortalDataModel; NetServiceManager.Instance.EntityService.SendEnterPortal(dataModel.SMsg_Header.uidEntity); } } } }
void ResetPortalObjcetStatus(INotifyArgs inotifyArgs) { EntityDataUpdateNotify entityDataUpdateNotify = (EntityDataUpdateNotify)inotifyArgs; if (entityDataUpdateNotify.nEntityClass == TypeID.TYPEID_CHUNNEL) { foreach (EntityModel child in m_portalList) { if (child != null) { SMsgPropCreateEntity_SC_Channel sMsgPropCreateEntity_SC_Channel = (SMsgPropCreateEntity_SC_Channel)child.EntityDataStruct; bool Active = sMsgPropCreateEntity_SC_Channel.ChannelValue.MAST_FIELD_VISIBLE_STATE == 0 ? true : false; if (child.GO.activeSelf != Active) { child.GO.SetActive(Active); } } } } }