MainPjMovement.increaseHeal C# (CSharp) Метод

increaseHeal() публичный Метод

public increaseHeal ( int n ) : void
n int
Результат void
	public void increaseHeal(int n){
		int dif = this.getHP()+n;
		if (dif > this.getMAXHP()){
			this.setHP (this.getMAXHP());
		}else{
			this.setHP(dif);
		}
	}
	public bool substractManaSpell(int n){

Usage Example

Пример #1
0
    void OnControllerColliderHit(ControllerColliderHit hit)
    {
        GameObject     go     = GameObject.FindGameObjectWithTag("Player");
        MainPjMovement target = go.GetComponent("MainPjMovement") as MainPjMovement;

        if (target.getHP() != target.getMAXHP())
        {
            if (hit.gameObject.tag == "BigHealPotion")
            {
                PJAudio.DrinkPotion();
                target.increaseHeal(200);
                Destroy(hit.gameObject);
            }
            if (hit.gameObject.tag == "LittleHealPotion")
            {
                PJAudio.DrinkPotion();
                target.increaseHeal(100);
                Destroy(hit.gameObject);
            }
        }
        if (target.getMP() != target.getMAXMP())
        {
            if (hit.gameObject.tag == "BigManaPotion")
            {
                target.increaseMana(200);
                Destroy(hit.gameObject);
            }
            if (hit.gameObject.tag == "BigManaPotion")
            {
                target.increaseMana(100);
                Destroy(hit.gameObject);
            }
        }
        if (hit.gameObject.tag == "Shield")
        {
            target.setShield(true);

            Destroy(hit.gameObject);
        }
    }
All Usage Examples Of MainPjMovement::increaseHeal