public void Whichpartofbody(Inputcontroller inputcontroller) { float rotateangle = 0; switch (whichpart) { case Whichpart.Hand: rotateangle = inputcontroller.Yrot * currentangle; break; case Whichpart.Player: rotateangle = (Mathf.Sign(inputcontroller.Xrot)) == -1 ? -180 : 0; break; case Whichpart.Playerinairrotaate: rotateangle = Mathf.Sin(inputcontroller.Xval) * Mathf.Rad2Deg; break; case Whichpart.Head: rotateangle = Mathf.Sin(inputcontroller.Yrot) * Mathf.Rad2Deg; break; case Whichpart.Leg: rotateangle = Mathf.PerlinNoise(inputcontroller.Xrot, inputcontroller.Yrot); break; } wantedangle = rotateangle; }
// Start is called before the first frame update void Start() { controller = GetComponent <Controller>(); inputcontroller = GetComponent <Inputcontroller>(); gravity = 2 * heighttojump / Mathf.Pow(timetojump, 2); controller.rb2d.gravityScale = gravity; jumpvelocity = Mathf.Abs(gravity) * timetojump; }
void Start() { inputcontroller = GetComponent <Inputcontroller>(); rb2d = GetComponent <Rigidbody2D>(); foreach (Animatingsurface animatingsurface in animatingsurfaces) { animatingsurface.Initialize(this); } }