// Use this for initialization void Start() { TurtleRigidBody = ActualTurtle.GetComponent <Rigidbody2D> (); TurtleMoveScr = ActualTurtle.GetComponent <TurtleMovementScript> (); AngleSpeedConst = angleSpeed; }
void Start () { cameraMoveScript = Cam.GetComponent<CameraMoveScript> (); deathScript = Turtle.GetComponent<DeathScript> (); rotatesemi = Turtle.GetComponent<rotateSemi> (); setsortingLayer = ShaderCube.GetComponent<setSortingLayer> (); turtleMovementScript = Turtle.GetComponent<TurtleMovementScript> (); }
// Use this for initialization void Start () { StartVector = gameObject.transform.position;//sets the startVector to the starting position of the Turtle TurtleBody = GetComponent<Rigidbody2D> (); TurtleMoveScr = GetComponent<TurtleMovementScript> (); setSortLayer = ShaderCube.GetComponent<setSortingLayer> (); }
// Use this for initialization void Start() { StartVector = gameObject.transform.position; //sets the startVector to the starting position of the Turtle TurtleBody = GetComponent <Rigidbody2D> (); TurtleMoveScr = GetComponent <TurtleMovementScript> (); setSortLayer = ShaderCube.GetComponent <setSortingLayer> (); }
// Use this for initialization void Start () { TurtleRigidBody = ActualTurtle.GetComponent<Rigidbody2D> (); TurtleMoveScr = ActualTurtle.GetComponent<TurtleMovementScript> (); AngleSpeedConst = angleSpeed; }
void Start() { cameraMoveScript = Cam.GetComponent <CameraMoveScript> (); deathScript = Turtle.GetComponent <DeathScript> (); rotatesemi = Turtle.GetComponent <rotateSemi> (); setsortingLayer = ShaderCube.GetComponent <setSortingLayer> (); turtleMovementScript = Turtle.GetComponent <TurtleMovementScript> (); }
// Update is called once per frame void Update() { TurtleMovementScript turtleMovescript = turtle.GetComponent <TurtleMovementScript>(); gravity = turtleMovescript.FlipGravity; angularVel = turtle.angularVelocity; int whichWay; if (semiTurtle.transform.eulerAngles.z + turtle.angularVelocity * gravity > 180) { whichWay = 1; } else { whichWay = -1; } //Quaternion rot = semiTurtle.transform.localRotation + semiTurtle.transform.rotation; // this gets the difference between local and world rotation, i then need to use it to create a smooth rotation so that the turtle always wants to rotate onto its back so it dont look like its floating in mid air. min = 97 - (90 * gravity); max = 263 + (90 * gravity); if ((!Input.GetKey(turtleMovescript.LeftKey) && !Input.GetKey(turtleMovescript.RightKey)) || turtle.angularVelocity < smallVel) { if (((semiTurtle.transform.eulerAngles.z > min && semiTurtle.transform.eulerAngles.z < max) && gravity == 1) || (((semiTurtle.transform.eulerAngles.z > min || semiTurtle.transform.eulerAngles.z < max)) && gravity == -1)) { semiTurtle.transform.rotation = Quaternion.Euler(0, 0, semiTurtle.transform.eulerAngles.z + i * whichWay * gravity); } else { semiTurtle.transform.rotation = Quaternion.Euler(0, 0, 90 - (90 * gravity)); } } else { i = i2; } if (i < largestI) { i = i * deceleration; } else { i = largestI; } GlobalRotation = semiTurtle.transform.eulerAngles.z; //semiTurtle.transform.localRotation= Quaternion.Euler (0, 0,rot); }