コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        this._isGrounded = Physics2D.Linecast(_transform.position, this._tagGround.position, _payerMask);
        Debug.Log(this._isGrounded);
        myAnim.UpdateIsGrounded(this._isGrounded);

        //if user play the game via NOT mobile phone, run this code
        #if !UNITY_ANDROID && !UNITY_IPHONE && !UNITY_BLACKBERRY && !UNITY_WINRT || UNITY_EDITOR
        this._hInput = Input.GetAxisRaw("Horizontal");
        myAnim.UpdateSpeed(this._hInput);

        if (Input.GetButtonDown("Jump"))
        {
            Jump();
        }
        #endif

        Move(this._hInput);


        /*
         * this._move = Input.GetAxis("Horizontal");
         * this._jump = Input.GetAxis("Vertical");
         *
         * if (this._move !=0)
         * {
         *  //Set facingRight when user input Horizontal key
         *  if(this._move > 0)
         *  {
         *      this._facingRight = true;
         *  }
         *  if(this._move < 0)
         *  {
         *      this._facingRight = false;
         *  }
         *  //set animation as walking
         *  this._animator.SetInteger("Anim_state", 1);
         * }
         * //set animation as stand
         * else
         * {
         *  this._animator.SetInteger("Anim_state", 0);
         * }
         *
         * if(this._jump>0)
         * {
         *  //set animation as jumping
         *  this._animator.SetInteger("Anim_state", 2);
         * }
         *
         * this._flip();
         * //this.Movement();
         *
         */
    }