private void SphereCastAll() { for (int i = 0; i < this.ids.get_Count(); i++) { EntityParent entityByID = EntityWorld.Instance.GetEntityByID(this.ids.get_Item(i)); if (entityByID != null) { ShaderEffectUtils.SetFadeRightNow(entityByID.alphaControls, false); } } Ray ray = new Ray(base.get_transform().get_position(), base.get_transform().get_forward()); float num = Vector3.Distance(this.GetRolePositionWithHeight(), base.get_transform().get_position()); RaycastHit[] array = Physics.SphereCastAll(ray, 0.5f, num); string text = string.Empty; RaycastHit[] array2 = array; for (int j = 0; j < array2.Length; j++) { RaycastHit raycastHit = array2[j]; ActorParent component = raycastHit.get_collider().get_gameObject().GetComponent <ActorParent>(); if (!(component == null)) { if (component is ActorMonster || component is ActorCityPlayer) { text = text + raycastHit.get_collider().get_gameObject().get_name() + ", "; ShaderEffectUtils.SetFadeRightNow(component.GetEntity().alphaControls, true); this.ids.Add(component.GetEntity().ID); } } } }
public void AddEnemy(int actorType, Transform actorRoot, ActorParent actorParent, float height, long uuid, bool isTarget, bool isShowOfLogic) { if (!SystemConfig.IsBillboardOn) { return; } this.RemoveEnemy(uuid, actorRoot); if (EntityWorld.Instance.EntSelf == null) { return; } if (!EntityWorld.Instance.EntSelf.IsInBattle) { return; } if (actorType == 51 || actorType == 5 || actorType == 6 || actorType == 61) { EnemyInScreenUnit enemyInScreenUnit = this.Create2Enemy(actorRoot, height, uuid); enemyInScreenUnit.SetUUID(uuid); enemyInScreenUnit.SetTargetPosition(actorRoot, actorParent); enemyInScreenUnit.SetFlag(isTarget, false); enemyInScreenUnit.Show(actorRoot.get_gameObject().get_activeInHierarchy() && isShowOfLogic); } else if (actorType == 53 || actorType == 3 || actorType == 4 || actorType == 62) { EnemyInScreenUnit enemyInScreenUnit2 = this.Create2Enemy(actorRoot, height, uuid); enemyInScreenUnit2.SetUUID(uuid); enemyInScreenUnit2.SetTargetPosition(actorRoot, actorParent); enemyInScreenUnit2.SetFlag(isTarget, true); enemyInScreenUnit2.Show(actorRoot.get_gameObject().get_activeInHierarchy() && isShowOfLogic); } }
public void OnDestroy() { this.RemoveListners(); TimerHeap.DelTimer(this.timerID); this.owner = null; this.ownerActor = null; }
public void SetCollider(ActorParent theActor, CharacterController controller, float height) { this.Actor = theActor; this.detectCollisionTrigger = base.get_gameObject().AddMissingComponent <BoxCollider>(); this.detectCollisionTrigger.set_isTrigger(false); this.detectCollisionTrigger.set_center(new Vector3(0f, height * 0.5f, 0f)); this.detectCollisionTrigger.set_size(new Vector3(controller.get_radius() * Mathf.Sqrt(2f), height, controller.get_radius() * Mathf.Sqrt(2f))); }
public void SetCushion(ActorParent theActor, CharacterController controller) { this.Actor = theActor; BoxCollider boxCollider = base.get_gameObject().AddMissingComponent <BoxCollider>(); boxCollider.set_isTrigger(true); boxCollider.set_center(new Vector3(0f, controller.get_center().y, (controller.get_radius() + 0.5f) / 2f)); boxCollider.set_size(new Vector3(controller.get_radius() * 2f, controller.get_height(), controller.get_radius() + 0.5f)); }
private float GetBossHeight(Transform boss) { ActorParent component = boss.GetComponent <ActorParent>(); if (component) { return(component.CameraPointHeight); } return(0f); }
public static void ShowShadow(long uuid, ActorParent actorParent, bool bHideShadow, int modelId = 0) { if (actorParent is ActorMonster && (actorParent as ActorMonster).GetEntity().IsLogicBoss) { ShadowController.ShowShadow(uuid, actorParent.FixTransform, actorParent, bHideShadow, modelId); } else { ShadowController.ShowShadow(uuid, actorParent.FixTransform, null, bHideShadow, modelId); } }
private void OnTriggerExit(Collider other) { if (other.get_gameObject().get_layer() != LayerSystem.NameToLayer("Default") && other.get_gameObject().get_layer() != LayerSystem.NameToLayer("Terrian")) { ActorParent component = other.get_transform().GetComponent <ActorParent>(); if (component && this.Actor && component != this.Actor && component.FixGameObject.get_layer() != this.Actor.FixGameObject.get_layer()) { this.Actor.OnCushionExit(component); } } }
private void OnTriggerStay(Collider other) { if (other.get_gameObject().get_layer() != LayerSystem.NameToLayer("Default") && other.get_gameObject().get_layer() != LayerSystem.NameToLayer("Terrian")) { ActorParent component = other.get_transform().GetComponent <ActorParent>(); if (component && this.Actor && component != this.Actor && component.FixGameObject.get_layer() != this.Actor.FixGameObject.get_layer() && XUtility.DistanceNoY(other.get_transform().get_position(), base.get_transform().get_position()) < XUtility.GetTriggerRadius(other.get_transform()) + XUtility.GetTriggerRadius(base.get_transform())) { this.Actor.OnCushionStay(component); } } }
public override void LeavePlatform(Collider other) { ActorParent componentInChildren = other.get_transform().get_root().GetComponentInChildren <ActorParent>(); if (componentInChildren != null && this.passengers.Contains(componentInChildren)) { this.passengers.Remove(componentInChildren); componentInChildren.ExitPlatformArea(); base.RemoveStartPlatformEvent(new Action(componentInChildren.StartPlatformTrip)); base.RemoveEndPlatformEvent(new Action(componentInChildren.FinishPlatformTrip)); } }
public override void EnterPlatform(Collider other) { ActorParent componentInChildren = other.get_transform().get_root().GetComponentInChildren <ActorParent>(); if (componentInChildren == null || this.passengers.Contains(componentInChildren)) { return; } Debuger.Error("add", new object[0]); this.passengers.Add(componentInChildren); componentInChildren.EnterPlatformArea(); base.AddStartPlatformEvent(new Action(componentInChildren.StartPlatformTrip)); base.AddEndPlatformEvent(new Action(componentInChildren.FinishPlatformTrip)); }
private void Pitch() { if (EntityWorld.Instance.ActSelf == null) { return; } float num = Vector3.Angle(Vector3.get_down(), base.get_transform().get_forward()); Vector3 vector = this.GetPointB() - base.get_transform().get_position(); float num2 = Vector3.Angle(Vector3.get_down(), vector); float num3 = Mathf.Clamp(num2, this.cameraAngleMin, this.cameraAngleMax); float num4 = num3 - num; float num5 = float.Parse(DataReader <GlobalParams> .Get("camera_switch_speed").value); if (!EntityWorld.Instance.ActSelf.IsJumpFollow && Mathf.Abs(num4) > num5 * Time.get_deltaTime()) { if (this.boss) { ActorParent component = this.boss.GetComponent <ActorParent>(); if (component && !component.IsJumpFollow) { float num6 = Mathf.Sign(num4); float num7 = Mathf.Abs(num4); num4 = num6 * Mathf.Min(num5, num7) * Time.get_deltaTime(); } } else { float num8 = Mathf.Sign(num4); float num9 = Mathf.Abs(num4); num4 = num8 * Mathf.Min(num5, num5) * Time.get_deltaTime(); } } if (this.isLogPitch) { Debug.Log("pitchAngle=" + num4); } Quaternion quaternion = Quaternion.AngleAxis(-num4, base.get_transform().get_right()); base.get_transform().set_forward(quaternion * base.get_transform().get_forward()); if (this.SetCameraPositionCallback != null) { this.timeReverseCounter -= Time.get_deltaTime() * 1000f; if (this.cameraPosYIncrement == 0f && Mathf.Abs(num3 - num) <= num5 * Time.get_deltaTime() && this.timeReverseCounter < 0f) { this.SetCameraPositionCallback.Invoke(); this.SetCameraPositionCallback = null; this.timeReverseCounter = 0f; } } }
/// <summary> /// 返回 角色前方,指定范围内的所有对象 /// </summary> /// <param name="t"></param> /// <param name="distance"></param> /// <param name="layerMask"></param> /// <returns></returns> static public List <uint> GetEntitiesFrontLine(Matrix4x4 ltwM, Quaternion rotation, Vector3 forward, Vector3 position, float distance, Vector3 direction, float radius = 0.5f, float offset = 0, float angleOffset = 0) { List <uint> list = new List <uint>(); RaycastHit[] hits = Physics.SphereCastAll(position, radius, direction, distance); foreach (RaycastHit hit in hits) { ActorParent entity = hit.transform.GetComponent <ActorParent>(); list.Add(entity.GetEntity().ID); } return(list); }
protected void DestoryOldCityPlayerActor() { this.ExteriorUnit.IsAutoUpdateExterior = false; if (base.Actor) { ActorParent actor = base.Actor; base.Pos = actor.FixTransform.get_position(); base.Dir = actor.FixTransform.get_forward(); actor.DestroyScript(); } else { EntityWorld.Instance.CancelGetCityPlayerActorAsync(base.AsyncLoadID); } }
public override void UpdateActor(Vector3 delta, bool isEqual) { if (delta != Vector3.get_zero()) { for (int i = 0; i < this.passengers.get_Count(); i++) { ActorParent actorParent = this.passengers.get_Item(i); Collider[] componentsInChildren = actorParent.get_transform().get_root().GetComponentsInChildren <Collider>(); for (int j = 0; j < componentsInChildren.Length; j++) { if (this.ContainsPoint(actorParent.get_transform().get_position()) || (Vector3.Dot(actorParent.get_transform().get_position() - base.get_transform().get_position(), base.get_transform().get_up()) > 0f && this.IntersectingTrigger(componentsInChildren[j]))) { actorParent.UpdatePlatform(delta, false); } } } } }
private static void ShowShadow(long uuid, Transform actorTarget, ActorParent actorParent, bool bHideShadow, int modelId = 0) { if (GameLevelManager.IsRealTimeShadowOn()) { ShadowController.SetShadowModelRender(actorTarget, bHideShadow); } else { float scale = 1f; if (modelId > 0) { AvatarModel avatarModel = DataReader <AvatarModel> .Get(modelId); if (avatarModel != null) { scale = avatarModel.projectorScale; } } ShadowSlicePlaneMgr.ShowShadowSlicePlane(uuid, actorTarget, actorParent, bHideShadow, scale); } }
public void AwakeSelf(int _type, long _uuid, long _ownerId, IActorVisible _interfaceGroup) { this.uuid = _uuid; this.ownerId = _ownerId; this.m_objType = _type; this.interfaceGroup = _interfaceGroup; if (this.IsSelfManagerType()) { this.m_actor = base.GetComponent <Actor>(); Renderer renderer = null; ShaderEffectUtils.InitShaderRenderers(base.get_transform(), this.m_listSmr, ref renderer, ref this.m_shadowSlicePlane); ShaderEffectUtils.InitTransparencys(this.m_listSmr, this.m_alphaControls); } else { this.m_actorParent = base.GetComponent <ActorParent>(); } this.m_listAnimation.AddRange(base.get_transform().GetComponentsInChildren <Animation>(true)); this.m_listAnimator.AddRange(base.get_transform().GetComponentsInChildren <Animator>(true)); this.UpdateShow(true); }
public static void ShowShadowSlicePlane(long uuid, Transform actorTarget, ActorParent actorParent, bool bHideShadow, float scale) { if (!bHideShadow) { Transform transform = actorTarget.FindChild("SP"); GameObject gameObject = (!(transform != null)) ? null : transform.get_gameObject(); if (gameObject == null) { gameObject = ResourceManager.GetInstantiate2Prefab("ShadowSlicePlane"); UGUITools.SetParent(actorTarget.get_gameObject(), gameObject, false, "SP"); Transform expr_5A = gameObject.get_transform(); expr_5A.set_localPosition(expr_5A.get_localPosition() + new Vector3(0f, 0.03f, 0f)); gameObject.get_transform().set_localEulerAngles(new Vector3(90f, 0f, 0f)); gameObject.get_transform().set_localScale(new Vector3(scale, scale, 1f)); ShadowSlicePlane shadowSlicePlane = gameObject.AddComponent <ShadowSlicePlane>(); shadowSlicePlane.uuid = uuid; shadowSlicePlane.m_root = actorTarget; shadowSlicePlane.m_actorParent = actorParent; shadowSlicePlane.m_meshRenderer = gameObject.GetComponent <MeshRenderer>(); shadowSlicePlane.SetShadowY(); } else { ShadowSlicePlane shadowSlicePlane = gameObject.GetComponent <ShadowSlicePlane>(); } gameObject.set_layer(actorTarget.get_gameObject().get_layer()); gameObject.SetActive(true); } else { Transform transform2 = actorTarget.FindChild("SP"); if (transform2 != null) { transform2.get_gameObject().SetActive(false); } } }
private int GetPriority(Transform boss) { ActorParent component = boss.GetComponent <ActorParent>(); int typeID = component.GetEntity().TypeID; int result = -1; if (component as ActorMonster) { Monster monster = DataReader <Monster> .Get(typeID); result = monster.cameraLock; } else if (component as ActorPlayer) { RoleCreate roleCreate = DataReader <RoleCreate> .Get(typeID); result = roleCreate.cameraLock; } else { Debug.Log("<color=red>Error:</color>GetPriority=NEITHER Monster NOR Player " + component); } return(result); }
public void AddBillboardsInfo(int actorType, ActorParent actorParent, float height, long uuid, bool isTarget = false, bool avc_control = true, bool isShowOfLogic = true) { ArrowManager.Instance.AddEnemy(actorType, actorParent.FixTransform, actorParent, height, uuid, isTarget, isShowOfLogic); HeadInfoManager.Instance.AddHeadInfo(actorType, actorParent.FixTransform, height, uuid, avc_control, isShowOfLogic); }
public void UpdateActor(ActorParent actor) { this.ownerActor = actor; }
public void OnCreate(EntityParent theOwner) { this.owner = theOwner; this.ownerActor = this.owner.Actor; this.AddListeners(); }
public void ServerHandleHit(long casterID, int effectID, string hitAction, int actionPriority, bool isKnock, Vector3 toPos, bool isManage, int oldManageState, int uniqueID) { if (isManage) { this.owner.CheckCancelManage(casterID, oldManageState, true); } Effect effect = DataReader <Effect> .Get(effectID); if (effect == null) { return; } bool flag = XUtility.StartsWith(hitAction, "float"); if (this.owner.IsSuspended != flag) { this.owner.IsSuspended = flag; } if (isKnock) { if (this.IsOpenLog) { Debug.LogError("Fuck1"); } if (!this.owner.IsHitMoving) { this.owner.IsHitMoving = true; } Action <Vector3, Vector3> callback = null; if (isManage) { callback = delegate(Vector3 pos, Vector3 dir) { GlobalBattleNetwork.Instance.SendEndKnock(this.owner.ID, pos, dir, uniqueID); }; } if (effect.hitMove != null && effect.hitMove.get_Count() > 1) { Debuger.Error(string.Concat(new object[] { "hitMove 1: ", this.ownerActor.FixTransform.get_position().x - toPos.x, " ", this.ownerActor.FixTransform.get_position().z - toPos.z }), new object[0]); ActorParent arg_1CC_0 = this.ownerActor; Vector3 vector = new Vector3(this.ownerActor.FixTransform.get_position().x - toPos.x, 0f, this.ownerActor.FixTransform.get_position().z - toPos.z); arg_1CC_0.ServerPlayHitMove(hitAction, vector.get_normalized(), XUtility.DistanceNoY(toPos, this.ownerActor.FixTransform.get_position()), effect.hitMove.get_Item(1), effect.hitstraight, actionPriority, callback); } else { Debuger.Error(string.Concat(new object[] { "hitMove 2: ", this.ownerActor.FixTransform.get_position().x - toPos.x, " ", this.ownerActor.FixTransform.get_position().z - toPos.z }), new object[0]); ActorParent arg_2CF_0 = this.ownerActor; Vector3 vector2 = new Vector3(this.ownerActor.FixTransform.get_position().x - toPos.x, 0f, this.ownerActor.FixTransform.get_position().z - toPos.z); arg_2CF_0.ServerPlayHitMove(hitAction, vector2.get_normalized(), XUtility.DistanceNoY(toPos, this.ownerActor.FixTransform.get_position()), 0f, effect.hitstraight, actionPriority, callback); } } else { object arg_338_0 = "hitMove 3: "; Vector3 vector3 = new Vector3(this.ownerActor.FixTransform.get_position().x - toPos.x, 0f, this.ownerActor.FixTransform.get_position().z - toPos.z); Debuger.Error(arg_338_0 + vector3.get_normalized(), new object[0]); this.ownerActor.ServerPlayHit(hitAction, effect.hitstraight, actionPriority, false); } }
public void SetTargetPosition(Transform targetPosOfWorld, ActorParent targetActorParent) { this.TargetPosOfWorld = targetPosOfWorld; this.TargetActorParent = targetActorParent; }