예제 #1
0
    /*
     * private void FixedUpdate()
     * {
     *  float moveHorizontal = Input.GetAxis("Horizontal");
     *  float moveVertical = Input.GetAxis("Vertical");
     *
     *  Vector2 movement = new Vector2(moveHorizontal, moveVertical);
     *
     *  rb.AddForce(movement * speed);
     * }
     */

    private void OnCollisionEnter2D(Collision2D collision)
    {
        HealthBarHandlerEnemy.SetHealthBarValue(HealthBarHandlerEnemy.GetHealthBarValue() - 0.1f);
        if (HealthBarHandlerEnemy.GetHealthBarValue() <= 0)
        {
            Destroy(gameObject);
        }
    }
예제 #2
0
    //public float speed;

    //private Rigidbody2D rb;

    private void Start()
    {
        //rb = GetComponent<Rigidbody2D>();
        HealthBarHandlerEnemy.SetHealthBarValue(1);
    }
예제 #3
0
 // Start is called before the first frame update
 void Start()
 {
     HealthBarHandlerEnemy.SetHealthBarValue(1);
 }