/// <summary> /// Shake the device /// </summary> void shake() { //shake screen effect ATween.ShakePosition(Camera.main.transform.gameObject, ATween.Hash("x", 1, "time", 1, "delay", 0, "easetype", ATween.EaseType.easeInOutQuint)); //active the hidden bread's physical and drop it off bread.GetComponent <Rigidbody>().isKinematic = false; bread.GetComponent <Rigidbody>().AddForce(Vector3.down); }
public static void shake(GameObject obj) { // Sequence mySequence = new Sequence(); Vector3 oriPos = obj.transform.position; // mySequence.Append (HOTween.To (obj.transform, .03f,new TweenParms().Prop("position",new Vector3(oriPos.x,oriPos.y+.05f,oriPos.z),false))); // mySequence.Append (HOTween.To (obj.transform, .03f,new TweenParms().Prop("position",new Vector3(oriPos.x,oriPos.y-.05f,oriPos.z),false))); // mySequence.loopType = LoopType.Yoyo; // Tweener shaker = HOTween.Shake (obj.transform, 3f,new TweenParms().Prop("position",new Vector3(0,.2f,0),true)); Hashtable args = new Hashtable(); // args.Add("amount", new Vector3(5, 5, 5)); args.Add("x", 0); args.Add("y", 10); args.Add("islocal", true); args.Add("time", .4f); ATween.ShakePosition(obj, args); // tTween.loopType = LoopType.YoyoInverse; // mySequence.Play (); // return shaker; }