//using System.Collections; //using System.Collections.Generic; //using UnityEngine; //using SiegeSong; //namespace SiegeSong //{ // public class HeadTurn : MonoBehaviour // { // public Transform HeadBone; // public Transform RibcageBone; // public Transform LookTarget; // public CameraManager CameraManager; // public Motor Motor; // private float rotationXMin = 350.0f; // private float rotationXMax = 350.0f; // private float rotationYMin = -60.0f; // private float rotationYMax = 80.0f; // private float rotationXOffset = 0.0f; // private float rotationYOffset = 180.0f; // private float rotationXModifier = 1.0f; // private float rotationYModifier = 1.0f; // private float rotationZModifier = 1.0f; // private float previousX; // private float previousY; // private float previousZ; // void Start() // { // } // void LateUpdate() // { // if (Motor.Moving == false) // { // var direction = new Vector3(1, -1, 1); // if (LookTarget == null) // direction = new Vector3( // (CameraManager.ActiveCamera.transform.rotation.eulerAngles.x + rotationXOffset) * rotationXModifier, // (CameraManager.ActiveCamera.transform.rotation.eulerAngles.y + rotationYOffset) * rotationYModifier, // -CameraManager.ActiveCamera.transform.rotation.eulerAngles.z * rotationZModifier); // else // direction = LookTarget.position - HeadBone.position; // var resetingHeadTurn = true; // if (direction.y - rotationYOffset > rotationYMax) // { // previousY = direction.y; // resetingHeadTurn = false; // } // if (direction.y + rotationYOffset < rotationYMin) // { // previousY = direction.y; // resetingHeadTurn = false; // } // if (resetingHeadTurn) // { // direction.y = previousY; // resetingHeadTurn = false; // } // else // { // HeadBone.eulerAngles = direction; // } // } // } // } //}