Tweaks n fix

dev-ali
Ali Sharoz 3 weeks ago
parent ee48bc4833
commit e790d3aaca

@ -38,7 +38,7 @@ public class Joystick : MonoBehaviour, IPointerDownHandler, IDragHandler, IPoint
private Canvas canvas; private Canvas canvas;
private Camera cam; private Camera cam;
private Vector2 input = Vector2.zero; public Vector2 input = Vector2.zero;
protected virtual void Start() protected virtual void Start()
{ {

@ -11,10 +11,10 @@ public class FloorSetter : MonoBehaviour
public List<Vector3> positions; public List<Vector3> positions;
public void OnValidate() //public void OnValidate()
{ //{
Instantiator(); // Instantiator();
} //}
[ContextMenu("PositionTaker")] [ContextMenu("PositionTaker")]
public void PositionTaker() public void PositionTaker()
{ {

File diff suppressed because it is too large Load Diff

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: c3b6dbfbfdf9e42488435970aaba066e guid: c5ddf6fc4e21e4ec18c592064edf342f
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: c5ddf6fc4e21e4ec18c592064edf342f guid: c3b6dbfbfdf9e42488435970aaba066e
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

@ -65,7 +65,12 @@ public class SquadMember : Unit
targetVector = transform.forward * 10f + transform.up; targetVector = transform.forward * 10f + transform.up;
canvas.HealthBar.SetHealth(health); canvas.HealthBar.SetHealth(health);
joystick=GameObject.FindFirstObjectByType<Joystick>();
} }
public Vector3 targetRotation;
public Vector3 targetRotationNormalized;
public Joystick joystick;
public float angle;
private void Update() private void Update()
{ {
if (IsEvolving) if (IsEvolving)
@ -100,8 +105,10 @@ public class SquadMember : Unit
return; return;
} }
targetRotation = targetVector - transform.position;
transform.rotation = Quaternion.Lerp(transform.rotation, Quaternion.LookRotation(targetVector - transform.position), Time.deltaTime * rotationLerp); targetRotationNormalized = targetRotation.normalized;
angle = Vector3.Angle(targetRotationNormalized, joystick.input);
transform.rotation = Quaternion.Lerp(transform.rotation, Quaternion.LookRotation(targetRotation), Time.deltaTime * rotationLerp);
} }
public virtual void Init() public virtual void Init()
{ {

Loading…
Cancel
Save