Example #1
0
 void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.CompareTag("PlayerTwo") && punching)
     {
         playerTwoControl         = player.GetComponentInChildren <PlayerTwoControl>();
         playerTwoControl.health -= (int)Random.Range(5.0f, 40.0f);
     }
 }
Example #2
0
 void Update()
 {
     playerTwoControl = player.GetComponentInChildren <PlayerTwoControl>();
     health.text      = "HP - " + playerTwoControl.health.ToString();
 }