// Use this for initialization void Start() { behaviours.Add(new EnemyPathing(this, pathingWeight)); behaviours.Add(new EnemyFlocking(this, flockingWeight)); behaviours.Add(new EnemyWander(this, wanderWeight)); //This one needs work cc = GetComponent <CharacterController>(); anim = GetComponent <Animator>(); health = GetComponent <EnemyHealth>(); attackHitbox = transform.Find("AttackBox").GetComponent <EnemyAttackBox>(); p1HP = FlowFieldGenerator.GetInstance().targets[0].GetComponent <PlayerHealth>(); p2HP = FlowFieldGenerator.GetInstance().targets[1].GetComponent <PlayerHealth>(); }
protected void Awake() { base.Awake(); Physics2D.IgnoreLayerCollision(LayerMask.NameToLayer("Enemy"), LayerMask.NameToLayer("Enemy"), true); walls = GameObject.FindObjectsOfType <Wall>(); hero = GameObject.Find("Hero").GetComponent <Hero>(); ani = this.GetComponent <EnemyAnimation>(); //초기화들 //originHp = Random.Range(1, 4); //nowHp = originHp; //hpSprSize = hpSpr.transform.localScale.x; isDead = false; isMove = true; hitHero = false; attackCoolTime = 0f; atkBox = gameObject.GetComponentInChildren <EnemyAttackBox>(); //StartCoroutine(AttackHeroRoutine()); }
public void TakenHit(BodyPart b, EnemyAttackBox eab) { //if this body part is dead, it is dead if(bodyPartHealth[(int)b] <= 0){ return; } //subtract health bodyPartHealth[(int)b] -= eab.Damage * eab.damageMultiplier; //if this body part crosses into 0, do what you will if(bodyPartHealth[(int)b] <= 0){ bodyPartDeath(b); } //Debug.Log ("health of " + b + " is now " + bodyPartHealth[(int)b]); }
void Start() { attackBox = GetComponentInChildren <EnemyAttackBox>(); }