Life.getLife C# (CSharp) Method

getLife() public method

public getLife ( ) : float
return float
	public float getLife()
	{
		return _life;
  }

Usage Example

コード例 #1
0
    private void Update()
    {
        if (life.getLife() <= 0)
        {
            if (!isDieing)
            {
                isDieing = true;
                animation.Play("Anim_Death");
                dieingSound.Play();
                deathParticles.SetActive(true);
                Destroy(gameObject, animation.clip.length);
            }
            return;
        }

        if (navMeshAgent.isStopped)
        {
            state = StateAI.Attacking;
            if (!animation.isPlaying)
            {
                animation.Play("Anim_Attack");
                playerLife.decreaseLife(attackPower * Time.deltaTime);
                attackSound.Play();
            }
        }
        else
        {
            state = StateAI.Walking;
            if (!animation.isPlaying)
            {
                animation.Play("Anim_Run");
            }
        }
    }
All Usage Examples Of Life::getLife