コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space) && !foi)
        {
            speed = 0;
            if ((Mathf.Abs(transform.position.x - posX) < (width / 1000)))
            {
                foi = true;
                this.transform.position = new Vector3(posX, this.transform.position.y, this.transform.position.z);
                manager.ApplySuccess();
            }
            else
            {
                manager.ApplyFail();
            }
        }

        velocity = speed * direction.normalized;
        this.transform.position = this.transform.position + velocity * Time.deltaTime;
    }