{"action":"opened","issue":{"url":"https://api.github.com/repos/jyuliya/project/issues/1","repository_url":"https://api.github.com/repos/jyuliya/project","labels_url":"https://api.github.com/repos/jyuliya/project/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/jyuliya/project/issues/1/comments","events_url":"https://api.github.com/repos/jyuliya/project/issues/1/events","html_url":"https://github.com/jyuliya/project/issues/1","id":137411461,"number":1,"title":"characterController","user":{"login":"jyuliya","id":17033379,"avatar_url":"https://avatars.githubusercontent.com/u/17033379?v=3","gravatar_id":"","url":"https://api.github.com/users/jyuliya","html_url":"https://github.com/jyuliya","followers_url":"https://api.github.com/users/jyuliya/followers","following_url":"https://api.github.com/users/jyuliya/following{/other_user}","gists_url":"https://api.github.com/users/jyuliya/gists{/gist_id}","starred_url":"https://api.github.com/users/jyuliya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jyuliya/subscriptions","organizations_url":"https://api.github.com/users/jyuliya/orgs","repos_url":"https://api.github.com/users/jyuliya/repos","events_url":"https://api.github.com/users/jyuliya/events{/privacy}","received_events_url":"https://api.github.com/users/jyuliya/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-02-29T23:24:16Z","updated_at":"2016-02-29T23:24:16Z","closed_at":null,"body":"using UnityEngine;\r\nusing System.Collections;\r\n\r\npublic class Controller : MonoBehaviour {\r\n    private CharacterController characterController;\r\n    public bool isGrounded;\r\n    public float gravity;\r\n    public float jumpSpeed;\r\n    public float fallSpeed;\r\n\tpublic float moveSpeed;\r\n\r\n\r\n    // Use this for initialization\r\n    void Start () {\r\n        characterController = GetComponent<CharacterController>();\r\n\t}\r\n\t\r\n\t// Update is called once per frame\r\n\tvoid Update () {\r\n        IsGrounded();\r\n        Fall();\r\n        Jump();\r\n\t\tMove ();\r\n\t}\r\n\r\n\r\n\r\n    void Move()\r\n    {\r\n\t\t//float xSpeed = Input.GetAxis(\"Horizontal\") * moveSpeed;\r\n\t\tfloat ySpeed = 0;\r\n\t\tfloat xSpeed = Input.GetAxis(\"Horizontal\") * moveSpeed;\r\n\t\tif (xSpeed != 0)\r\n\t\t\tcharacterController.Move (new Vector2 (xSpeed, 0) * moveSpeed * Time.deltaTime);\r\n\t\t//if (ySpeed != 0)\r\n\t\t\t//characterController.Move (new Vector3 (0, 0, ySpeed) * moveSpeed * Time.deltaTime);\r\n    }\r\n\r\n\tvoid Jump () {\r\n\t\tif (Input.GetButtonDown (\"Jump\") && isGrounded) {\r\n\t\t\tfallSpeed = -jumpSpeed;\r\n\t\t}\r\n\t}\r\n\r\n\tvoid Fall(){\r\n\t\tif (!isGrounded) {\r\n\t\t\tfallSpeed += gravity * Time.deltaTime;\r\n\t\t} else {\r\n\t\t\tif (fallSpeed > 0)\r\n\t\t\t\tfallSpeed = 0;\r\n\t\t}\r\n\t\tcharacterController.Move (new Vector3(0, -fallSpeed) * Time.deltaTime);\r\n\t}\r\n\t\r\n    void IsGrounded ()\r\n    {\r\n        isGrounded = (Physics.Raycast(transform.position, -transform.up, characterController.height/1.8F));\r\n    }\r\n}\r\n"}}