public override void BeginExport() { rot = transform.rotation; rnd = new Random(seed); pos = transform.position; sc = transform.localScale; count = 0; }
private void Start() { bodySnapPointPosition = bodySnapPoint.transform.position; originalHeadPosition = head.transform.position; originalHeadRotation = head.transform.rotation; headRigidbody = head.GetComponent <Rigidbody>(); headRigidbodySript = head.GetComponent <oxRigidbody>(); _customThrowable = head.GetComponent <CustomThrowable>(); rightHand = GameObject.Find("RightHand"); leftHand = GameObject.Find("LeftHand"); _oxEventManager = head.GetComponent <oxEventManager>(); vibration = vibrationManager.GetComponent <ControlerVibration>(); }
public override UnityEngine.Quaternion Rotate(Vector2 current) { if (attackTarget) { UnityEngine.Quaternion newRotation = UnityEngine.Quaternion.LookRotation((Vector2)attackTarget.transform.position - current, Vector3.up); newRotation.x = 0.0f; newRotation.y = 0.0f; return(newRotation); } else { return(UnityEngine.Quaternion.identity); } }
public override void UpdateAnimation() { count++; if ((count % frequency) == 0) { float x = (float)rnd.NextDouble() * powerT - powerT * .5f; float y = (float)rnd.NextDouble() * powerT - powerT * .5f; transform.position = pos + (new Vector3(x, y, 0)); x = (float)rnd.NextDouble() * powerS - powerS * .5f; y = (float)rnd.NextDouble() * powerS - powerS * .5f; transform.localScale = sc + (new Vector3(x, x, 0)); x = (float)rnd.NextDouble() * powerR - powerR * .5f; UnityEngine.Quaternion q = UnityEngine.Quaternion.AngleAxis(x, Vector3.forward); transform.rotation = rot * q; } }