Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- namespace PUNTutorial
- {
- public class PlayerHealth : Photon.PunBehaviour
- {
- const int MAX_HP = 100;
- int hitPoints = MAX_HP;
- public void DoDamage(Missile missile)
- {
- hitPoints = Mathf.Clamp(hitPoints - missile.damage, 0 , MAX_HP);
- Debug.Log(GetHealthString());
- }
- string GetHealthString()
- {
- return new System.Text.StringBuilder()
- .Append("Health = ")
- .Append(hitPoints / (float)MAX_HP * 100)
- .Append("%")
- .ToString();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement