コード例 #1
0
    // Update is called once per frame
    void FixedUpdate()
    {
        healthMeter.SetHealth(currentHealth); //meter code

        float   moveHorizontal = Input.GetAxis("Horizontal");
        float   moveVertical   = Input.GetAxis("Vertical");
        Vector2 movement       = new Vector2(moveHorizontal, moveVertical);

        rb2D.AddForce(movement * speed);
    }
コード例 #2
0
 void FixedUpdate()
 {
     healthMeter.SetHealth(currentHealth); //links your variable to the meter's fill
 }