/// <summary> /// 海豚飞触发条件:1.fly阶段,2.非轨迹分型阶段,3.飞出视野阶段 /// </summary> /// <param name="Angel"></param> /// <param name="isFallEnd"></param> private bool CheckDolphineFly(Vector3 Pos, bool IsTraceFly) { bool result = false; if (Pos.x > FlyLimitZone.maxX) { m_flyOutDir = FlyDir.Right; result = true; } if (Pos.x < FlyLimitZone.minX) { m_flyOutDir = FlyDir.Left; result = true; } if (Pos.y > FlyLimitZone.maxY && Pos.x > FlyLimitZone.minX && Pos.x < FlyLimitZone.maxX) { m_flyOutDir = FlyDir.Top; result = true; } if (Pos.y < FlyLimitZone.minY && Pos.x > FlyLimitZone.minX && Pos.x < FlyLimitZone.maxX) { m_flyOutDir = FlyDir.Bottom; result = true; } if (result && m_bSpawnWater == false) { m_bSpawnWater = true; Vector3 flyPos = m_Owner.m_Skin.tRoot.position; float mid = (FlyLimitZone.minX + FlyLimitZone.maxX) * 0.5f; WalkDir dir = flyPos.x < mid ? WalkDir.WALKLEFT : WalkDir.WALKRIGHT; SpawnWaterEffect(flyPos, dir, m_flyOutDir != FlyDir.Bottom); if (m_flyOutDir == FlyDir.Bottom) { m_v3SpawnWater = flyPos; } } if (IsTraceFly == true) { return(false); } return(result); }
/// <summary> /// 撞击处理 /// </summary> /// <param name="Damage">撞击伤害</param> /// <param name="dir">撞击方向</param> /// <param name="Info">返回撞击信息</param> /// <returns></returns> public override void CollisionProcByFire(Collision collision, int Damage /*,Vector2 dir*/, ref FlyCollisionInfo Info, FlyDir flydir) { //Info.bVertical = m_bVertical; Info.FlyfallSTandGridPos = GetMapPos(); Info.lifemCollision = this; SkillReleaseInfo sInfo = new SkillReleaseInfo(); sInfo.m_InterruptSkill = false; sInfo.m_MakeStatus = new List <StatusType> (); sInfo.m_bImmunity = false; sInfo.m_Damage = Damage; sInfo.Result = AttackResult.Fire; bool result = ApplyDamage(sInfo, null); if (!m_isDead) { Info.FlyfallSTandGridPos = m_Attr.Pos; Info.bVertical = false; Info.flyCollisionAction = FlyCollisionAction.DropInBoat; //Debug.Log("not dead " + Info.flyCollisionAction + "," + Info.FlyfallSTandGridPos); Info.bApplyDamage = false; } else { Info.FlyfallSTandGridPos = m_Attr.Pos; Info.bVertical = false; Info.flyCollisionAction = FlyCollisionAction.FlyDirectional; //Debug.Log(" dead " + Info.flyCollisionAction + "," +Info.FlyfallSTandGridPos); Info.bApplyDamage = false; } }
/// <summary> /// 撞击处理 /// </summary> /// <param name="Damage">撞击伤害</param> /// <param name="dir">撞击方向</param> /// <param name="Info">返回撞击信息</param> /// <returns></returns> public override void CollisionProcByFire(Collision collision, int Damage /*,Vector2 dir*/, ref FlyCollisionInfo Info, FlyDir flydir) { Role.WakeEnemy(this); Info.bVertical = true; Info.bLeft = true; Info.FlyfallSTandGridPos = new Int2(StartUnit, Layer); Info.lifemCollision = this; SkillReleaseInfo sInfo = new SkillReleaseInfo(); sInfo.m_InterruptSkill = false; sInfo.m_MakeStatus = new List <StatusType> (); sInfo.m_bImmunity = false; sInfo.m_Damage = Damage; sInfo.Result = AttackResult.Fire; ApplyDamage(sInfo, null); if (isDead) //破了 //GameObject go = SkillEffects._instance.LoadEffect("effect/prefab/", "1003021", MapGrid.GetMG(Info.FlyfallSTandGridPos).WorldPos, 1f); { GameObjectActionExcute gae = EffectM.LoadEffect(EffectM.sPath, "2000291", MapGrid.GetMG(Info.FlyfallSTandGridPos).WorldPos, BattleEnvironmentM.GetLifeMBornNode(true)); GameObjectActionEffectInit effectinit = new GameObjectActionEffectInit(); effectinit.SetRotation(new Vector3(0, 0, 90)); gae.AddAction(effectinit); GameObjectActionDelayDestory ndEffect = new GameObjectActionDelayDestory(1f); gae.AddAction(ndEffect); //go.transform.Rotate(new Vector3(0,0,90),Space.Self); Info.flyCollisionAction = FlyCollisionAction.PauseContinueFlyDirectional; Info.bApplyDamage = true; //EffectM.LoadEffect(EffectM.sPath, "zamen_02", transform.position, null); } else //没破 { shake(); //GameObject go = SkillEffects._instance.LoadEffect("effect/prefab/", "1003011", MapGrid.GetMG(Info.FlyfallSTandGridPos).WorldPos, 1f); GameObjectActionExcute gae = EffectM.LoadEffect(EffectM.sPath, "2000281", MapGrid.GetMG(Info.FlyfallSTandGridPos).WorldPos, BattleEnvironmentM.GetLifeMBornNode(true)); GameObjectActionEffectInit effectinit = new GameObjectActionEffectInit(); effectinit.SetRotation(new Vector3(0, 0, 90)); gae.AddAction(effectinit); GameObjectActionDelayDestory ndEffect = new GameObjectActionDelayDestory(1f); gae.AddAction(ndEffect); //go.transform.Rotate(new Vector3(0,0,90),Space.Self); /*if (flydir == FlyDir.Left || flydir == FlyDir.LeftTop || flydir == FlyDir.LeftBottom) * { * Info.flyCollisionAction = FlyCollisionAction.DropOutBoat; * //设置左右板信息,并非移动方向 * Info.HitDir = WalkDir.WALKLEFT; * Info.bApplyDamage = false; * * } * else if (flydir == FlyDir.Right || flydir == FlyDir.RightTop || flydir == FlyDir.RightBottom || flydir == FlyDir.Top || flydir == FlyDir.Bottom) * { * Info.flyCollisionAction = FlyCollisionAction.DropInBoat; * Info.bApplyDamage = false; * } * else * { * if(m_DefenceColider.IsInRightCollider(collision.collider)) * { * Info.flyCollisionAction = FlyCollisionAction.DropInBoat; * Info.bApplyDamage = false; * } * else if(m_DefenceColider.IsInLeftCollider(collision.collider)) * { * Info.flyCollisionAction = FlyCollisionAction.DropOutBoat; * //设置左右板信息,并非移动方向 * Info.HitDir = WalkDir.WALKLEFT; * Info.bApplyDamage = false; * } * }*/ Info.flyCollisionAction = FlyCollisionAction.DropOutBoat; for (int i = Layer; i >= 0; i--) { MapGrid g = MapGrid.GetMG(i, StartUnit); if (g != null && (g.Type != GridType.GRID_HOLE && g.Type != GridType.GRID_HOLESTAIR)) { Info.flyCollisionAction = FlyCollisionAction.DropInBoat; break; } } Info.droppos = new Vector3(-1f, 0, 0); GameObjectActionExcute gae1 = EffectM.LoadEffect(EffectM.sPath, "zamen_01", m_thisT.position, null); GameObjectActionDelayDestory ndEffect1 = new GameObjectActionDelayDestory(1f); gae1.AddAction(ndEffect1); } }
/// <summary> /// 撞击处理 /// </summary> /// <param name="Damage">撞击伤害</param> /// <param name="dir">撞击方向</param> /// <param name="Info">返回撞击信息</param> /// <returns></returns> public override void CollisionProcByFire(Collision collision, int Damage /*,Vector2 dir*/, ref FlyCollisionInfo Info, FlyDir flydir) { Role.WakeEnemy(this); Info.bVertical = true; Info.FlyfallSTandGridPos = new Int2(StartUnit, Layer); SkillReleaseInfo sInfo = new SkillReleaseInfo(); sInfo.m_InterruptSkill = false; sInfo.m_MakeStatus = new List <StatusType> (); sInfo.m_bImmunity = false; sInfo.m_Damage = Damage; sInfo.Result = AttackResult.Fire; ApplyDamage(sInfo, null); if (isDead) //破了 { Info.flyCollisionAction = FlyCollisionAction.PauseContinueFlyDirectional; Info.bApplyDamage = true; EffectM.LoadEffect(EffectM.sPath, "zamen_02", m_thisT.position, null); } else //没破 { Info.flyCollisionAction = FlyCollisionAction.DropInBoat; Info.bApplyDamage = false; GameObjectActionExcute gae1 = EffectM.LoadEffect(EffectM.sPath, "zamen_01", m_thisT.position, null); GameObjectActionDelayDestory ndEffect1 = new GameObjectActionDelayDestory(1f); gae1.AddAction(ndEffect1); } }
public override void CollisionProcByFire(Collision collision, int Damage /*,Vector2 dir*/, ref FlyCollisionInfo Info, FlyDir flydir) { }
/// <summary> /// 撞击处理 /// </summary> /// <param name="Damage">撞击伤害</param> /// <param name="dir">撞击方向</param> /// <param name="Info">返回撞击信息</param> /// <returns></returns> public override void CollisionProcByFire(Collision collision, int Damage/*,Vector2 dir*/, ref FlyCollisionInfo Info, FlyDir flydir) { //惊醒防御方 Role.WakeEnemy(this); Info.bVertical = m_bVertical; Info.FlyfallSTandGridPos = new Int2(StartUnit, Layer); Info.lifemCollision = this; SkillReleaseInfo sInfo = new SkillReleaseInfo(); sInfo.m_InterruptSkill = false; sInfo.m_MakeStatus = new List<StatusType> (); sInfo.m_bImmunity = false; sInfo.m_Damage = Damage; sInfo.Result = AttackResult.Fire; ApplyDamage(sInfo, null); //........................................................................ // 需要继续查.......................... if (m_DefenceColider == null) { isDead = true; } //........................................................................ if (isDead) { //穿了 GameObjectActionExcute gae = EffectM.LoadEffect(EffectM.sPath, "2000291", collision.contacts[0].point, BattleEnvironmentM.GetLifeMBornNode(true)); GameObjectActionDelayDestory ndEffect = new GameObjectActionDelayDestory(1f); gae.AddAction(ndEffect); Info.flyCollisionAction = FlyCollisionAction.PauseContinueFlyDirectional; Info.bApplyDamage = true; MakeHole(); } else { if (Info.bReleaseSkill) { shake(collision.contacts[0].point); SetDamageTexture(); GameObjectActionExcute gae = EffectM.LoadEffect(EffectM.sPath, "2000281", collision.contacts[0].point, BattleEnvironmentM.GetLifeMBornNode(true)); GameObjectActionDelayDestory ndEffect = new GameObjectActionDelayDestory(1f); gae.AddAction(ndEffect); } if (flydir == FlyDir.LeftTop || flydir == FlyDir.RightTop || flydir == FlyDir.Top) { if (m_FloorType == FloorType.bottom) { Info.flyCollisionAction = FlyCollisionAction.DropOutBoat; } else { Info.flyCollisionAction = FlyCollisionAction.DropInBoat; } Info.bApplyDamage = false; } else if (flydir == FlyDir.LeftBottom || flydir == FlyDir.RightBottom || flydir == FlyDir.Bottom) { Info.flyCollisionAction = FlyCollisionAction.FlyFallStand; Info.bApplyDamage = false; } else { if (m_FloorType == FloorType.top) { Info.flyCollisionAction = FlyCollisionAction.FlyFallStand; Info.bApplyDamage = false; } else if (m_DefenceColider.IsInBottomCollider(collision.collider)) { if (m_FloorType == FloorType.bottom) { Info.flyCollisionAction = FlyCollisionAction.DropOutBoat; } else { Info.flyCollisionAction = FlyCollisionAction.DropInBoat; } Info.bApplyDamage = false; } else if (m_DefenceColider.IsInTopCollider(collision.collider)) { //从上往下撞 Info.flyCollisionAction = FlyCollisionAction.FlyFallStand; Info.bApplyDamage = false; } } } }
/// <summary> /// 飞行角色的碰撞处理 /// </summary> public override void ColliderProc(Collision collision) { //NGUIUtil.DebugLog("flyCollisionAction=" + m_FlyInfo.flyCollisionAction, "red"); if (m_FlyInfo != null) //当掉落船外后不再处理碰撞 { if (m_FlyInfo.flyCollisionAction == FlyCollisionAction.DropOutBoat) { return; } } FlyDir dir = FlyDir.none; if (CurrentAction is GridActionCmdFly) { dir = (CurrentAction as GridActionCmdFly).GetDir(); } else if (CurrentAction is GridActionDophineFly) { dir = (CurrentAction as GridActionDophineFly).GetDir(); } else if (CurrentAction is FireActionCmd) { dir = (CurrentAction as FireActionCmd).GetDir(); } if (m_bDolphineFly && (dir == FlyDir.Top || dir == FlyDir.LeftTop || dir == FlyDir.RightTop)) { return; } Life lifeM = GetCollisionGo(collision); if (lifeM == null || lifeM.m_Core.m_Camp == LifeMCamp.ATTACK) { return; } #if UNITY_EDITOR_LOG FileLog.write(m_Owner.SceneID, "ColliderProc " + collision.gameObject + lifeM.SceneID + ", " + collision.contacts[0].point + "," + dir); #endif //计算撞击方向 Vector3 target = collision.contacts[0].point; Vector3 start = m_Owner.m_thisT.position; Vector2 HitDir = new Vector2(target.x - start.x, target.y - start.y); bool bReleaseSkill = true; bReleaseSkill = !m_bDolphineFly; //海豚顶飞,炮战技能不释放 bool bApplyDamage = bReleaseSkill; if (m_Owner.m_Skill != null) { if (m_bDolphineFly == false) { bApplyDamage = m_FlyInfo.bApplyDamage; } (m_Owner.m_Skill as FireSkill).FlyInfo = m_FlyInfo; } Vector3 vHitWorldPos = new Vector3(target.x, target.y, target.z); HitSound(lifeM, m_Owner); HitShakeBoat(); #if UNITY_EDITOR_LOG FileLog.write(m_Owner.SceneID, "ColliderProc " + dir + "," + CurrentAction); #endif FlyCollisionInfo Info = m_Owner.FireTrigger(collision, lifeM, m_Owner, bReleaseSkill, bApplyDamage, m_listCollisionGoID.Count, dir); if (Info != null && Info.lifemCollision != null) { Info.HitDir = HitDir.x > 0 ? WalkDir.WALKRIGHT : WalkDir.WALKLEFT; Info.vhitPos = BattleEnvironmentM.World2LocalPos(target); FireCombatOver(Info); } }