コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        //movement = new Vector2(Input.GetAxis("Horizontal"), 0f);
        //// Pick up object
        //if (Input.GetKey(KeyCode.Space))
        //{
        //    pickUpBlock();
        //}

        //if (target != null)
        //{
        //    var distanceX = target.position.x - transform.position.x;
        //    Debug.Log("distanceX " + distanceX);

        //    if (Mathf.Abs(distanceX) <= 0.08f)
        //    {
        //        movement = Vector2.zero;
        //    }
        //    else
        //    {
        //        movement = new Vector2(distanceX, 0f).normalized;
        //    }
        //}

        currentState = currentState.DoState(this);
    }
コード例 #2
0
    void Start()
    {
        rb = GetComponent <Rigidbody>();

        blocksInRange      = new List <GameObject>();
        lastBlockListCount = 0;

        currentState = IdleState;
    }