// Update is called once per frame void Update() { switch (status) { case monster_status.follow: gameObject.GetComponent <Animation> ().CrossFade(ml.walk_look); gameObject.GetComponent <NavMeshAgent>().SetDestination(com.p.transform.position); if ((transform.position - com.p.transform.position).sqrMagnitude < 2) { status = monster_status.stop_to_attack; dot.not_pause_and_start_immedia(); } break; case monster_status.run_for_life: break; case monster_status.stop_to_attack: gameObject.GetComponent <Animation> ().CrossFade(ml.attack_look); if ((transform.position - com.p.transform.position).sqrMagnitude >= 2) { status = monster_status.follow; dot.pause(); } break; case monster_status.dead: break; } }
// Use this for initialization void Start() { status = monster_status.follow; dot = com.ts.add_dot(float.PositiveInfinity, hurt_cd, () => { com.p.hp.hurt(hurt); gameObject.GetComponent <Animation>().CrossFade(ml.attack_look); }, () => { }); dot.pause(); }
private void dead() { status = monster_status.dead; coin_manager.drop(Random.Range(coin_min, coin_max), gameObject.transform.position); gameObject.GetComponent <CapsuleCollider> ().enabled = false; gameObject.GetComponent <Animation> ().CrossFade(ml.dead_look); nav_mesh_agent.enabled = false; com.p.exp.gain_exp(exp); com.ts.cancle_dot(dot); Invoke("destory", 10); }