|
@@ -11,6 +11,7 @@ namespace GameLogic.Combat.CombatTool
|
|
|
public class CombatCameraControllder : IDisposable, ICameraShaking
|
|
|
{
|
|
|
public Transform root;
|
|
|
+ public Transform root2;
|
|
|
public Camera Camera;
|
|
|
public CombatController combatController;
|
|
|
public StressReceiver StressReceiver;
|
|
@@ -43,7 +44,8 @@ namespace GameLogic.Combat.CombatTool
|
|
|
CombatEventManager.Instance.AddEventListener(CombatEventType.SencenBesselPathAlter, SencenBesselPathAlter);
|
|
|
this.combatController = combatController;
|
|
|
Camera = camera;
|
|
|
- root = Camera.transform.parent;
|
|
|
+ root2 = Camera.transform.parent;
|
|
|
+ root = Camera.transform.parent.parent;
|
|
|
StressReceiver = camera.transform.GetComponentInParent<StressReceiver>();
|
|
|
TimeLineSingletonEventManager.Instance.AddTimeLineBasic(this);
|
|
|
EventManager.Instance.AddEventListener(CustomEventType.HeroClick, HeroClick);
|
|
@@ -99,9 +101,9 @@ namespace GameLogic.Combat.CombatTool
|
|
|
isStartShake = false;
|
|
|
}
|
|
|
|
|
|
- public void SetFieldOfView(float fieldOfView,float speed)
|
|
|
+ public void SetFieldOfView(float fieldOfView, float speed)
|
|
|
{
|
|
|
- FieldOfViewSpeed=speed;
|
|
|
+ FieldOfViewSpeed = speed;
|
|
|
FieldOfViewTime = 0;
|
|
|
FieldOfViewStartValue = Camera.fieldOfView;
|
|
|
FieldOfViewTargetValue = fieldOfView;
|
|
@@ -110,10 +112,9 @@ namespace GameLogic.Combat.CombatTool
|
|
|
|
|
|
public void Update(float t)
|
|
|
{
|
|
|
-
|
|
|
if (isUpdateFieldOfView)
|
|
|
{
|
|
|
- FieldOfViewTime += t*FieldOfViewSpeed;
|
|
|
+ FieldOfViewTime += t * FieldOfViewSpeed;
|
|
|
Camera.fieldOfView = Mathf.Lerp(FieldOfViewStartValue, FieldOfViewTargetValue, FieldOfViewTime);
|
|
|
if (FieldOfViewTime >= 1)
|
|
|
{
|
|
@@ -121,19 +122,59 @@ namespace GameLogic.Combat.CombatTool
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ CombatHeroEntity combatHeroEntities = combatController.playerHeroEntity;
|
|
|
if (!isStartShake && !isStop)
|
|
|
{
|
|
|
- CombatHeroEntity combatHeroEntities = combatController.playerHeroEntity;
|
|
|
if (combatHeroEntities == null)
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- Vector3 p = combatHeroEntities.GameObject.transform.TransformPoint(new Vector3(0, 8, -10));
|
|
|
+ Vector3 dir = combatHeroEntities.faceDir;
|
|
|
+ // CombatHeroEntity foucusTarget = combatHeroEntities.CombatAIBasic.currFocusTarget as CombatHeroEntity;
|
|
|
+ // if (foucusTarget != null)
|
|
|
+ // {
|
|
|
+ // dir = foucusTarget.dotPos - combatHeroEntities.dotPos;
|
|
|
+ // dir = dir.normalized;
|
|
|
+ // }
|
|
|
+
|
|
|
+ Quaternion q = Quaternion.LookRotation(dir);
|
|
|
+ Vector3 myHeroTarget = new Vector3(0, 8, -10);
|
|
|
+ myHeroTarget = q * myHeroTarget;
|
|
|
+ Vector3 p = combatHeroEntities.GameObject.transform.TransformPoint(myHeroTarget);
|
|
|
root.rotation = Quaternion.Lerp(root.rotation, combatHeroEntities.GameObject.transform.rotation,
|
|
|
1);
|
|
|
root.position = Vector3.Lerp(root.position, p, 1);
|
|
|
}
|
|
|
+
|
|
|
+ // MoveRoot2();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void MoveRoot2()
|
|
|
+ {
|
|
|
+ CombatHeroEntity combatHeroEntities = combatController.playerHeroEntity;
|
|
|
+
|
|
|
+ if (combatHeroEntities == null)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ Vector3 dir = combatHeroEntities.faceDir;
|
|
|
+ CombatHeroEntity foucusTarget = combatHeroEntities.CombatAIBasic.currFocusTarget as CombatHeroEntity;
|
|
|
+ if (foucusTarget != null)
|
|
|
+ {
|
|
|
+ dir = foucusTarget.dotPos - combatHeroEntities.dotPos;
|
|
|
+ dir = dir.normalized;
|
|
|
+ }
|
|
|
+
|
|
|
+ Quaternion q = Quaternion.LookRotation(dir);
|
|
|
+ Vector3 myHeroTarget = new Vector3(0, 8, -10);
|
|
|
+ myHeroTarget = q * myHeroTarget;
|
|
|
+ Vector3 p = combatHeroEntities.GameObject.transform.TransformPoint(myHeroTarget);
|
|
|
+ Vector3 newP = p - root.position;
|
|
|
+ root2.rotation = Quaternion.Lerp(root2.rotation, q,
|
|
|
+ 0.3f);
|
|
|
+ root2.localPosition = Vector3.Lerp(root2.localPosition, newP, 0.3f);
|
|
|
}
|
|
|
|
|
|
public void SetPos(Transform target)
|