Explore:队伍跟随,隐藏宠物
This commit is contained in:
parent
bf884b3668
commit
c51c044828
@ -2141,7 +2141,19 @@ public class BattleMgr : SingletonMono<BattleMgr>
|
||||
{
|
||||
if (!IsLoadingBattleAssets)
|
||||
{
|
||||
mBattle.MoveToNextBattleField(false);
|
||||
if (Battle.IsExploreMode)
|
||||
{
|
||||
// For Explore Mode, Hide Pets
|
||||
for (int i = 0; i < mBattle.FighterMgr.TeamPetFighters.Count; i++)
|
||||
{
|
||||
var petFighter = mBattle.FighterMgr.TeamFighters[i];
|
||||
petFighter.Ctrl.IsVisible = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mBattle.MoveToNextBattleField(false);
|
||||
}
|
||||
}
|
||||
NotifyLoadingStatusEnd();
|
||||
}
|
||||
|
||||
@ -1018,10 +1018,27 @@ public class Fighter : LogicTransform
|
||||
public bool MoveInDirection(Vector3 direction)
|
||||
{
|
||||
var speedFactor = this.MoveSpeed / Constants.frame_to_time;
|
||||
Vector3 destPos = Position + direction.normalized * speedFactor * 10.0f;
|
||||
Vector3 destPos = Position + direction.normalized * speedFactor * 2.0f;
|
||||
return mStateData.ProcessTrigger(FighterStateTriggerType.Run, new FighterStateRunParam(null, destPos, 0));
|
||||
}
|
||||
|
||||
public bool FollowInDirection(Vector3 direction)
|
||||
{
|
||||
var speedFactor = this.MoveSpeed / Constants.frame_to_time;
|
||||
Vector3 destPos = Position + direction.normalized * speedFactor * 2.0f;
|
||||
return mStateData.ProcessTrigger(FighterStateTriggerType.Run, new FighterStateRunParam(null, destPos, 0));
|
||||
}
|
||||
|
||||
public bool StartFollowTarget(Fighter target, float followDistance)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void StopFollowTarget(Fighter target)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public bool ChaseTo(Fighter target,float stopDist)
|
||||
{
|
||||
return mStateData.ProcessTrigger(FighterStateTriggerType.Run, new FighterStateRunParam(target,target.Position, stopDist));
|
||||
|
||||
@ -51,18 +51,6 @@ public class FighterStateRun : FighterState
|
||||
if(mFighter.Ctrl!=null)
|
||||
{
|
||||
MoveTo(mParam.runDest, mParam.chaseTarget != null, mParam.chaseTarget,mParam.stopDist);
|
||||
/*
|
||||
if (mFighter.Id == 4)
|
||||
{
|
||||
string info = string.Format("Frame = {0},From pos ={1}, Move pos={2},mMoveSpeedPerFrame={3}",
|
||||
mFighter.Battle.FrameCount.ToString(),
|
||||
mFighter.Position.ToString(),
|
||||
mMoveDestPos.ToString(),
|
||||
mMoveSpeedPerFrame.ToString());
|
||||
|
||||
Debug.Log("Start MoveTo-------" + info);
|
||||
}
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -77,7 +65,7 @@ public class FighterStateRun : FighterState
|
||||
PlayAnimState();
|
||||
UpdateCurrentPos();
|
||||
}
|
||||
|
||||
|
||||
private void UpdateCurrentPos()
|
||||
{
|
||||
CheckDestPos();
|
||||
@ -99,18 +87,6 @@ public class FighterStateRun : FighterState
|
||||
mFighter.StateData.ChangeState(mFighter.StateData.GetIdleNext());
|
||||
return;
|
||||
}
|
||||
#region DebugLog
|
||||
//if (mFighter.Id == 10003)
|
||||
//{
|
||||
// string info = string.Format("Frame = {0},From pos ={1}, Move pos={2},mMoveSpeedPerFrame={3}",
|
||||
// mFighter.Battle.FrameCount.ToString(),
|
||||
// Pos.ToString(),
|
||||
// EndPos.ToString(),
|
||||
// mMoveSpeedPerFrame.ToString());
|
||||
|
||||
// Debug.Log("UpdateCurrentPos111 MoveTo-------" + info);
|
||||
//}
|
||||
#endregion
|
||||
mLastDestPos = EndPos;
|
||||
mFighter.Ctrl.MoveTo(EndPos);//表现帧 差值一帧
|
||||
if (Pos == EndPos)
|
||||
@ -158,21 +134,6 @@ public class FighterStateRun : FighterState
|
||||
dist = dist - (Fix64)mStopDist;
|
||||
dist = dist < Fix64.Zero ? Fix64.Zero : dist;
|
||||
dest = selfPos + dist * dir;
|
||||
#region DebugLog
|
||||
//if (mFighter.Id == 10003)
|
||||
//{
|
||||
// string info = string.Format("Frame = {0},mFighter pos ={1}, mChaseFighter pos={2},dir = {3},mStopDist = {4},dist = {5},dest = {6}",
|
||||
// mFighter.Battle.FrameCount.ToString(),
|
||||
// selfPos.ToString(),
|
||||
// tPos.ToString(),
|
||||
// dir.ToString(),
|
||||
// ((Fix64)mStopDist).ToString(),
|
||||
// dist.ToString(),
|
||||
// dest.ToString());
|
||||
|
||||
// Debug.Log("CheckDestPos MoveTo-------" + info);
|
||||
//}
|
||||
#endregion
|
||||
}
|
||||
dest.y = (Fix64)mFighter.CurrentBattleField.FloorY;
|
||||
mMoveDestPos = dest.ToVector3();
|
||||
|
||||
@ -25,11 +25,12 @@ public class LogicBattleFieldStateExplore : LogicBattleFieldState
|
||||
BattleCamera.Instance.SetExploreCameraTarget(mainRoleFighter);
|
||||
mField.Battle.GetReadyForTransfer();
|
||||
mField.Battle.GoToExploreTransferPoint();
|
||||
SetTeamEnterExploreMode();
|
||||
}
|
||||
|
||||
public override void OnLeave()
|
||||
{
|
||||
|
||||
SetTeamExitExploreMode();
|
||||
}
|
||||
|
||||
public override void Update(float deltaTime)
|
||||
@ -42,4 +43,59 @@ public class LogicBattleFieldStateExplore : LogicBattleFieldState
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void SetTeamEnterExploreMode()
|
||||
{
|
||||
EventMgr.AddEventListener<Vector2>(ECoreEventType.EID_JOYSTICK_DIRECTION, OnJoystickDirection);
|
||||
for (int i = 0; i < mField.Battle.FighterMgr.TeamPetFighters.Count; i++)
|
||||
{
|
||||
var petFighter = mField.Battle.FighterMgr.TeamPetFighters[i];
|
||||
petFighter.Ctrl.IsVisible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void SetTeamExitExploreMode()
|
||||
{
|
||||
EventMgr.RemoveEventListener<Vector2>(ECoreEventType.EID_JOYSTICK_DIRECTION, OnJoystickDirection);
|
||||
for (int i = 0; i < mField.Battle.FighterMgr.TeamPetFighters.Count; i++)
|
||||
{
|
||||
var petFighter = mField.Battle.FighterMgr.TeamPetFighters[i];
|
||||
petFighter.Ctrl.IsVisible = true;
|
||||
}
|
||||
}
|
||||
|
||||
private Vector2 _lastJoystickDirection = Vector2.zero;
|
||||
private void OnJoystickDirection(CoreEvent<Vector2> eventData)
|
||||
{
|
||||
var joystaticDirection = eventData.Data;
|
||||
if (joystaticDirection == Vector2.zero && _lastJoystickDirection == joystaticDirection)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_lastJoystickDirection = joystaticDirection;
|
||||
var mainRoleFighter = mField.Battle.FighterMgr.GetMainRole();
|
||||
Vector3 moveDirection = Vector3.back * joystaticDirection.y + Vector3.left * joystaticDirection.x;
|
||||
mainRoleFighter.MoveInDirection(moveDirection);
|
||||
|
||||
List<Fighter> followHeros = new();
|
||||
List<Fighter> heros = mField.Battle.FighterMgr.TeamHeroFighters;
|
||||
for (int idx = 0; idx < heros.Count; idx++)
|
||||
{
|
||||
var hero = heros[idx];
|
||||
if (hero.IsMainRole == false)
|
||||
{
|
||||
followHeros.Add(hero);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < followHeros.Count; i++)
|
||||
{
|
||||
var hero = followHeros[i];
|
||||
var followDistance = (i + 1) * 1.0f;
|
||||
var desiredPosition = mainRoleFighter.Ctrl.transform.position +
|
||||
mainRoleFighter.Ctrl.transform.rotation * new Vector3(0, 0, -followDistance);
|
||||
var followDirection = desiredPosition - hero.Position;
|
||||
hero.FollowInDirection(followDirection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -272,30 +272,6 @@ public class LogicBattle : BaseBattle
|
||||
|
||||
Vector3 center = CurrentBattleField.CurrentWavePoint.Pos + forward * CurrentBattleField.CurrentWavePoint.ActorReadyDist;
|
||||
CurrentBattleField.Battle.BattleScene.ActorBornPoint.CalcNextBattleFieldPoints(center, rot);
|
||||
|
||||
EventMgr.AddEventListener<Vector2>(ECoreEventType.EID_JOYSTICK_DIRECTION, OnJoystickDirection);
|
||||
}
|
||||
|
||||
private Vector2 _lastJoystickDirection = Vector2.zero;
|
||||
private void OnJoystickDirection(CoreEvent<Vector2> eventData)
|
||||
{
|
||||
var joystaticDirection = eventData.Data;
|
||||
if (joystaticDirection == Vector2.zero && _lastJoystickDirection == joystaticDirection)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_lastJoystickDirection = joystaticDirection;
|
||||
List<Fighter> heros = FighterMgr.TeamHeroFighters;
|
||||
for (int idx = 0; idx < heros.Count; idx++)
|
||||
{
|
||||
var hero = heros[idx];
|
||||
if (hero.IsMainRole)
|
||||
{
|
||||
//var moveDirection = new Vector3(joystaticDirection.x, 0, joystaticDirection.y);
|
||||
Vector3 direction = Vector3.back * joystaticDirection.y + Vector3.left * joystaticDirection.x;
|
||||
hero.MoveInDirection(direction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//拉到挑战Boss传送点
|
||||
|
||||
@ -234,8 +234,8 @@ public class GameMgr : SingletonMono<GameMgr>
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
// test weixin minigame openid:
|
||||
//onComplete.Invoke("{\n\"openid\":\"oUEz364FbD3Qtus574MJ_KA7vCaA\",\n\"session_key\":\"xxxxx\",\n\"unionid\":\"xxxxx\",\n\"errcode\":0,\n\"errmsg\":\"xxxxx\"\n}");
|
||||
onComplete.Invoke("{\n\"openid\":\"pc-100002\",\n\"session_key\":\"xxxxx\",\n\"unionid\":\"xxxxx\",\n\"errcode\":0,\n\"errmsg\":\"xxxxx\"\n}");
|
||||
onComplete.Invoke("{\n\"openid\":\"oUEz364FbD3Qtus574MJ_KA7vCaA\",\n\"session_key\":\"xxxxx\",\n\"unionid\":\"xxxxx\",\n\"errcode\":0,\n\"errmsg\":\"xxxxx\"\n}");
|
||||
//onComplete.Invoke("{\n\"openid\":\"pc-100002\",\n\"session_key\":\"xxxxx\",\n\"unionid\":\"xxxxx\",\n\"errcode\":0,\n\"errmsg\":\"xxxxx\"\n}");
|
||||
yield break;
|
||||
#else
|
||||
#if PLATFORM_WEIXINMINIGAME
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user