|
|
@ -514,37 +514,39 @@ namespace GWConquest |
|
|
|
|
|
|
|
private void Update() |
|
|
|
{ |
|
|
|
if(GameManager.EntitiesLoaded) |
|
|
|
if (entity.IsAttached) |
|
|
|
{ |
|
|
|
if(currentZone != null && currentZone.zoneType == ZoneType.Space && movingArmyIcon == null) |
|
|
|
if (GameManager.EntitiesLoaded) |
|
|
|
{ |
|
|
|
MakeMovingIcon(IngameUI.Instance.MovingFleetsTransform); |
|
|
|
if (currentZone != null && currentZone.zoneType == ZoneType.Space && movingArmyIcon == null) |
|
|
|
{ |
|
|
|
MakeMovingIcon(IngameUI.Instance.MovingFleetsTransform); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
//Debug.LogFormat("Current state: IsInTransit {0}; CurrentZone {1}; CoveredDistance {2}", State.IsInTransit, State.CurrentZone, CoveredDistance);
|
|
|
|
//Debug.LogFormat("Current state: IsInTransit {0}; CurrentZone {1}; CoveredDistance {2}", State.IsInTransit, State.CurrentZone, CoveredDistance);
|
|
|
|
|
|
|
|
if (MovementState == FormationMovementState.Moving) |
|
|
|
{ |
|
|
|
animDistanceCovered += movementSpeed * Time.deltaTime; |
|
|
|
Zone originZone = Zone.GetFromId(State.CurrentTransition.OriginZone); |
|
|
|
Zone targetZone = Zone.GetFromId(State.CurrentTransition.TargetZone); |
|
|
|
if (MovementState == FormationMovementState.Moving) |
|
|
|
{ |
|
|
|
animDistanceCovered += movementSpeed * Time.deltaTime; |
|
|
|
Zone originZone = Zone.GetFromId(State.CurrentTransition.OriginZone); |
|
|
|
Zone targetZone = Zone.GetFromId(State.CurrentTransition.TargetZone); |
|
|
|
|
|
|
|
Vector3 originPos = originZone.transform.position; |
|
|
|
Vector3 targetPos = targetZone.transform.position; |
|
|
|
Vector3 originPos = originZone.transform.position; |
|
|
|
Vector3 targetPos = targetZone.transform.position; |
|
|
|
|
|
|
|
if(!State.CurrentTransition.IsCurved) |
|
|
|
{ |
|
|
|
originPos += originZone.planet.GetFleetArrivalPosition(targetZone) * originZone.planet.GetCurrentCircleRadius(); |
|
|
|
targetPos += targetZone.planet.GetFleetArrivalPosition(originZone) * targetZone.planet.GetCurrentCircleRadius(); |
|
|
|
if (!State.CurrentTransition.IsCurved) |
|
|
|
{ |
|
|
|
originPos += originZone.planet.GetFleetArrivalPosition(targetZone) * originZone.planet.GetCurrentCircleRadius(); |
|
|
|
targetPos += targetZone.planet.GetFleetArrivalPosition(originZone) * targetZone.planet.GetCurrentCircleRadius(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Vector3 oldPos = transform.position; |
|
|
|
Vector3 newPos; |
|
|
|
Quaternion newRot; |
|
|
|
//if(State.CurrentTransition.IsCurved)
|
|
|
|
//{
|
|
|
|
|
|
|
|
Vector3 oldPos = transform.position; |
|
|
|
Vector3 newPos; |
|
|
|
Quaternion newRot; |
|
|
|
//if(State.CurrentTransition.IsCurved)
|
|
|
|
//{
|
|
|
|
|
|
|
|
/*Vector3 planetPos = targetZone.planet.transform.position; |
|
|
|
Vector3 originPos = originZone.transform.position - planetPos; |
|
|
|
Vector3 targetPos = targetZone.transform.position - planetPos; |
|
|
@ -553,67 +555,70 @@ namespace GWConquest |
|
|
|
newPos += planetPos; |
|
|
|
newRot = Quaternion.LookRotation(newPos - oldPos, newPos - planetPos); |
|
|
|
*/ |
|
|
|
//}
|
|
|
|
//else
|
|
|
|
//{
|
|
|
|
//}
|
|
|
|
//else
|
|
|
|
//{
|
|
|
|
newPos = Vector3.Lerp(originPos, |
|
|
|
targetPos, |
|
|
|
animDistanceCovered / State.CurrentTransition.TransitionLength); |
|
|
|
newRot = Quaternion.LookRotation(newPos - oldPos, Vector3.up); |
|
|
|
//}
|
|
|
|
|
|
|
|
transform.position = newPos; |
|
|
|
transform.rotation = newRot; |
|
|
|
|
|
|
|
} |
|
|
|
else if(MovementState == FormationMovementState.PreparingMovement) |
|
|
|
{ |
|
|
|
if(ZoneType == ZoneType.Space) |
|
|
|
{ |
|
|
|
var planet = currentZone.planet; |
|
|
|
Vector3 origin = GetRestingPosition(); |
|
|
|
var targetZone = PathQueue.First(); |
|
|
|
Vector3 target = planet.transform.position + planet.GetFleetArrivalPosition(targetZone) * planet.GetCurrentCircleRadius(); |
|
|
|
//}
|
|
|
|
|
|
|
|
Vector3 newPos = Vector3.Lerp(origin, target, 1f - ActionCooldownPercent); |
|
|
|
transform.position = newPos; |
|
|
|
transform.rotation = newRot; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
else if(MovementState == FormationMovementState.FinishingMovement) |
|
|
|
{ |
|
|
|
if(ZoneType == ZoneType.Space) |
|
|
|
else if (MovementState == FormationMovementState.PreparingMovement) |
|
|
|
{ |
|
|
|
var planet = currentZone.planet; |
|
|
|
Vector3 target = GetRestingPosition(); |
|
|
|
Vector3 origin = planet.transform.position + arrivalPosition * planet.GetCurrentCircleRadius(); |
|
|
|
if (ZoneType == ZoneType.Space) |
|
|
|
{ |
|
|
|
var planet = currentZone.planet; |
|
|
|
Vector3 origin = GetRestingPosition(); |
|
|
|
var targetZone = PathQueue.First(); |
|
|
|
Vector3 target = planet.transform.position + planet.GetFleetArrivalPosition(targetZone) * planet.GetCurrentCircleRadius(); |
|
|
|
|
|
|
|
Vector3 newPos = Vector3.Lerp(origin, target, 1f - ActionCooldownPercent); |
|
|
|
transform.position = newPos; |
|
|
|
} |
|
|
|
|
|
|
|
Vector3 newPos = Vector3.Lerp(origin, target, 1f - ActionCooldownPercent); |
|
|
|
transform.position = newPos; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
else if(MovementState == FormationMovementState.Idle) |
|
|
|
{ |
|
|
|
//transform.position = currentZone.transform.position;
|
|
|
|
if(ZoneType == ZoneType.Space) |
|
|
|
else if (MovementState == FormationMovementState.FinishingMovement) |
|
|
|
{ |
|
|
|
transform.position = GetRestingPosition(); |
|
|
|
if (ZoneType == ZoneType.Space) |
|
|
|
{ |
|
|
|
var planet = currentZone.planet; |
|
|
|
Vector3 target = GetRestingPosition(); |
|
|
|
Vector3 origin = planet.transform.position + arrivalPosition * planet.GetCurrentCircleRadius(); |
|
|
|
|
|
|
|
Vector3 newPos = Vector3.Lerp(origin, target, 1f - ActionCooldownPercent); |
|
|
|
transform.position = newPos; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
else { |
|
|
|
transform.position = currentZone.transform.position; |
|
|
|
else if (MovementState == FormationMovementState.Idle) |
|
|
|
{ |
|
|
|
//transform.position = currentZone.transform.position;
|
|
|
|
if (ZoneType == ZoneType.Space) |
|
|
|
{ |
|
|
|
transform.position = GetRestingPosition(); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
transform.position = currentZone.transform.position; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if(movingArmyIcon != null && ZoneType == ZoneType.Space) |
|
|
|
{ |
|
|
|
if(!IngameUI.PlanetViewEnabled && (GWCamera.Instance.ShowCircles || MovementState == FormationMovementState.Moving)) |
|
|
|
if (movingArmyIcon != null && ZoneType == ZoneType.Space) |
|
|
|
{ |
|
|
|
movingArmyIcon.SetActive(true); |
|
|
|
movingArmyIcon.GetComponent<StickToFormation>().Update(); |
|
|
|
} |
|
|
|
else { |
|
|
|
movingArmyIcon.SetActive(false); |
|
|
|
if (!IngameUI.PlanetViewEnabled && (GWCamera.Instance.ShowCircles || MovementState == FormationMovementState.Moving)) |
|
|
|
{ |
|
|
|
movingArmyIcon.SetActive(true); |
|
|
|
movingArmyIcon.GetComponent<StickToFormation>().Update(); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
movingArmyIcon.SetActive(false); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|