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"); } } }
private void Form1_Load(object sender, EventArgs e) { CreateTableBox(); life = new Life(Pattern.PatternTy.TYPE_1); drawTable(life.getLife()); lifeThread = new LifeThread(this, life, Pattern.PatternTy.TYPE_1); lifeThread.startThread(); }
private void Update() { if (life.getLife() <= 0) { return; } Vector3 playerPosition = TPSWalker.floorPoint; navMeshAgent.SetDestination(playerPosition); float distance = Vector3.Distance(transform.position, playerPosition); if (distance < minDist) { navMeshAgent.isStopped = true; } else { navMeshAgent.isStopped = false; } }
//Getter & setter for the life. public float getLife() { return(_lifeManager.getLife()); }
public void onLifeCreated(Life life) { drawTable(life.getLife()); lifeThread = new LifeThread(this, life, Pattern.PatternTy.TYPE_1); lifeThread.startThread(); }