// Update is called once per frame void Update() { state.Execute(); if (!state.IsInState(updateHeavyLand)) { camera.transform.localPosition = player.transform.localPosition; camera.Translate(new Vector3(0, 0, -50)); } }
void OnTriggerEnter(Collider coll) { if (state.IsInState(updateJUMP) && swingtimer > .1f) { Transform colltrans = coll.gameObject.transform; Vector3 branchpos = new Vector3(colltrans.localPosition.x, colltrans.localPosition.y, colltrans.localPosition.z); Vector3 newy = colltrans.TransformPoint(branchpos); Vector3 temp = player.transform.localPosition; temp.y = branchpos.y; //controller.Move (player.localPosition - branchpos); player.localPosition = branchpos; player.Translate(new Vector3(0, -1f, 0)); //player.Rotate (new Vector3(0,1,0), Vector3.Angle (player.forward, coll.transform.right) * (player.localRotation.y > 90 ? -1:1)); //HACKTASTIC STUFF HERE player.rotation = Quaternion.RotateTowards(player.rotation, quathack.rotation, 360); state.ChangeState(enterSWING, updateSWING, exitSWING); } }