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

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

public increaseMana ( int n ) : void
n int
Результат void
	public void increaseMana(int n){
		int dif = this.getMP()+n;
		if (dif > this.getMAXMP()){
			this.setMP (this.getMAXMP());
		}else{
			this.setMP(dif);
		}
	}
	public void increaseHeal(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::increaseMana